Skip to main content
logo

Marsd

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

Setup

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
Copy

Install the Go programming language:

curl -LO https://golang.org/dl/go1.18.3.linux-amd64.tar.gz
tar xfz ./go1.18.3.linux-amd64.tar.gz
sudo mv go /usr/local
go version
Copy

Configure related environment variables:

# vim .bashrc

export GOROOT=/usr/local/go
export GOPATH=$HOME/.go
export GOBIN=$GOPATH/bin
export PATH=$PATH:$GOPATH/bin:$GOROOT/bin
Copy

Compile the Mars App Daemon

Clone the mars repo, checkout and install v0.0.0:

Download the Mars Hub source code and checkout the latest stable release, which in our case is v0.0.0:

git clone https://github.com/mars-protocol/hub
cd hub
git checkout v0.0.0
Copy

The command to compile the app is defined in Makefile. For most Cosmos apps it is make install, which will generate an executable in your $GOBIN folder.

make install
Copy

Commands

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

keys

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

query

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

start

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

marsd start
Copy

status

Displays the status of a remote node:

marsd status
Copy

tx

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>
Copy

Syntax to query by account sequence:

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

Syntax to query by signature:

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

txs

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

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

Example:

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