Skip to main content
Version: Mainnet ๐Ÿš€

Full node setup

Following you will find the instructions on how to manually setup your Desmos full node.

Requirements

Before starting, make sure you read the overview to make sure your hardware meets the needed requirements.

1. Build the software#

Choose your DB backend

Before installing the software, a consideration must be done.

By default, Desmos uses LevelDB as its database backend engine. However, since version v0.6.0 we've also added the possibility of optionally using Facebook's RocksDB, which, although still being experimental, is known to be faster and could lead to lower syncing times. If you want to try out RocksDB you can take a look at our RocksDB installation guide before proceeding further.

In your terminal, run the following:

# Make sure we are inside the home directorycd $HOME
# Clone the Desmos softwaregit clone https://github.com/desmos-labs/desmos.git && cd desmos
# Checkout the correct tag# Please check on https://github.com/desmos-labs/mainnet to get# the tag to use based on the current mainnet versiongit checkout tags/v1.0.1
# Build the software# If you want to use the default database backend runmake install
# If you want to use RocksDB run insteadmake install DB_BACKEND=rocksdb

If the software is built successfully, the desmos executable will be located inside your $GOBIN path. If you setup your environment variables correctly in the previous step, you should also be able to run it properly. To check this, try running:

desmos version --long

2. Initialize the Desmos working directory#

Configuration files and chain data will be stored inside the $HOME/.desmos directory by default. In order to create this folder and all the necessary data we need to initialize a new full node using the desmos init command.

Starting from v0.15.0, you are now able to provide a custom seed when initializing your node. This will be particularly useful because, in the case that you want to reset your node, you will be able to re-generate the same private node key instead of having to create a new node.

In order to provide a custom seed to your private key, you can do as follows:

  1. Get a new random seed by running

    desmos keys add node --dry-run
    # Example# desmos keys add node --dry-run# - name: node#   type: local#   address: desmos126cw9j2wy099lttf2qx0qds6k7t4kdea5ualh9#   pubkey: desmospub1addwnpepqdpfv4lh0vqjvmu43spz4lq0l92qret9hv6007j4r28z05wuthw2jz3frd4#   mnemonic: ""#   threshold: 0#   pubkeys: []### **Important** write this mnemonic phrase in a safe place.# It is the only way to recover your account if you ever forget your password.## sort curious village display voyage oppose dice idea mutual inquiry keep swim team direct tired pink clinic figure tiny december giant obvious clump chest

    This will create a new key without adding it to your keystore, and output the underlying seed.

  2. Run the init command using the --recover flag.

    desmos init <your_node_moniker> --recover

    You can choose any moniker value you like. It will be saved in the config.toml under the .desmos working directory.

  3. Insert the previously outputted secret recovery phrase (mnemonic phrase):

    > Enter your bip39 mnemonicsort curious village display voyage oppose dice idea mutual inquiry keep swim team direct tired pink clinic figure tiny december giant obvious clump chest

    This will generate the working files in ~/.desmos

    Tip

    By default, running desmos init <your_node_moniker> without the --recover flag will randomly generate a priv_validator_key.json. There is no way to regenerate this key if you lose it.\ We recommend running this command with the --recover so that you can regenerate the same priv_validator_key.json from the secret recovery phrase (mnemonic phrase).

3. Get the genesis file#

To connect to an existing network, or start a new one, a genesis file is required. The file contains all the settings telling how the genesis block of the network should look like. To connect to the desmos-mainnet, you will need the corresponding genesis file. Visit the mainnet repo and download the correct genesis file by running the following command.

# Download the existing genesis file for the testnet# Replace <chain-id> with the id of the testnet you would like to joincurl https://raw.githubusercontent.com/desmos-labs/mainnet/main/genesis.json > ~/.desmos/config/genesis.json

After the download, ensure it's the correct one by checking that it has the same hashsum below:

jq -S -c -M '' /root/.desmos/config/genesis.json | shasum -a 256619c9462ccd9045522300c5ce9e7f4662cac096eed02ef0535cca2a6826074c4  -

4. Setup seeds, peers and state sync#

The next thing you have to do now is telling your node how to connect with other nodes that are already present on the network. In order to do so, we will use the seeds and persistent_peers values of the ~/.desmos/config/config.toml file.

