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:
_4sudo apt update_4sudo apt upgrade_4sudo apt install build-essential git vim jq libleveldb-dev_4sudo apt autoremove
Install the Go programming language:
_4curl -LO https://golang.org/dl/go1.18.3.linux-amd64.tar.gz_4tar xfz ./go1.18.3.linux-amd64.tar.gz_4sudo mv go /usr/local_4go version
Configure related environment variables:
_6# vim .bashrc_6_6export GOROOT=/usr/local/go_6export GOPATH=$HOME/.go_6export GOBIN=$GOPATH/bin_6export 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:
_3git clone https://github.com/mars-protocol/hub_3cd hub_3git 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.
_1make 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:
_1marsd start
status
Displays the status of a remote node:
_1marsd 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:
_1marsd query tx <hash>
Syntax to query by account sequence:
_1marsd query tx --type=acc_seq <address>:<sequence>
Syntax to query by signature:
_1marsd query tx --type=signature <sig1_base64,sig2_base64...>
txs
Retrieves transactions that match the specified events where results are paginated:
_1marsd query txs --events '<event>' --page <page-number> --limit <number-of-results>
Example:
_1marsd query txs --events 'message.sender=cosmos1...&message.action=withdraw_delegator_reward' --page 1 --limit 30