Skip to content

Commit 26a64c5

Browse files
authored
Merge pull request #55 from zigbee-alliance/feature/genesis-node-instruction
Added instruction for genesis node deployment
2 parents 79f9efb + 58e2c74 commit 26a64c5

File tree

1 file changed

+161
-0
lines changed

1 file changed

+161
-0
lines changed

docs/running-genesis-node.md

+161
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
## Running Node
2+
3+
This document describes in details how to configure a genesis (first) validator node.
4+
5+
### Hardware requirements
6+
7+
Minimal:
8+
- 1GB RAM
9+
- 25GB of disk space
10+
- 1.4 GHz CPU
11+
12+
Recommended (for highload applications):
13+
- 2GB RAM
14+
- 100GB SSD
15+
- x64 2.0 GHz 2v CPU
16+
17+
### Operating System
18+
19+
Current delivery is compiled and tested under `Ubuntu 18.04.3 LTS` so we recommend using this distribution for now. In future, it will be possible to compile the application for a wide range of operating systems thanks to Go language.
20+
21+
## Components
22+
23+
The delivery must consist of the following components:
24+
25+
* Binary artifacts:
26+
* dcld: The binary used for running a node.
27+
* dclcli: The binary that allow users to interact with pool ledger.
28+
* Genesis transactions file: `genesis.json`
29+
* The list of alive peers: `persistent_peers.txt`. It has the following format: `<node id>@<node ip>,<node2 id>@<node2 ip>,...`.
30+
* The service configuration file `dcld.service`
31+
32+
### Deployment steps
33+
34+
1. Put `dcld` and `dclcli` binaries to `/usr/bin/` and configure permissions.
35+
36+
2. Configure dclcli:
37+
* `dclcli config chain-id dclchain`
38+
* `dclcli config output json` - Output format (text/json).
39+
* `dclcli config indent true` - Add indent to JSON response.
40+
* `dclcli config trust-node false` - Verify proofs for node responses.
41+
* `dclcli config node tcp://localhost:26657` - Address of the genesis node.
42+
43+
3. Prepare keys:
44+
* Derive a new private key and encrypt to disk: `dclcli keys add <name>`.
45+
Expected output format:
46+
```json
47+
{
48+
"name": <name>, // key name. can be used for signing transactions
49+
"type": "local",
50+
"address": string, // bench32 encoded address
51+
"pubkey": string, // bench32 encoded public key
52+
"mnemonic": string // seed that can be used to generate the same private/public key pair
53+
}
54+
```
55+
* Remember generated `address` and `pubkey` they will be used later.
56+
You can retrieve `address` and `pubkey` values anytime using `dclcli keys show <name>`.
57+
Of course, only on the machine where the keypair was generated.
58+
59+
4. Prepare genesis node configuration:
60+
61+
* Initialize new configuration: `dcld init <node-name> --chain-id dclchain`.
62+
* Add genesis account with the generated key and `Trustee`, `NodeAdmin` roles:
63+
`dcld add-genesis-account --address=<address> --pubkey=<pubkey> --roles="Trustee,NodeAdmin"`
64+
* Optionally, add other genesis accounts using the same command.
65+
* Create genesis transaction: `dcld gentx --from <name>`
66+
* Collect genesis transactions: `dcld collect-gentxs`.
67+
* Validate genesis file: `dcld validate-genesis`.
68+
* Genesis file is located in `$HOME/.dcld/config/genesis.json`. Give this file to each new node admin.
69+
70+
5. Run node:
71+
* Open `26656` (p2p) and `26657` (RPC) ports.
72+
* `sudo ufw allow 26656/tcp`
73+
* `sudo ufw allow 26657/tcp`
74+
* Edit `dcld.service`
75+
* Replace `ubuntu` with a user name you want to start service on behalf
76+
* Copy service configuration.
77+
* `cp dcld.service /etc/systemd/system/`
78+
* Optionally, edit `$HOME/.dcld/config/config.toml` in order to set different setting (like listen address).
79+
* Enable the service: `sudo systemctl enable dcld`
80+
* Start node: `sudo systemctl start dcld`
81+
* For testing purpose the node can be started in CLI mode: `dcld start` (instead of two previous `systemctl` commands).
82+
Service mode is recommended for demo and production environment.
83+
84+
* Use `systemctl start status` to get the node service status.
85+
In the output, you can notice that `height` increases quickly over time.
86+
This means that the node in updating to the latest network state (it takes some time).
87+
88+
You can also check node status by executing the command `dclcli status` to get the current status.
89+
The value of `latest_block_height` reflects the current node height.
90+
91+
6. Check that genesis account is created:
92+
93+
* In order to ensure that account is created and has assigned role you can use the command:
94+
`dclcli query auth account --address=<address>`.
95+
Expected output format:
96+
```json
97+
{
98+
"result": {
99+
"address": string, // bench32 encoded address
100+
"public_key": "string, // bench32 encoded public key
101+
"roles": [
102+
"NodeAdmin"
103+
],
104+
"coins": [],
105+
"account_number": string,
106+
"sequence": string
107+
},
108+
"height": string
109+
}
110+
```
111+
112+
6. Check the node is running and participates in consensus:
113+
* Get the list of all nodes: `dclcli query validator all-nodes`.
114+
The node must present in the list and has the following params: `power:10` and `jailed:false`.
115+
116+
* Get the node status: `dclcli status --node <node ip>`.
117+
The value of `node ip` matches to `[rpc] laddr` field in `$HOME/.dcld/config/config.toml`
118+
(TCP or UNIX socket address for the RPC server to listen on).
119+
Make sure that `result.sync_info.latest_block_height` is increasing over the time (once in about 5 sec).
120+
Expected output format:
121+
```json
122+
{
123+
"node_info": {
124+
"protocol_version": {
125+
"p2p": "7",
126+
"block": "10",
127+
"app": "0"
128+
},
129+
"id": string, // matches to prefix <ID> of the file: $HOME/.dcld/config/gentx/gentx-<ID>.json
130+
"listen_addr": "tcp://0.0.0.0:26656", // Address to listen for incoming connections. Matches to $HOME/.dcld/config/config.toml [p2p] `laddr` filed.
131+
"network": "dclchain",
132+
"version": "0.32.8",
133+
"channels": string,
134+
"moniker": string,
135+
"other": {
136+
"tx_index": "on",
137+
"rpc_address": "tcp://127.0.0.1:26657" // TCP or UNIX socket address for the RPC server to listen on. Matches to $HOME/.dcld/config/config.toml [rpc] `laddr` filed.
138+
}
139+
},
140+
"sync_info": {
141+
"latest_block_hash": string,
142+
"latest_app_hash": "string,
143+
"latest_block_height": string,
144+
"latest_block_time": string,
145+
"catching_up": bool
146+
},
147+
"validator_info": {
148+
"address": string,
149+
"pub_key": {
150+
"type": string,
151+
"value": string
152+
},
153+
"voting_power": string
154+
}
155+
}
156+
```
157+
158+
* Get the list of nodes participating in the consensus for the last block: `dclcli tendermint-validator-set`.
159+
* You can pass the additional value to get the result for a specific height: `dclcli tendermint-validator-set 100`.
160+
161+
7. Congrats! You are an owner of the genesis node.

0 commit comments

Comments
 (0)