Join the Network: How to run a Validator on Mars

March 1, 2023

For a general guide on running a Cosmos Validator node, visit @larry0x’s workshop found here

At the heart of Mars Protocol are Martian nodes, the base communication layer for Martians and the primary gateway into the Mars ecosystem. By connecting to a node, Martians can: 

  • Generate keys
  • Query blockchain state
  • Send transactions 
  • Deploy contracts 
  • And more 🔴

Martians can spin up their own nodes, allowing for optimal transaction speed and flexibility, or they can connect to a remote node to handle their requests. With every Martian node that spins up, a new access point into the Mars ecosystem is generated, creating a more resilient and distributed network of communication for Martians. 

Out of all Martian nodes, 75 special nodes, called Validators, are selected to secure the network. This is done using a Delegated Proof-of-Stake (DPoS) mechanism whereby MARS stakers elect Validators through their delegations. The top 75 Validators with the most delegated, or “staked” MARS, become part of the active set. Validators in the active set participate in consensus through verifying new blocks and committing them to the chain. To secure against faulty or malicious Validators, Mars utilizes the Tendermint consensus protocol. This means the network can tolerate up to ⅓ of Validators failing to produce blocks (including explicitly malicious behavior) and still produce consensus over the chain’s state across a decentralized network.

Running a Validator

Server Requirements

A production-ready server typically requires: 

  • 8-core x86 CPU
  • 64 GB RAM - Cosmos apps typically use less than 32 GB under normal conditions, but during events such as chain upgrades, up to 64 GB is usually needed.
  • 4 TB NVME SSD. Hard drive I/O speed is crucial! Validators who run on HDD or SATA SSD often find themselves missing blocks. The requirement for disk space can depend on your pruning settings, but generally, at least 2 TB is recommended.
  • Linux or macOS operating system
  • Go v1.19+

Note that requirements may be significantly lower for Mars during the chains early stages. As the blockchain matures, a higher performing server will be needed.


This section is for: 

  • Martians who want to connect to a remote node 
  • Martians who want to run a node
  • Martians who want to run a Validator 

Marsd (short for “mars daemon”) is the command line interface that connects with Mars and allows you to interact with the Mars blockchain. Every node operator and active validator uses Marsd to interact with their node. 

Configure Environment Variables 

After installing Go, it is recommended to configure related environment variables:

# ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=$HOME/.go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin

The provided code block is a set of environment variable assignments in a bash configuration file (~/.bashrc). These environment variables are commonly used in Go programming and their purpose is to specify the location of Go installation, workspace, and executable files:

  • export GOROOT=/usr/local/go assigns the location of the Go installation directory to the GOROOT environment variable. The export keyword ensures that this variable is accessible to child processes. If using a package manager such as homebrew, this location may vary.
  • export GOPATH=$HOME/.go assigns the location of the Go workspace directory to the GOPATH environment variable. The workspace is where Go source code and its dependencies are stored. By default, the workspace is located in $HOME/go but can be customized using this environment variable. 
  • export GOBIN=$GOPATH/bin assigns the location of the Go executable files to the GOBIN environment variable. This variable specifies the directory where Go binary files will be installed when using go install command. 
  • Finally, export PATH=$PATH:$GOPATH/bin:$GOROOT/bin adds the directories specified in GOPATH/bin and GOROOT/bin to the system's PATH variable. This makes it possible to execute Go binaries from any directory in the terminal by simply typing their name.

Overall, this is a convenient way to set up the Go development environment by specifying the important directories and their locations as environment variables.

Installing Marsd

To install Marsd, clone the Mars Hub repository, checkout the latest tag (e.g. v1.0.0), and compile the code:

git clone 
cd hub
git checkout [tag]
make install

A marsd executable will be created in the $GOBIN directory. 

Generate Operator Key

Each node comes with three private keys: an operator key, a consensus key, and a node key. At this point, you only need an operator key to transact using Marsd (which can be achieved by connecting to a remote node). Later sections will cover consensus and node keys as well. 

To generate your operator key, run the following command: 

marsd keys add [key-name]

Make sure you save the mnemonics! After you end your terminal session, your keys cannot be recovered. 

To use an existing seed phrase, run the following command: 

marsd keys add [key-name] --recover 

