Skip to main content


This guide will explain how to install the marsd binary (Mars CLI) onto your system as a command-line interface tool for interacting with nodes on Mars Hub.

While marsd is a requirement to run a full node, you don't have to run a full local node yourself to interact with the network. You can specify a remote node with the —node flag.

With marsd connected to a remote node you can:

  • Generates keys
  • Send transactions
  • Deploy and interact with contracts
  • and more


To install Marsd, you will need the following:


Login to your user account (you don't want to use root) and install some essential packages:

sudo apt update
sudo apt upgrade
sudo apt install build-essential git vim jq libleveldb-dev
sudo apt autoremove

Install the Go programming language:

curl -LO
tar xfz ./go1.18.3.linux-amd64.tar.gz
sudo mv go /usr/local
go version

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. If you are connecting to a remote node, you only need an operator key to transact. 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

Connect to a Remote Node

At this point, you can begin interacting with the Mars blockchain by connecting to a remote note.

Martians who prefer to not operate a node 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:

Mainnet (mars-1): Testnet (ares-1):

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

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


This section describes essential commands for validators from marsd, the command line interface that connects a running marsd process.


Manages Keyring commands. For a list of syntax and subcommands, see the keys subcommands.


Manages queries. For a list of syntax and subcommands, see the query subcommands.


Runs the full node application with Tendermint in or out of process. By default, the application runs with Tendermint in process:

marsd start


Displays the status of a remote node:

marsd status


Retrieves a transaction by its hash, account sequence, or signature. For a list of full syntax and subcommands, see the tx subcommands.

Syntax to query by hash:

marsd query tx <hash>

Syntax to query by account sequence:

marsd query tx --type=acc_seq <address>:<sequence>

Syntax to query by signature:

marsd query tx --type=signature <sig1_base64,sig2_base64...>


Retrieves transactions that match the specified events where results are paginated:

marsd query txs --events '<event>' --page <page-number> --limit <number-of-results>


marsd query txs --events 'message.sender=cosmos1...&message.action=withdraw_delegator_reward' --page 1 --limit 30