|
1 |
| -## Add Observer Node to Testnet 2.0 |
2 |
| -Here is the step-by-step guide for adding an Observer Node to Testnet 2.0 using `state sync` option |
| 1 | +# Add Observer Node to Testnet 2.0 |
| 2 | + |
| 3 | +Here is the step-by-step guide for adding an Observer Node to Testnet 2.0 using `state sync` option |
3 | 4 | as described in [Runing Node in Existing Network](../../../docs/running-node-in-existing-network.md) document:
|
4 |
| -1. ### Configure an instance |
5 |
| - |
6 |
| - 1.1. Ubuntu 20.04 LTS is recommended. |
7 |
| - |
8 |
| - 1.2. (Optional) Clean up the system |
9 |
| - > **_Note:_** Following steps are needed if you earlier version of DCL installed on the same computer |
10 |
| -
|
11 |
| - ```bash |
12 |
| - sudo systemctl stop dcld |
13 |
| - sudo rm -f "$(which dcld)" |
14 |
| - rm -rf "$HOME/.dcl" |
15 |
| - ``` |
16 |
| - |
17 |
| - 1.3. Configure the firewall |
18 |
| - |
19 |
| - * p2p and RPC (by default: `26656` and `26657` respectively) should be available for TCP connections. |
20 |
| - For Ubuntu: |
21 |
| - |
22 |
| - ```bash |
23 |
| - # P2P |
24 |
| - sudo ufw allow 26656/tcp |
25 |
| -
|
26 |
| - # RPC |
27 |
| - sudo ufw allow 26657/tcp |
28 |
| -
|
29 |
| - # gRPC |
30 |
| - sudo ufw allow 9090/tcp |
31 |
| -
|
32 |
| - # REST |
33 |
| - sudo ufw allow 1317/tcp |
34 |
| - ``` |
35 |
| - |
36 |
| - * In case of IP filtering rules ensure they allow incoming and outcoming connections from/to other peers. |
37 |
| - |
38 |
| -2. ### Download required artifacts |
39 |
| - 2.1. Get the release artifacts |
40 |
| - > **_Note:_** Downloading latest release artifacts is recommended. Cosmovisor service is available only starting from DCL `v0.8.0` |
41 |
| - |
42 |
| - ```bash |
43 |
| - curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/dcld |
44 |
| - curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/cosmovisor |
45 |
| - curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/cosmovisor.service |
46 |
| -
|
47 |
| - # helper script to automate running a node |
48 |
| - curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<release>/run_dcl_node |
49 |
| - ``` |
50 |
| - `<version>` - DCL release version (ex: `v0.9.0`) |
51 |
| - |
52 |
| - 2.2. Download genesis file for Testnet 2.0 |
53 |
| - ```bash |
54 |
| - curl -L -O https://raw.githubusercontent.com/zigbee-alliance/distributed-compliance-ledger/master/deployment/persistent_chains/testnet-2.0/genesis.json |
55 |
| - ``` |
56 |
| - |
57 |
| - 2.3. Put `cosmovisor` binary in a folder listed in `$PATH` (e.g. `/usr/bin/`) |
58 |
| - ```bash |
59 |
| - sudo cp ./cosmovisor /usr/bin/ |
60 |
| - sudo a+x /usr/bin/cosmovisor |
61 |
| - ``` |
62 |
| - |
63 |
| -3. ### Run Observer Node |
64 |
| - 3.1. Initialize node |
65 |
| - ```bash |
66 |
| - chmod u+x ./dcld |
67 |
| - ./dcld init "<node-name>" --chain-id "testnet-2.0" |
68 |
| - ``` |
69 |
| - |
70 |
| - 3.2. Set the following `state sync` parameters under `[statesync]` section in `$HOME/.dcl/config/config.toml` <br> |
71 |
| - ```bash |
72 |
| - [statesync] |
73 |
| - enable = true |
74 |
| -
|
75 |
| - rpc_servers = "https://on.test-net.dcl.csa-iot.org:26657,https://on.test-net.dcl.csa-iot.org:26657" |
76 |
| -
|
77 |
| - trust_height = <trust-height> |
78 |
| - trust_hash = "<trust-hash>" |
79 |
| - ``` |
80 |
| - |
81 |
| - You can get `<trust-height>` and `<trust-hash>` parameters using the following command: |
82 |
| - ```bash |
83 |
| - curl -s https://on.test-net.dcl.csa-iot.org:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}" |
84 |
| - ``` |
85 |
| - |
86 |
| - 3.3. Set `seeds` parameter under `[p2p]` section in `$HOME/.dcl/config/config.toml` |
87 |
| - ```bash |
88 |
| - [p2p] |
89 |
| - seeds = "8190bf7a220892165727896ddac6e71e735babe5@100.25.175.140:26656" |
90 |
| - ``` |
91 |
| - |
92 |
| - 3.4. Create an empty `persistent_peers.txt` in the current path because this file is required by `run_dcl_node` script. <br> |
93 |
| - Your observer node will use `Seed Node` to discover peers (see 3.3) |
94 |
| - ```bash |
95 |
| - touch persistent_peers.txt |
96 |
| - ``` |
97 |
| - |
98 |
| - 3.5. Run Observer Node |
99 |
| - ```bash |
100 |
| - chmod u+x ./run_dcl_node |
101 |
| - ./run_dcl_node -t observer -c "testnet-2.0" "<node-name>" |
102 |
| - ``` |
103 |
| - |
104 |
| - 3.6. Verify node is running <br> |
105 |
| - - Execute `source $HOME/.profile` to take the updated `$PATH` into effect, now |
106 |
| - it includes the directory containing the current version of `dcld` binary (if |
107 |
| - you have not modified or commented out the line doing the corresponding |
108 |
| - `$PATH` assignment in `run_dcl_node` script): |
109 |
| - ```bash |
110 |
| - source $HOME/.profile |
111 |
| - ``` |
112 |
| - |
113 |
| - |
114 |
| - - Check whether `catching_up` field is set to `false` after a while using the following query: |
115 |
| - ```bash |
116 |
| - dcld status |
117 |
| - ``` |
118 |
| - It may take couple of minutes to catch up using `state-sync` depending on how far the `statesync snapshot` was from the current state of the network |
| 5 | + |
| 6 | +## 1. Configure an instance |
| 7 | + |
| 8 | +### 1.1 Ubuntu 20.04 LTS is recommended |
| 9 | + |
| 10 | +### 1.2 (Optional) Clean up the system |
| 11 | + |
| 12 | +> **_Note:_** Following steps are needed if you earlier version of DCL installed on the same computer |
| 13 | +
|
| 14 | +```bash |
| 15 | +sudo systemctl stop dcld |
| 16 | +sudo rm -f "$(which dcld)" |
| 17 | +rm -rf "$HOME/.dcl" |
| 18 | +``` |
| 19 | + |
| 20 | +### 1.3 Configure the firewall |
| 21 | + |
| 22 | +* p2p and RPC (by default: `26656` and `26657` respectively) should be available for TCP connections. |
| 23 | + For Ubuntu: |
| 24 | + |
| 25 | +```bash |
| 26 | +# P2P |
| 27 | +sudo ufw allow 26656/tcp |
| 28 | + |
| 29 | +# RPC |
| 30 | +sudo ufw allow 26657/tcp |
| 31 | + |
| 32 | +# gRPC |
| 33 | +sudo ufw allow 9090/tcp |
| 34 | + |
| 35 | +# REST |
| 36 | +sudo ufw allow 1317/tcp |
| 37 | +``` |
| 38 | + |
| 39 | +* In case of IP filtering rules ensure they allow incoming and outcoming connections from/to other peers. |
| 40 | + |
| 41 | +## 2. Download required artifacts |
| 42 | + |
| 43 | +### 2.1 Get the release artifacts |
| 44 | + |
| 45 | +> **_Note:_** Downloading latest release artifacts is recommended. Cosmovisor service is available only starting from DCL `v0.8.0` |
| 46 | +
|
| 47 | +```bash |
| 48 | +curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/dcld |
| 49 | +curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/cosmovisor |
| 50 | +curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<version>/cosmovisor.service |
| 51 | + |
| 52 | +# helper script to automate running a node |
| 53 | +curl -L -O https://github.com/zigbee-alliance/distributed-compliance-ledger/releases/download/<release>/run_dcl_node |
| 54 | +``` |
| 55 | + |
| 56 | +`<version>` - DCL release version (ex: `v0.9.0`) |
| 57 | + |
| 58 | +### 2.2 Download genesis file for Testnet 2.0 |
| 59 | + |
| 60 | +```bash |
| 61 | +curl -L -O https://raw.githubusercontent.com/zigbee-alliance/distributed-compliance-ledger/master/deployment/persistent_chains/testnet-2.0/genesis.json |
| 62 | +``` |
| 63 | + |
| 64 | +### 2.3. Put `cosmovisor` binary in a folder listed in `$PATH` (e.g. `/usr/bin/`) |
| 65 | + |
| 66 | +```bash |
| 67 | +sudo cp ./cosmovisor /usr/bin/ |
| 68 | +sudo a+x /usr/bin/cosmovisor |
| 69 | +``` |
| 70 | + |
| 71 | +## 3. Run Observer Node |
| 72 | + |
| 73 | +### 3.1 Initialize node |
| 74 | + |
| 75 | +```bash |
| 76 | +chmod u+x ./dcld |
| 77 | +./dcld init "<node-name>" --chain-id "testnet-2.0" |
| 78 | +``` |
| 79 | + |
| 80 | +### 3.2 Set the following `state sync` parameters under `[statesync]` section in `$HOME/.dcl/config/config.toml` |
| 81 | + |
| 82 | +```ini |
| 83 | +[statesync] |
| 84 | +enable = true |
| 85 | + |
| 86 | +rpc_servers = "https://on.test-net.dcl.csa-iot.org:26657,https://on.test-net.dcl.csa-iot.org:26657" |
| 87 | + |
| 88 | +trust_height = <trust-height> |
| 89 | +trust_hash = "<trust-hash>" |
| 90 | +``` |
| 91 | + |
| 92 | +You can get `<trust-height>` and `<trust-hash>` parameters using the following command: |
| 93 | + |
| 94 | +```bash |
| 95 | +curl -s https://on.test-net.dcl.csa-iot.org:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}" |
| 96 | +``` |
| 97 | + |
| 98 | +### 3.3 Set `seeds` parameter under `[p2p]` section in `$HOME/.dcl/config/config.toml` |
| 99 | + |
| 100 | +```ini |
| 101 | +[p2p] |
| 102 | +seeds = "8190bf7a220892165727896ddac6e71e735babe5@100.25.175.140:26656" |
| 103 | +``` |
| 104 | + |
| 105 | +### 3.4 Create an empty `persistent_peers.txt` in the current path because this file is required by `run_dcl_node` script |
| 106 | + |
| 107 | +Your observer node will use `Seed Node` to discover peers (see 3.3) |
| 108 | + |
| 109 | +```bash |
| 110 | +touch persistent_peers.txt |
| 111 | +``` |
| 112 | + |
| 113 | +### 3.5 Run Observer Node |
| 114 | + |
| 115 | +```bash |
| 116 | +chmod u+x ./run_dcl_node |
| 117 | +./run_dcl_node -t observer -c "testnet-2.0" "<node-name>" |
| 118 | +``` |
| 119 | + |
| 120 | +### 3.6 Verify node is running |
| 121 | + |
| 122 | +Execute `source $HOME/.profile` to take the updated `$PATH` into effect, now |
| 123 | +it includes the directory containing the current version of `dcld` binary (if |
| 124 | +you have not modified or commented out the line doing the corresponding |
| 125 | +`$PATH` assignment in `run_dcl_node` script): |
| 126 | + |
| 127 | +```bash |
| 128 | +source $HOME/.profile |
| 129 | +``` |
| 130 | + |
| 131 | +Check whether `catching_up` field is set to `false` after a while using the following query: |
| 132 | + |
| 133 | +```bash |
| 134 | +dcld status |
| 135 | +``` |
| 136 | + |
| 137 | +It may take couple of minutes to catch up using `state-sync` depending on how far the `statesync snapshot` was from the current state of the network |
0 commit comments