Seed nodes are a particular type of nodes present on the network. Your fullnode will connect to them, and they will provide it with a list of other fullnodes that are present on the network. Then, your fullnode will automatically connect to such nodes. Our team is running three seed nodes, and we advise you to use them by setting the following seeds value:

seeds = "[email protected]etwork:26656,[email protected]etwork:26656,[email protected]etwork:26656"

Using state sync#

Starting from Desmos v0.15.0, we've added the support for Tendermint' s state sync. This feature allows new nodes to sync with the chain extremely fast, by downloading snapshots created by other full nodes.

In order to use this feature, you will have to edit a couple of things inside your ~/.desmos/config/config.toml file, under the statesync section:

  1. Enable state sync by setting enable = true

  2. Set the RPC addresses from where to get the snapshots using the rpc_servers field and filling it with two RPCs that provides snapshots.
    (You can ask inside our discord for them).

  3. Get a trusted chain height, and the associated block hash. To do this, you will have to:

  4. Get the current chain height by running:

    curl -s <rpc-address>/commit  | jq "{height: .result.signed_header.header.height}"
  5. Once you have the current chain height, get a height that is a little bit lower (200 blocks) than the current one. To do this you can execute:

    curl -s <rpc-address>/commit?height=<your-height> | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
    # Example# curl -s https://rpc-desmos.itastakers.com/commit?height=100000 | jq "{height: .result.signed_header.header.height, hash: .result.signed_header.commit.block_id.hash}"
  6. Now that you have a trusted height and block hash, use those values as the trust_height and trust_hash values.

Here is an example of what the statesync section of your ~/.desmos/config/config.toml file should look like in the end (the trust_height and trust_hash should contain your values instead):

enable = true
rpc_servers = "rpc-desmos.itastakers.com:26657,135.181.60.250:26557"trust_height = 139142trust_hash = "F55CA4C56CAC348E453A38D6BEBD70B1CD92F7431214AE167B09EFDA478186BE"trust_period = "336h0m0s"

5. (Optional) Edit snapshot config#

Currently, the snapshot feature is enabled by the default. This means that your node will periodically create snapshots of the chain state and make them public, allowing other nodes to quickly join the network by syncing the application state at a given height.

By default, we have set Desmos to take snapshots every 500 blocks, and persist the last 2 snapshots, deleting older ones. If you want to provide other nodes with more (or less) frequent snapshots, you can do this by editing a couple of things inside your ~/.desmos/config/app.toml file, under the state-sync section:

# snapshot-interval specifies the block interval at which local state sync snapshots are# taken (0 to disable). Must be a multiple of pruning-keep-every.snapshot-interval = 500
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).snapshot-keep-recent = 2

Note: Make sure that snapshot-interval is a multiple of pruning-keep-every in the base section

pruning-keep-recent = "100"pruning-keep-every = "500"pruning-interval = "10"

You can find out more about pruning here.

6. (Optional) Change your database backend#

If you would like to run your node using Facebook's RocksDB as the database backend, and you have correctly built the Desmos binaries to work with it following the instructions at point 1, there is one more thing you need to do.

In order to tell Tendermint to use RocksDB as its database backend engine, you are required to change the following like inside the config.toml file:

db_backend = "goleveldb"

To become

db_backend = "rocksdb"

7. Open the proper ports#

Now that everything is in place to start the node, the last thing to do is to open up the proper ports.

Your node uses vary different ports to interact with the rest of the chain. Particularly, it relies on:

  • port 26656 to listen for incoming connections from other nodes;
  • port 26657 to expose the RPC service to clients.

A part from those, it also uses:

  • port 9090 to expose the gRPC service that allows clients to query the chain state;
  • port 1317 to expose the REST APIs service.

While opening any ports are optional, it is beneficial to the whole network if you open port 26656. This would allow new nodes to connect to you as a peer, making them sync faster and the connections more reliable.

For this reason, we will be opening port 26656 using ufw. \ By default, ufw is not enabled. In order to enable it please run the following:

# running this should show it is inactivesudo ufw status
# Turn on ssh if you need itsudo ufw allow ssh
# Accept connections to port 26656 from any addresssudo ufw allow from any to any port 26656 proto tcp
# enable ufwsudo ufw enable
# check ufw is runningsudo ufw status