Connecting to a Remote Node

Martians who prefer to not operate a node or Validator can connect to a remote node with Marsd by appending the --node flag at the end of requests along with an RPC endpoint in the https://<host>:<port> format. Alternatively, Martians can configure a default node using the following command:

marsd config node https://[host]:[port]

If you are connecting to a remote node, select a node operator that you can trust. Malicious operators can alter query results and censor transactions. Mars contributors currently maintain the following RPC endpoints for public use: 

A list of public RPC endpoints can also be found in the Cosmos chain registry.

At this point, you can begin interacting with the Mars blockchain through a remote node. To learn about the list of available commands, run marsd --help in your terminal. For more information about a specific command, append the --help flag at the end of your request, for example:

marsd query --help 
marsd query bank --help


It is worth noting that Mars Protocol hosts various smart contracts on separate blockchain networks as part of its “Hub and Spoke” model. Mars Hub is mostly responsible for governance activities, the management of protocol revenue, and the distribution of the Mars token ($MARS). On the other hand, the Red Bank, and soon Rover, are deployed as “Outposts” on separate networks such as Osmosis. Martians who want to query or send transactions to Mars contracts deployed on Osmosis will have to send their requests to an Osmosis node. Like Marsd, Osmosisd allows you to connect to the Osmosis network without the need to run a node yourself. To learn more about Osmosisd, look here.

Running a Node

This section is for: 

  • Martians who want to run a node
  • Martians who want to run a Validator 

Initialize your Node

After installing Marsd, you can initialize a your node by running the following command: 

marsd init yourmoniker --chain-id [chain-id]

Replace yourmoniker with any string you’d like. This is the name to identify your server. For prospective Validators, this is NOT your validator's moniker, which we will create later. 

Running this command also creates your consensus and node keys, as well as a .mars folder under your home directory with some config files for your node: 

├─┬ config
│ ├── app.toml
│ ├── client.toml
│ ├── config.toml
│ ├── genesis.json
│ ├── node_key.json
│ ├── priv_validator_key.json
└─┬ data
  └── priv_validator_state.json

Let's walk over each file created:

  • app.toml - Used to specify application-level settings, such as gas price, API endpoints to serve, and so on
  • client.toml - The config for the app’s command line interface. This is where you can set defaul parameters, such as a default --chain-id. 
  • config.toml - Used to specify settings for the underlying Tendermint consensus engine, which handles networking, P2P connections, and consensus. 
  • genesis.json - Contains the initial set of transactions that defines the state of the blockchain at its inception.
  • node_key.json - Contains a private key that is used for node authentication in the peer-to-peer (p2p) protocol. priv_validator_key.json - Contains the private key for Validators, which is used to sign blocks and votes.  You should back up this file and don't show anyone else its content.
  • priv_validator_state.json - used to store the current state of the private validator. This includes information such as the current round and height of the validator, as well as the latest signed vote and block. This file is typically managed by the Tendermint consensus engine and used to prevent your node from double-signing. 

Sync Genesis State

Before we run our node, we need to replace our genesis.json file in our .mars folder with the genesis file for our specific network. For mainnet (mars-1), this can be done with the following command:

wget -O ~/.mars/config/genesis.json

For more information about the genesis file for testnet, visit the Networks repo

Set Seed Nodes

In order to join the network, a node first needs to know a few peers to connect to. A seed node is a type of node that connects to a large number of peers and informs new nodes of available peers in the network. A list of available seed nodes can be found in the Cosmos chain registry. For mainnet (mars-1), configuring seed nodes can be done with the following command: 

export SEEDS=`,`
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" ~/.mars/config/config.toml

For testnet (ares-1), configuring seed nodes can be done with the following command: 

export SEEDS=`2ee39b7648d17f90fab0f9800faa9374e7573fc6@,`
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" ~/.mars/config/config.toml

You can also configure seed nodes directly under the config.toml file in the .mars folder. 

Run the Node

You can now launch the network with marsd start! 

However, running the network this way requires a shell to always be open. You can, instead, create a service file that will manage running the network for you. To learn more about this topic, visit the docs. 

Once you’ve started your node, you will need to wait for the node to sync up to the latest block. To check the node's sync status, you can run the following command: 

