THORChain 백서

THORChain

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 19쪽 중 13쪽

e the pod for a slow-syncing chain daemon (for example, `bitcoin-daemon`). The old Binance Chain `binance-daemon` chart is no longer in node-launcher. Killing it will automatically restart it with free resources and syncing is notably faster. You can check sync status by viewing logs for the daemon to find the synced chain tip and comparing it with the real-world blockheight: ```bash kubectl logs -f deploy/bitcoin-daemon -n thornode ``` {% endhint %} {% hint style="info" %} Get real-world blockheights of external blockchain at <https://gateway.liquify.com/chain/thorchain_api/thorchain/lastblock> or a block explorer like mempool.space. {% endhint %} ## CHART SUMMARY ### THORNode full stack / chart * **thornode**: Umbrella chart packaging all services needed to run a fullnode or validator THORNode. This should be the only chart used to run [THORNode stack ](/thornodes/overview#thornode-stack)unless you know what you are doing and want to run each chart separately (not recommended). #### THORNode services: * **thornode**: THORNode daemon * **gateway**: THORNode gateway proxy to get a single IP address for multiple deployments * **bifrost**: Bifrost service * **midgard**: Midgard API service ### Tools * **prometheus**: Prometheus stack for metrics * **loki**: Loki stack for logs * **kubernetes-dashboard**: Kubernetes dashboard # Joining How to join THORChain as an Node. ## **Joining THORChain** Now that you have a THORNode deployed in your Kubernetes cluster, you need to start operating your node to join the network. {% hint style="danger" %} Do not import your node menonic in a wallet. Nodes will have their own address. {% endhint %} There are a couple of steps to follow. ### 1. Check your current node status The first step would be to make sure your deployment was successful and your node is running correctly. \_\*\*\_To check the current status of your node, you can run the command status from the `node-launcher`repository on your terminal: ```bash make status ``` You will get an output along those lines, the example below is for a mainnet node: ```bash ________ ______ ___ _ __ __ /_ __/ // / __ \/ _ \/ |/ /__ ___/ /__ / / / _ / /_/ / , _/ / _ \/ _ / -_) /_/ /_//_/\____/_/|_/_/|_/\___/\_,_/\__/ ADDRESS thor13hh6qyj0xgw0gv7qpay8thfucxw8hqkved9vr2 IP VERSION 0.0.0 STATUS Unknown BOND 0.00 REWARDS 0.00 SLASH 0 PREFLIGHT { "status": "Standby", "reason": "node account has invalid registered IP address", "code": 1 } API http://:1317/thorchain/doc/ RPC http://:26657 MIDGARD http://:8080/v2/doc CHAIN SYNC BLOCKS THOR 55.250% 37,097/67,144 BTC 2.399% 227,986/678,340 ETH 7.764% 947,182/12,199,994 LTC 0.012% 6,526/1,818,000 BCH 2.293% 197,340/682,404 ``` Your node is running but as you can see in the \`Preflight\` section, your node is not yet ready to be churned in and currently is in standby [status](/thornodes/overview/node-operations#node-statuses), since your node has no IP address setup yet. Do not proceed until your node is fully synced across all chains. You can see the required external chain heights [here](https://gateway.liquify.com/chain/thorchain_api/thorchain/lastblock) and the THORChain chain height [here](https://gateway.liquify.com/chain/thorchain_api/thorchain/block). Continue to run `make status` until all chains are synced. {% hint style="danger" %} Before sending the BOND, verify that your THORNode is **fully synced** with connected chains. Connected chains such as Ethereum & Bitcoin may take a day to sync. If your node is fully bonded and is selected to churn in to THORChain as ACTIVE without fully syncing all connected chains, you will immediately get slashed for missing observations, and lose money. It is normal to see Ethereum sit on 99.999% for many hours - be patient. {% endhint %} {% hint style="danger" %} Only the original wallet that did the first BOND will be able to LEAVE/UNBOND. You can top up BOND using a different wallet but make sure you keep the private key to the original BOND wallet secure and accessible. {% endhint %} ### 2 - Send a small BOND (recommend 100-1000) To be able to set up the node IP address, you first need to get it whitelisted in the chain by sending your BOND. 1. You will do a "Deposit" transaction using RUNE. This is an internal MsgDeposit transaction (different from a MsgSend to another wallet). There is no destination address -- use an appropriate wallet such as [ASGARDEX](https://github.com/asgardex/asgardex-desktop/releases). The Bond is locked in a module controlled by the state machine. 2. Deposit your [BOND](https://dev.thorchain.org/concepts/memos.html#bond-unbond-and-leave) using the memo `BOND:<thornode-address>` (or use an appropriate GUI that does this memo for you). Send a small amount of RUNE to whitelist the node, the bond will be picked up. {% hint style="info" %} Some `make` commands during setup require RUNE (0.02 to 1.0) to execute into the state machine to prevent DDoS. If your bond is too small (e.g. 1 RUNE) you may run out and not be able to complete the setup until adding more. {% endhint %} Give the network 3-5 seconds to pick up your bond. To verify it has received your bond, run the following: ```bash curl https://gateway.liquify.com/chain/thorchain_api/thorchain/node/<node-address> ``` If you run `make status` again, you should see this: ```bash ________ ______ ___ _ __ __ /_ __/ // / __ \/ _ \/ |/ /__ ___/ /__ / / / _ / /_/ / , _/ / _ \/ _ / -_) /_/ /_//_/\____/_/|_/_/|_/\___/\_,_/\__/ ADDRESS thor13hh6qyj0xgw0gv7qpay8thfucxw8hqkved9vr2 IP VERSION 0.0.0 STATUS Whitelisted BOND 1000.00 REWARDS 0.00 SLASH 0 PREFLIGHT { "status": "Standby", "reason": "node account has invalid registered IP address", "code": 1 } API http://:1317/thorchain/doc/ RPC http://:26657 MIDGARD http://:8080/v2/doc CHAIN SYNC BLOCKS THOR 55.250% 37,097/67,144 BTC 2.399% 227,986/678,340 ETH 7.764% 947,182/12,199,994 LTC 0.012% 6,526/1,818,000 BCH 2.293% 197,340/682,404 ``` As you can see, it is in standby but does not have an IP registered yet. This is needed for peer discovery. ### 3 - Setup Node IP Address You must tell THORChain your IP-Address for its address book and seed-service to run properly: ```bash make set-ip-address ``` If you run the status command again, you should now see a different message for the Preflight section saying you need to set your node keys. {% hint style="info" %} Once your IP address has been registered for discovery, you can use your own host for queries. {% endhint %} {% hint style="danger" %} Do not import your node menonic in a wallet. Nodes will have their own address. {% endhint %} ### 4 - Setup Node keys Tell THORChain about your public keys for signing sessions: ```bash make set-node-keys ``` If you run the `make status` command again, you should now see that your node is in status “ready” and is now ready to be churned in the next rotation. ### 5 - Set Version Make sure your node broadcasts its latest version, else you won't churn in since THORChain enforces a version requirement. This version will appear in your `make status`. If you are on `0.0.0` then you haven't set your version: ```bash make set-version ``` ### 6 - Send Final Bond If you followed steps 1-5 above, your preflight will be saying: ```bash PREFLIGHT { "status": "Standby", "reason": "node account does not have minimum bond requirement: 100000000000/30000000000000, "code": 1 } ``` To address this, send the remaining bond, that is higher than the minimum bond, currently 300K RUNE set by a network [Mimir ](https://gateway.liquify.com/chain/thorchain_api/thorchain/mimir)setting, look for `MinimumBondInRune`. See [#bonding-the-right-amount](#bonding-the-right-amount "mention")for how much bond to send. If you finally run `make status` you should see this, with keyword **"Ready":** ```bash ________ ______ ___ _ __ __ /_ __/ // / __ \/ _ \/ |/ /__ ___/ /__ / / / _ / /_/ / , _/ / _ \/ _ / -_) /_/ /_//_/\____/_/|_/_/|_/\___/\_,_/\__/ ADDRESS thor13hh6qyj0xgw0gv7qpay8thfucxw8hqkved9vr2 IP 1.2.3.4 VERSION 0.54.0 STATUS Standby BOND 300,099.96 REWARDS 0.00 SLASH 0 PREFLIGHT { "status": "Ready", "reason": "OK", "code": 0 } API http://1.2.3.4:1317/thorchain/doc/ RPC http://1.2.3.4:26657 MIDGARD http://1.2.3.4:8080/v2/doc CHAIN SYNC BLOCKS THOR 100.000% 67,144/67,144 BTC 100.000% 678,340/678,340 ETH 100.000% 12,199,994/12,199,994 LTC 100.000% 1,818,000/1,818,000 BCH 100.000% 682,404/682,404 ``` ## Bonding The Right Amount Although your node is ready to be churned in, it doesn’t mean it will be the next one to be selected since someone else could have posted a higher bond than you. To maximise chances of a quick entry, monitor Midgard to see what everyone else is bonding and try to outbid them. This endpoint will show data on average, median, total, minimum and maximum bond amounts. For fastest entry, bond higher than the current active median. ```json curl -s https://gateway.liquify.com/chain/thorchain_midgard/v2/network | jq '.bondMetrics' resp: "bondMetrics" : { "averageActiveBond": "97664560467471", "averageStandbyBond": "9815575442995", "bondHardCap": "102284516414049", "maximumActiveBond": "111919846678019", "maximumStandbyBond": "104416033169205", "medianActiveBond": "99028435881350", "medianStandbyBond": "318000000", "minimumActiveBond": "53582883425758", "minimumStandbyBond": "52363105276428", "totalActiveBond": "9766456046747104", "totalStandbyBond": "353360715947839" } ``` {% hint style="info" %} RUNE is always displayed in 1e8 format, 100000000 = 1 RUNE {% endhint %} You will need to be greater than the `minimumActiveBond.`Bonding more than `bondHardCap` will not result in more [rewards](/thornodes/overview/risks-costs-and-rewards#compensation). `medianActiveBond` is a good target to get and stay active. {% hint style="info" %} Some useful community sites to assist monitoring your node are <https://thorchain.network>, [https://thorchain.net](https://thorchain.net/#/nodes). {% endhint %} ### Bonding More At any time during standby, you can bond more by making an additional BOND transaction with memo: `BOND:<thornode-address>` {% hint style="info" %} Only the original wallet that did the first BOND will be able to LEAVE/UNBOND. You can top up BOND using a different wallet but make sure you keep the private key to the original BOND wallet secure and accessible. {% endhint %} You can also [remove some of your bond](https://docs.thorchain.org/thornodes/leaving) whilst you are on [standby](/thornodes/overview/node-operations#node-statuses), using the UNBOND memo. ### Node Operator Fee * Setting the Node Operator fee `10000` causes all rewards to be paid back each churn. * Setting the Node Operator fee to `5000` causes 50% of rewards to be paid back to the Node Operator address and 50% to be accrued back to the bond. To set a Node Operator fee, send a deposit transaction with the following [memo](/thornodes/pooled-thornodes#node-operator): `BOND:<node address>:<bond wallet address>:<operator fee in basis pts>` See [Pooled THORNodes](/thornodes/pooled-thornodes)for full information. # Managing Accessing Logs, Metrics and more ## THORNode commands The Makefile provide different commands to help you operate your THORNode. There are two types of make commands, READ and WRITE. {% hint style="info" %} Run `make help` at any stage to get an exhaustive list of help options and how to interact with the system. See [here](https://gitlab.com/thorchain/devops/node-launcher/-/blob/master/README.md?ref_type=heads) for an overview of each command. {% endhint %} #### READ COMMANDS Read commands simply read your node state and doesn't commit any transactions. {% tabs %} {% tab title="STATUS" %} To get information about your node on how to connect to services or its IP, run the command below. You will also get your node address and the vault address where you will need to send your bond. ```bash make status ``` {% endtab %} {% tab title="SHELL" %} Opens a shell into your `thor-daemon` deployment: From within that shell you have access to the `thorcli` command. ```bash make shell ``` {% endtab %} {% tab title="LOGS" %} Display stream of logs of THORNode deployment: ```bash make logs ``` {% endtab %} {% tab title="MNEMONIC" %} This will print your node mnemonic (phrase). Use this to ever rescue your node funds if something goes wrong. *Note: Your bond is held at ransom in order to prevent you from stealing funds from this vault. Your bond will always be more valuable than funds on this vault, so you have no economic reason to touch these funds.* ```bash make mnemonic ``` {% endtab %} {% tab title="PASSWORD" %} A keystore file that secures your private keys is also stored on the THORNode. The password that is used to decrypt it can be printed by the following command ```bash make password ``` {% endtab %} {% tab title="RESTART" %} Restart a THORNode deployment service selected: ```bash make restart ``` {% endtab %} {% tab title="RESET" %} Reset a THORNode deployment service selected, including deleting the persistent volume. This command is **destructive** and will reset the chain back to 0%. You would use this for unrecoverable issues that `make restart` did not solve. ```bash make reset ``` {% endtab %} {% endtabs %} #### WRITE COMMANDS Write commands actually build and write transactions into the underlying statechain. They cost RUNE from your bond, currently 0.02, but you can check this on the `/constants` endpoint "CLICOSTINRUNE". This will post state in the chain which will be now updated globally. The RUNE fee is to prevent DDoS attacks. {% tabs %} {% tab title="NODE-KEYS" %} Send a `set-node-keys` to your node, which will set your node keys automatically for you by retrieving them directly from the `thor-daemon` deployment. ```bash make set-node-keys ``` {% endtab %} {% tab title="IP ADDDRESS" %} Send a `set-ip-address` to your node, which will set your node ip address automatically for you by retrieving the load balancer deployed directly. ```bash make set-ip-address ``` {% endtab %} {% tab title="VERSION" %} In order to update your THORNode to a new version, you will need to update the docker tag image used in your deployments. Depending on your choice of deployment this can be done differently. For Kubernetes deployments, you can edit the deployments of the different services you want to update using the commands below. To update your `thor-daemon`, `thor-api` and `bifrost` deployment images to version 0.2.0: ```bash kubectl set image deployment/thor-daemon thor-daemon=registry.gitlab.com/thorchain/thornode:mainnet-0.2.0 kubectl set image deployment/thor-api thor-api=registry.gitlab.com/thorchain/thornode:mainnet-0.2.0 kubectl set image deployment/bifrost bifrost=registry.gitlab.com/thorchain/thornode:mainnet-0.2.0 ``` To update your \`midgard\` deployment image to version 0.2.0 ```bash kubectl set image deployment/midgard midgard=registry.gitlab.com/thorchain/midgard:mainnet-0.2.0 ``` You can then follow the deployments restarting status either by checking your Kubernetes dashboard or using the CLI command below: ```bash kubectl get deployment/thor-daemon ``` Once the deployments are all in the ready state again, you need to broadcast to the network that you are running a new version using the command below: ```bash make set-version ``` {% endtab %} {% endtabs %} ## Tools Note, all of these should already be installed from `make tools`. However you can install them separately useing the DEPLOY tabs below. To access the tools, navigate to the ACCESS tabs below. All of these commands are to be run from `node-launcher` ### LOGS MANAGEMENT (LOKI) It is recommended to deploy a logs management ingestor stack within Kubernetes to redirect all logs within a database to keep history over time as Kubernetes automatically rotates logs after a while to avoid filling the disks. The default stack used within this repository is Loki, created by Grafana and open source. To access the logs you can then use the Grafana admin interface that was deployed through the Prometheus command. {% tabs %} {% tab title="DEPLOY" %} You can deploy the log management automatically using the command below: ```bash make install-loki ``` This command will deploy the Loki chart. It can take a while to deploy all the services, usually up to 5 minutes depending on resources running your kubernetes cluster. You can check the services being deployed in your kubernetes namespace `loki-system`. {% endtab %} {% tab title="ACCESS" %} **Access Grafana** See previous section to access the Grafana admin interface through the command `make grafana`. **Browse Logs** Within the Grafana admin interface, to access the logs, find the `Explore` view from the left menu sidebar. Once in the `Explore` view, select Loki as the source, then select the service you want to show the logs by creating a query. The easiest way is to open the "Log browser" menu, then select the "job" label and then as value, select the service you want. For example you can select `thornode/bifrost` to show the logs of the Bifrost service within the default `thornode` namespace when deploying a mainnet validator THORNode. ![](https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-84fbebfb183dd99daed2c0183769dedfeaec975e%2Fimage%20\(30\).png?alt=media) ![](https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-c5b381b2b20aa6a55deb4620a8b107f607ca11cb%2Fimage%20\(37\)%20\(1\).png?alt=media) ![](https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-b98569b47a0de10d2bbdf3010fa27c57e6b7317f%2Fimage%20\(36\)%20\(1\).png?alt=media) ![](https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-da4198784ad176ab34f9bb81a78b45a22e7852a6%2Fimage%20\(33\)%20\(1\).png?alt=media) {% endtab %} {% tab title="DESTROY" %} Destroy Loki logs management stack ```bash make destroy-loki ``` {% endtab %} {% endtabs %} ### METRICS MANAGEMENT (Prometheus) It is also recommended to deploy a Prometheus stack to monitor your cluster and your running services. {% tabs %} {% tab title="DEPLOY" %} You can deploy the metrics management automatically using the command below: ```bash make install-metrics ``` This command will deploy the prometheus chart. It can take a while to deploy all the services, usually up to 5 minutes depending on resources running your kubernetes cluster. You can check the services being deployed in your kubernetes namespace `prometheus-system`. {% endtab %} {% tab title="ACCESS" %} We have created a make command to automate this task to access Grafana from your local workstation: ```bash make grafana ``` Open [http://localhost:3000](http://localhost:3000/) in your browser. Login as the `admin` user. The default password should have been displayed in the previous command (`make grafana`). ![](https://3337783180-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FfvaTNxU33ciP7UstKtwU%2Fuploads%2Fgit-blob-6c848f812316a5ee636c7608265e3db5478edbc2%2Fimage%20\(16\).png?alt=media) **Access Prometheus admin UI** We have created a make command to automate this task to access Prometheus from your local workstation: ```bash make prometheus ``` Open [http://localhost:9090](http://localhost:9090/) in your browser. {% endtab %} {% endtabs %} As part of the tools command deployment, you also have deployed a Prometheus stack in addition to the Elasticsearch in your Kubernetes cluster. All CPU, memory, disk space, and THORNode / THORChain custom metrics are automatically being sent to the Prometheus database backend deployed in your cluster. You should have available different dashboards to see the metrics across you
프로젝트로 돌아가기