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:


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

Install the Go programming language:


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

Configure related environment variables:


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

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:


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

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.


_1
make install

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:


_1
marsd start

status

Displays the status of a remote node:


_1
marsd status

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:


_1
marsd query tx <hash>

Syntax to query by account sequence:


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

Syntax to query by signature:


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

txs

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


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

Example:


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