From 114492ebb636aba3471e3385493ecdcc0e997087 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Wed, 22 Mar 2023 15:56:14 +0800 Subject: [PATCH] docs: create xdc documents --- docs/README.md | 15 ++ docs/install.md | 123 +++++++++++ docs/run.md | 29 +++ docs/setup-test-enviroment.md | 73 +++++++ docs/test-globiance.md | 189 ++++++++++++++++ docs/test-xdc-chain.md | 390 ++++++++++++++++++++++++++++++++++ docs/test-xsswap.md | 345 ++++++++++++++++++++++++++++++ docs/upgrade.md | 24 +++ 8 files changed, 1188 insertions(+) create mode 100644 docs/README.md create mode 100644 docs/install.md create mode 100644 docs/run.md create mode 100644 docs/setup-test-enviroment.md create mode 100644 docs/test-globiance.md create mode 100644 docs/test-xdc-chain.md create mode 100644 docs/test-xsswap.md create mode 100644 docs/upgrade.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..ef70047712 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,15 @@ +# User guide for xdc + +## Original README + +Here is [the original README.md](../README.original.md). + +## Documents for xdc + +- [Fresh install](./install.md) +- [Upgrade old version](./upgrade.md) +- [Run hummingbot](./run.md) +- [Setup test enviroment](./setup-test-enviroment.md) +- [Test xdc chain](./test-xdc-chain.md) +- [Test xsswap exchange](./test-xsswap.md) +- [Test globiance exchange](./test-globiance.md) diff --git a/docs/install.md b/docs/install.md new file mode 100644 index 0000000000..2f89fd48c2 --- /dev/null +++ b/docs/install.md @@ -0,0 +1,123 @@ +# Install hummingbot + +## 1. Environment + +- OS: Ubuntu 22.04 +- hummingbot: v1.13.0 + +## 2. Install dependencies + +```shell +sudo apt update -y +sudo apt install -y build-essential curl git httpie jq wget +``` + +## 3. Install Miniconda3 + +```shell +cd ${HOME} +wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh +chmod +x Miniconda3-latest-Linux-x86_64.sh +./Miniconda3-latest-Linux-x86_64.sh -b -u +./miniconda3/bin/conda init +# Reload .bashrc to register "conda" command +exec bash +conda install -y conda-build +``` + +## 4. Install client + +### 4.1 Install client + +```shell +cd ${HOME} +git clone https://github.com/Carry-So/hummingbot.git +cd hummingbot +git checkout xdc-release-1.13.0 +./clean +./install +conda activate hummingbot +./compile +``` + +### 4.2 Start client + +Start hummingbot by run command: + +```shell +cd ${HOME}/hummingbot +bin/hummingbot.py +``` + +Setup your password when first login, refer to https://docs.hummingbot.org/operation/password/#creating-a-password. + +### 4.3 generate certificates + +Then run command `gateway generate-certs` in the input panel to generate self-signed certificates, refer to https://docs.hummingbot.org/gateway/installation/#generate-certs. + +![096258ea4fc1c15ad154e99d7365ea9](https://user-images.githubusercontent.com/7695325/226868318-0188180e-0515-4a37-b919-1e14f84df693.png) + +## 5. Install gateway + +### 5.1 Install gateway + +```shell +cd ${HOME} +git clone https://github.com/Carry-So/hummingbot-gateway.git +cd hummingbot-gateway +git checkout xdc-release-1.13.0 + +# Install dependencies +yarn + +# Complile Typescript into Javascript +yarn build +``` + +### 5.2 Setup gateway + +Run Gateway setup script, which helps you set configs and certificates: + +```shell +cd ${HOME}/hummingbot +./gateway-setup.sh +``` + +Below is the interactive process: + +```text +=============== SETUP GATEWAY =============== + + +Enter path to the Hummingbot certs folder >>> /home/liudan/hummingbot/certs + + Confirm if this is correct: + + Copy configs FROM: /home/liudan/hummingbot-gateway/src/templates + Copy configs TO: /home/liudan/hummingbot-gateway/conf + + Copy certs FROM: /home/liudan/hummingbot/certs + Copy certs TO: /home/liudan/hummingbot-gateway/certs + +Do you want to proceed? [Y/N] >>> Y + +Files successfully copied from /home/liudan/hummingbot-gateway/src/templates to /home/liudan/hummingbot-gateway/conf + +Files successfully copied from /home/liudan/hummingbot/certs to /home/liudan/hummingbot-gateway/certs +``` + +### 5.3 Start gateway + +Start gateway using passphrase: + +```shell +cd ${HOME}/hummingbot-gateway +# yarn start --passphrase=daniel +yarn start --passphrase= +``` + +### 5.4 Test connection + +The client should show: `Gateway: ONLINE` on the top of log pane(right) now. Run the command `gateway test-connection` in Hummingbot to test the connection. Now, you can type command `exit` in client to quit now. When you exit and restart client, it should automatically detect whether gateway is running and connect to it. + +![1679479291584](https://user-images.githubusercontent.com/7695325/226868564-5a05c170-f142-4768-93f8-f7f545887213.png) diff --git a/docs/run.md b/docs/run.md new file mode 100644 index 0000000000..39c2cdd730 --- /dev/null +++ b/docs/run.md @@ -0,0 +1,29 @@ +# Run hummingbot + +## 1. Start gateway + +Run the following commands to start gateway: + +```shell +cd ${HOME}/hummingbot-gateway +# yarn start --passphrase=daniel +yarn start --passphrase= +``` + +![1679479660200](https://user-images.githubusercontent.com/7695325/226870035-f060c2d7-bd1b-4d9c-9622-2344c37b48cf.png) + +## 2. Start client + +Run the following commands to start client: + +```shell +cd ${HOME}/hummingbot +conda activate hummingbot +bin/hummingbot.py +``` + +## 3. Connect xsswap + +Run the command `gateway connect xsswap` in client. + +![1679640895282](https://user-images.githubusercontent.com/7695325/227447487-5f736dc6-85d6-41e0-807f-e644bffe1e31.png) diff --git a/docs/setup-test-enviroment.md b/docs/setup-test-enviroment.md new file mode 100644 index 0000000000..af4e337275 --- /dev/null +++ b/docs/setup-test-enviroment.md @@ -0,0 +1,73 @@ +# Setup test enviroment + +## 1. Install dependent packages + +```shell +sudo apt update +sudo apt install -y curl httpie jq +``` + +![1679628520407](https://user-images.githubusercontent.com/7695325/227417028-79ae7b2b-aca3-4d25-aa09-73749e8bba32.png) + +The httpie is recommended to send https request in our test cases. You can use curl also. + +## 2. Set environment variables + +Set the following environment variables: + +```shell +# address of gateway, maybe different in your environment +export SERVER="https://127.0.0.1:15888" + +# POST command use JSON format +export HEADER="Content-Type: application/json" + +# public key of test account, replace it with your account +export ETH_ADDRESS="0xD4CE02705041F04135f1949Bc835c1Fe0885513c" +export XDC_ADDRESS="xdcD4CE02705041F04135f1949Bc835c1Fe0885513c" + +# path of certs +CERTS_PATH="${HOME}/hummingbot/certs" +export GATEWAY_CERT="${CERTS_PATH}/client_cert.pem" +export GATEWAY_KEY="${CERTS_PATH}/client_key.pem" +``` + +![1679627883880](https://user-images.githubusercontent.com/7695325/227415681-e8386105-76c7-44a1-825c-b0cf83fd319d.png) + +## 3. Config httpie + +Remember to delete this file after test. + +```shell +mkdir -p ${HOME}/.config/httpie + +cat > ${HOME}/.config/httpie/config.json < +yarn +yarn build +``` + +## 2. Upgrade client + +```shell +cd ${HOME}/hummingbot +git fetch --all +git checkout +conda deactivate +./clean +./install +conda activate hummingbot +./compile +```