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.
./dcld config chain-id <chain-id>
- Use
testnet-2.0
for<chain-id>
if you want to connect to the persistent Test Net - Use
main-net
for<chain-id>
if you want to connect to the persistent Main Net
- Use
./dcld config output json
- Output format (text/json).
./dcld init "<node-name>" --chain-id "<chain-id>"
- Use
testnet-2.0
for<chain-id>
if you want to connect to the persistent Test Net - Use
main-net
for<chain-id>
if you want to connect to the persistent Main Net
5. Enable state sync
in the configuration or use one of the options in running-node-in-existing-network.md if you are joining long-running network
[$HOME/.dcl/config/config.toml
]
[statesync]
enable = true
rpc_servers = "http(s)://<host>:<port>,http(s)://<host>:<port>"
trust_height = <trust-height>
trust_hash = "<trust-hash>"
trust_period = "168h0m0s"
Example for Testnet 2.0 (clickable)
[statesync]
enable = true
rpc_servers = "https://on.test-net.dcl.csa-iot.org:26657,https://on.test-net.dcl.csa-iot.org:26657"
Example for Mainnet (clickable)
[statesync]
enable = true
rpc_servers = "https://on.dcl.csa-iot.org:26657,https://on.dcl.csa-iot.org:26657"
NOTE: You should provide at least 2 addresses for
rpc_servers
. It can be 2 identical addresses
You can use the following command to obtain <trust-height>
and <trust-hash>
of your network
curl -s http(s)://<host>:<port>/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
Example for Testnet 2.0 (clickable)
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}"
Example for Mainnet (clickable)
curl -s https://on.dcl.csa-iot.org:26657/commit | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
<host>
- RPC endpoint host of the network being joined<port>
- RPC endpoint port of the network being joined
NOTE: State sync is not attempted if the node has any local state (LastBlockHeight > 0)
[state-sync]
snapshot-interval = "snapshot-interval"
snapshot-keep-recent = "snapshot-keep-recent"
- Put
genesis.json
into dcld's config directory (usually$HOME/.dcl/config/
).- Use
deployment/persistent_chains/testnet-2.0/genesis.json
if you want to connect to the persistent Testnet 2.0 - Use
deployment/persistent_chains/main-net/genesis.json
if you want to connect to the persistent Mainnet
- Use
- Create an empty
persistent_peers.txt
in the current path because this file is required byrun_dcl_node
scripttouch persistent_peers.txt
Run node:
./run_dcl_node -t "<node-type>" -c "<chain-id>" "<node-name>"
<node-type>
- one of the following types depending on which type of node is being run:- genesis
- validator
- observer
- private-sentry
- public-sentry
- seed
Notes:
- the script assumes that:
- current user is going to be used for
cosmovisor
service to run as- current user is in sudoers list
-
Open
$HOME/.dcl/config/config.toml
file in your favorite text editor:- 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
- Change other settings (see specific instructions for every Node type)
- Make your node public:
-
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/
-
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
- Get the node status:
dcld status --node tcp://localhost:26657
. - Make sure that
result.sync_info.latest_block_height
is increasing over the time (once in about 10 mins). When you see thecatching_up
astrue
that signifies that the node is still downloading all the transactions. Once it has fully synced this will value will turn tofalse