marsd status 2>&1 | jq

jq formats the output into a more readable format. 2>&1 is necessary due to a bug where Cosmos SDK mistakenly outputs the status to stderr instead of stdout. Your node is synced up if SyncInfo.catching_up is false.

To learn more about managing your Martian node, visit the docs. 


Syncing up-to-date to an existing network may take time. Luckily, some validators like Polkachu are kind enough to share their snapshots with us. A snapshot is basically compressed pack of the .mars/data folder. To use the snapshot, go to and follow the instructions.

NOTE: You can use the pruned snapshot to bootstrap your node, even if you plan to use other pruning settings (e.g. "default" or "nothing").

State-sync is another approach for quickly bootstrapping a new node, but does not take care of the wasm folder on Mars Protocol, so you need to preserve your own current wasm folder. It is best to just use the Mars Protocol snapshot service since it is more reliable.

Registering your Validator Node

Once your node is synced up, register your node as a Validator:

marsd tx staking create-validator \
--pubkey $(marsd tendermint show-validator) \
--moniker "the moniker for your validator" \
--details "a description of your validator" \
--identity "your PGP key (block explorers will use your keybase pfp)" \
--website "" \
--security-contact "" \
--min-self-delegation 1 \
--commission-rate "0.05" \
--commission-max-rate "0.20" \
--commission-max-change-rate "0.01" \
--amount 1000000umars \
--from [operator-key-name] \
--chain-id mars-1 \
--gas auto \
--gas-adjustment 1.4 \
--gas-prices 0umars

Let’s go through each flag:

  • pubkey: The public key of the validator being created, which is obtained by running the command marsd tendermint show-validator and then passing the output to this parameter.
  • moniker: The name or alias of the validator.
  • details: A description of the validator.
  • identity: The Keybase PGP key associated with the validator's account. This key will be used by block explorers to identify the validator. The only exception is MintScan, for which you need to add your pfp to this repo via a pull request (PR).
  • website: The website associated with the validator.
  • security-contact: The email address of the person responsible for the validator's security.
  • min-self-delegation: The minimum amount of the validator's own tokens that the validator must hold in order to remain active. If you withdraw your self-delegation below this threshold, your validator will be immediately removed from the active set. Your validator will not be slashed, but will stop earning staking rewards. This is considered the proper way for a validator to voluntarily cease operation. NOTE: If you intend to shut down your Validator, make sure to communicate with your delegators at least 14 days before withdrawing your self-delegation so that they have sufficient time to redelegate and not miss out on staking rewards.
  • commission-rate: The percentage of rewards that the validator charges for its services.
  • commission-max-rate: The maximum percentage that the validator can charge for its services. This number can not be changed and is meant to increase trust between you and your delegators. If you wish to go above this limit, you will have to create a new validator. 
  • commission-max-change-rate: The maximum percentage that the validator can increase or decrease its commission rate by.
  • amount: The amount of umars (the cryptocurrency used on the Mars network) that the validator will stake as part of its candidacy.
  • from: The name of the account that will submit the transaction to create the validator.
  • chain-id: The ID of the Mars blockchain network.
  • gas: The maximum amount of gas (computational resources) that the transaction can consume.
  • gas-adjustment: A factor that adjusts the gas limit based on the estimated gas usage of the transaction.
  • gas-prices: The price of gas in umars per unit of gas consumed.

Once the tx is confirmed, run the following query:

marsd query staking validator $(marsd keys show validator --bech val --address) --output json | jq

Your status should be "bonded"; if not, the most likely reason is you do not have enough delegation to enter the active set. If you're bonded, restart your node by running sudo restart marsd. You should see a log message that looks like:

INF This node is a validator addr=[...] module=consensus pubKey=[...]

This means your validator is now successfully registered and active! To learn more about managing your Validator and additional tips & tricks, visit the docs. 

Join the Network 

Ready to join the network and want to learn more? 


Follow Mars on Twitter and subscribe to Mars’ email newsletter for the latest updates from Mission Control.


‍Remember, Cosmos, Osmosis and Mars are experimental technologies. This article does not constitute investment advice and is subject to and limited by the Mars disclaimers, which you should review before interacting with the protocol.

Previous post
No more posts
Next post
No more posts