If you also want to run a gRPC server, RPC node or the REST APIs, you also need to remember to open the related ports as well.

8. Start the Desmos node#

After setting up the binary and opening up ports, you are now finally ready to start your node:

# Run Desmos full nodedesmos start

The full node will connect to the peers and start syncing. You can check the status of the node by executing:

# Check status of the nodedesmos status

You should see an output like the following one:

{  "NodeInfo": {    "protocol_version": {      "p2p": "8",      "block": "11",      "app": "0"    },    "id": "84cc13d6acf22c32c209f4205d2693f70f458dde",    "listen_addr": "tcp://0.0.0.0:26656",    "network": "desmos-mainnet",    "version": "",    "channels": "40202122233038606100",    "moniker": "fullnode",    "other": {      "tx_index": "on",      "rpc_address": "tcp://0.0.0.0:26657"    }  },  "SyncInfo": {    "latest_block_hash": "9BA7801C0935C4E18B4E2F8C6E8A2FF4C598C8E5F71A94113D2F0595524FD4E3",    "latest_app_hash": "375C9F0E4E63B7ACAD497F8DEDF5E2382F469668DE671B2FF92A5D2B8B50C6D2",    "latest_block_height": "204393",    "latest_block_time": "2021-02-03T08:03:06.448549383Z",    "earliest_block_hash": "839FEB9ED0257B71116CE54618C7E3C15189239CB571066DDBE9E0F1C101DCC8",    "earliest_app_hash": "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855",    "earliest_block_height": "1",    "earliest_block_time": "2021-01-20T07:00:00Z",    "catching_up": false  },  "ValidatorInfo": {    "Address": "E457913A98EC0F9251BB40008E6680A8EFF93F99",    "PubKey": {      "type": "tendermint/PubKeyEd25519",      "value": "BLT8jjQ+ODKa0ERcrhHfOVFVVrJDq7hxyXx6bLXnCdw="    },    "VotingPower": "0"  }}

If you see that the catching_up value is false under the sync_info, it means that you are fully synced. If it is true, it means your node is still syncing. You can get the catching_up value by simply running:

desmos status 2>&1 | jq "{catching_up: .SyncInfo.catching_up}"
# Example# $ desmos status 2>&1 | jq "{catching_up: .SyncInfo.catching_up}"# {#   "catching_up": false# }

After your node is fully synced, you can consider running your full node as a validator node.

9. (Optional) Configure the background service#

To allow your desmos instance to run in the background as a service you need to execute the following command

tee /etc/systemd/system/desmosd.service > /dev/null <<EOF[Unit]Description=Desmos Full NodeAfter=network-online.target
[Service]User=$USERExecStart=$GOBIN/desmos startRestart=alwaysRestartSec=3LimitNOFILE=4096
[Install]WantedBy=multi-user.targetEOF

Once you have successfully created the service, you need to enable it. You can do so by running

systemctl enable desmosd

After this, you can run it by executing

systemctl start desmosd

Service operations#

Check the service status#

If you want to see if the service is running properly, you can execute

systemctl status desmosd

If everything is running smoothly you should see something like

$ systemctl status desmosdโ— desmos.service - Desmos Node   Loaded: loaded (/etc/systemd/system/desmosd.service; enabled; vendor preset:   Active: active (running) since Fri 2020-01-17 10:23:12 CET; 2min 3s ago Main PID: 11318 (desmos)    Tasks: 10 (limit: 4419)   CGroup: /system.slice/desmosd.service           โ””โ”€11318 /root/go/bin/desmos start

Check the node status#

If you want to see the current status of the node, you can do so by running

journalctl -u desmosd -f

Stopping the service#

If you wish to stop the service from running, you can do so by running

systemctl stop desmosd

To check the successful stop, execute systemctl status desmos. This should return

$ systemctl status desmosdโ— desmos.service - Desmos Node   Loaded: loaded (/etc/systemd/system/desmosd.service; enabled; vendor preset: enabled)   Active: failed (Result: exit-code) since Fri 2020-01-17 10:28:04 CET; 3s ago  Process: 11318 ExecStart=/root/go/bin/desmos start (code=exited, status=143) Main PID: 11318 (code=exited, status=143)

10. Cosmovisor#

In order to do automatic on-chain upgrades we will be using cosmovisor. Please check out Using Cosmovisor for information on how to set this up.