Skip to main content
Version: Next

Running in Production


This section describes how to securely run a node in a public setting and/or on a mainnet on one of the many Cosmos SDK public blockchains.

When operating a node, full node or validator, in production it is important to set your server up securely.


There are many different ways to secure a server and your node, the described steps here is one way. To see another way of setting up a server see the run in production tutorial


This walkthrough assumes the underlying operating system is Ubuntu.

Sever Setup


When creating a server most times it is created as user root. This user has heightened privileges on the server. When operating a node, it is recommended to not run your node as the root user.

  1. Create a new user
sudo adduser change_me
  1. We want to allow this user to perform sudo tasks
sudo usermod -aG sudo change_me

Now when logging into the server, the non root user can be used.


Nodes should not have all ports open to the public, this is a simple way to get DDOS'd. Secondly it is recommended by Tendermint to never expose ports that are not required to operate a node.

When setting up a firewall there are a few ports that can be open when operating a Cosmos SDK node. There is the Tendermint json-RPC, prometheus, p2p, remote signer and Cosmos SDK GRPC and REST. If the node is being operated as a node that does not offer endpoints to be used for submission or querying then a max of three endpoints are needed.

Most, if not all servers come equipped with ufw. Ufw will be used in this tutorial.

  1. Reset UFW to disallow all incoming connections and allow outgoing
sudo ufw default deny incoming
sudo ufw default allow outgoing
  1. Lets make sure that port 22 (ssh) stays open.
sudo ufw allow ssh


sudo ufw allow 22

Both of the above commands are the same.

  1. Allow Port 26656 (tendermint p2p port). If the node has a modified p2p port then that port must be used here.
sudo ufw allow 26656/tcp
  1. Allow port 26660 (tendermint prometheus). This acts as the applications monitoring port as well.
sudo ufw allow 26660/tcp
  1. IF the node which is being setup would like to expose Tendermints jsonRPC and Cosmos SDK GRPC and REST then follow this step. (Optional)
Tendermint JsonRPC
sudo ufw allow 26657/tcp
sudo ufw allow 9090/tcp
sudo ufw allow 1317/tcp
  1. Lastly, enable ufw
sudo ufw enable


If the node that is being started is a validator there are multiple ways a validator could sign blocks.


File based signing is the simplest and default approach. This approach works by storing the consensus key, generated on initialization, to sign blocks. This approach is only as safe as your server setup as if the server is compromised so is your key. This key is located in the config/priv_val_key.json directory generated on initialization.

A second file exists that user must be aware of, the file is located in the data directory data/priv_val_state.json. This file protects your node from double signing. It keeps track of the consensus keys last sign height, round and latest signature. If the node crashes and needs to be recovered this file must be kept in order to ensure that the consensus key will not be used for signing a block that was previously signed.

Remote Signer

A remote signer is a secondary server that is separate from the running node that signs blocks with the consensus key. This means that the consensus key does not live on the node itself. This increases security because your full node which is connected to the remote signer can be swapped without missing blocks.

The two most used remote signers are tmkms from Iqlusion and horcrux from Strangelove.

  1. Update server dependencies and install extras needed.
sudo apt update -y && sudo apt install build-essential curl jq -y
  1. Install Rust:
curl --proto '=https' --tlsv1.2 -sSf | sh
  1. Install Libusb:
sudo apt install libusb-1.0-0-dev

There are two ways to install tmkms, from source or cargo install. In the examples we will cover downloading or building from source and using softsign. Softsign stands for software signing, but you could use a yubihsm as your signing key if you wish.

  1. Build:

From source:

cd $HOME
git clone
cd $HOME/tmkms
cargo install tmkms --features=softsign
tmkms init config
tmkms softsign keygen ./config/secrets/secret_connection_key


Cargo install:

cargo install tmkms --features=softsign
tmkms init config
tmkms softsign keygen ./config/secrets/secret_connection_key

To use tmkms with a yubikey install the binary with --features=yubihsm.

  1. Migrate the validator key from the full node to the new tmkms instance.
scp user@123.456.32.123:~/.simd/config/priv_validator_key.json ~/tmkms/config/secrets
  1. Import the validator key into tmkms.
tmkms softsign import $HOME/tmkms/config/secrets/priv_validator_key.json $HOME/tmkms/config/secrets/priv_validator_key

At this point, it is necessary to delete the priv_validator_key.json from the validator node and the tmkms node. Since the key has been imported into tmkms (above) it is no longer necessary on the nodes. The key can be safely stored offline.

  1. Modifiy the tmkms.toml.
vim $HOME/tmkms/config/tmkms.toml

This example shows a configuration that could be used for soft signing. The example has an IP of 123.456.12.345 with a port of 26659 a chain_id of test-chain-waSDSe. These are items that most be modified for the usecase of tmkms and the network.

# Tendermint KMS configuration file

## Chain Configuration

id = "osmosis-1"
key_format = { type = "bech32", account_key_prefix = "cosmospub", consensus_key_prefix = "cosmosvalconspub" }
state_file = "/root/tmkms/config/state/priv_validator_state.json"

## Signing Provider Configuration

### Software-based Signer Configuration

chain_ids = ["test-chain-waSDSe"]
key_type = "consensus"
path = "/root/tmkms/config/secrets/priv_validator_key"

## Validator Configuration

chain_id = "test-chain-waSDSe"
addr = "tcp://123.456.12.345:26659"
secret_key = "/root/tmkms/config/secrets/secret_connection_key"
protocol_version = "v0.34"
reconnect = true
  1. Set the address of the tmkms instance.
vim $HOME/.simd/config/config.toml

priv_validator_laddr = "tcp://"

The above address it set to but it is recommended to set the tmkms server to secure the startup


It is recommended to comment or delete the lines that specify the path of the validator key and validator:

# Path to the JSON file containing the private key to use as a validator in the consensus protocol
# priv_validator_key_file = "config/priv_validator_key.json"

# Path to the JSON file containing the last sign state of a validator
# priv_validator_state_file = "data/priv_validator_state.json"
  1. Start the two processes.
tmkms start -c $HOME/tmkms/config/tmkms.toml
simd start