Make sure you have all prerequisites set up.
- Create
$HOME/.dcl/cosmovisor/genesis/bin
directory. - Copy
dcld
binary to it, set proper owner and execution permissions. Please note that execution permissions ondcld
should be granted to all (i.e. User, Group and Others classes) because cosmovisor requires execution permission on the application binary to be granted to Others class.
3. Choose the chain ID. Every network (for example, test-net, main-net, etc.) must have a unique chain ID
./dcld config chain-id <chain-id>
- Use
testnet-2.0
for<chain-id>
if you want to connect to the persistent Test Net - the chosen unique chain ID. - Use
main-net
for<chain-id>
if you want to connect to the persistent Test Net - the chosen unique chain ID.
- Use
./dcld config output json
- Output format (text/json).
./dcld init "<node-name>" --chain-id "<chain-id>"
[p2p]
pex = false
addr_book_strict = false
[consensus]
create_empty_blocks = false
create_empty_blocks_interval = "600s" # 10 mins
[state-sync]
snapshot-interval = "snapshot-interval"
snapshot-keep-recent = "snapshot-keep-recent"
./dcld keys add "<key-name>" 2>&1 | tee "<key-name>.dclkey.data"
- Remember generated
address
andpubkey
they will be used later. You can retrieveaddress
andpubkey
values anytime using./dcld keys show <name>
. Of course, only on the machine where the keypair was generated.
Notes: It's important to keep the generated data (especially a mnemonic that allows to recover a key) in a safe place
Run node:
./run_dcl_node -t genesis -c "<chain-id>" --gen-key-name "<node-admin-key>" [--gen-key-name-trustee "<trustee-key>"] "<node-name>"
This command:
-
generates
genesis.json
file with the following entries:- a genesis account with
NodeAdmin
role - (if a trustee key is provided) a genesis account with
Trustee
role - a genesis txn that makes the local node a validator
- a genesis account with
-
configures and starts the node
-
the script assumes that:
- current user is going to be used for
cosmovisor
service to run as - current user is in sudoers list
- current user is going to be used for
-
you may likely want to note the summary that this script prints, in particular: node's address, public key and ID.
- Add genesis account with the generated key and
Trustee
,NodeAdmin
roles:./dcld add-genesis-account --address=<address> --pubkey=<pubkey> --roles="Trustee,NodeAdmin"
- Optionally, add other genesis accounts using the same command.
- Create genesis transaction:
./dcld gentx --from <name>
, where<name>
is the keys' name specified at Step 5. - Collect genesis transactions:
./dcld collect-gentxs
. - Validate genesis file:
./dcld validate-genesis
. - Genesis file is located in
$HOME/.dcl/config/genesis.json
. Give this file to each new node admin.
-
Open
26656
(p2p) and26657
(RPC) ports.sudo ufw allow 26656/tcp
sudo ufw allow 26657/tcp
-
Edit
cosmovisor.service
- Replace
ubuntu
with a username you want to start service on behalf
- Replace
-
Copy service configuration.
cp cosmovisor.service /etc/systemd/system/
-
Make your node public:
- Open
$HOME/.dcl/config/config.toml
- Find the line under
# TCP or UNIX socket address for the RPC server to listen on
- Change it to:
laddr = "tcp://0.0.0.0:26657"
- Open
-
Optionally, edit
$HOME/.dcl/config/config.toml
in order to set different setting (like listen address). -
Enable the service:
sudo systemctl enable cosmovisor
-
Start node:
sudo systemctl start cosmovisor
-
For testing purpose the node process can be started directly:
./dcld start
(instead of two previoussystemctl
commands usingcosmovisor
service). Service mode is recommended for demo and production environment. -
Use
systemctl status cosmovisor
to get the node service status. -
Use
journalctl -u cosmovisor.service -f
to see node logs. -
You can also check node status by executing the command
./dcld status
to get the current status. The value oflatest_block_height
reflects the current node height. -
Add the following line to the end of
$HOME/.profile
file:export PATH=$PATH:$HOME/.dcl/cosmovisor/current/bin
-
Execute the following command to apply the updated
$PATH
immediately:source $HOME/.profile
- In order to ensure that account is created and has assigned role you can use the command:
dcld query auth account --address=<address>
.
-
Get the list of all nodes:
dcld query validator all-nodes
. The node must present in the list and has the following params:power:10
andjailed:false
. -
Get the node status:
dcld status --node tcp://<node_ip>:26657
. The value ofnode ip
matches to[rpc] laddr
field in$HOME/.dcl/config/config.toml
(TCP or UNIX socket address for the RPC server to listen on).
Make sure thatresult.sync_info.latest_block_height
is increasing over the time (once in about 10 mins). -
Get the list of nodes participating in the consensus for the last block:
dcld query tendermint-validator-set
.- You can pass the additional value to get the result for a specific height:
dcld query tendermint-validator-set 100
. - As for the genesis state we have just 1 node, the command should return only our node at this phase.
- You can pass the additional value to get the result for a specific height: