Running a Node

In this section, the application we are running is called mantrachaind. We will walk through how to set up and configure the app - along with integrating the application as a system service.

Download latest release

Latest chain release binaries can be found here.

You can download mantrachaind and place it in a standard binary folder, such as /usr/local/bin/ or similar. Remember to make it executable by completing sudo chmod +x.

Binary Check

Each mantrachaind binary is deployed with a corresponding .sha256 file that you can download, to verify the integrity of the build. Download the sha256sum.txt and verify the hash.

Build From Source

If you would like to build from source instead of using the release binary, you can compile and install the binary.

go will be needed for this install

make install

Initialise the Chain

Before actually running the node, we need to initialise the chain, and most importantly its genesis file. This is done with the init subcommand:

Public Testnet/Mainnet Chains

We will have regularly updating public testnet chains along with our mainnet chain: mantra-1. Available networks to integrate with along with their requisite genesis files can be found here.

# The argument <moniker> is the custom username of your node, it should be human-readable.
./mantrachaind init <moniker> --chain-id my-personal-secret-local-test-chain

The command above creates all the configuration files needed for your node to run, as well as a default genesis file, which defines the initial state of the network. Reminder to overwrite the default genesis if you're planning to exist to an existing chain!!

TIP

All these configuration files are in ~/.mantrachain by default, but you can overwrite the location of this folder by passing the --home flag to each commands, or set an $APPD_HOME environment variable (where APPD is the name of the binary).

The ~/.mantrachain folder has the following structure:

  • config.toml: used to configure the CometBFT, learn more on CometBFT's documentation,

  • app.toml: generated by the Cosmos SDK, and used to configure your app, such as state pruning strategies, telemetry, gRPC and REST servers configuration, state sync...

Both files are heavily commented, please refer to them directly to tweak your node.

.                                   # ~/.mantrachain
  |- data                           # Contains the databases used by the node.
  |- config/
      |- app.toml                   # Application-related configuration file.
      |- config.toml                # CometBFT-related configuration file.
      |- genesis.json               # The genesis file.
      |- node_key.json              # Private key to use for node authentication in the p2p protocol.
      |- priv_validator_key.json    # Private key to use as a validator in the consensus protocol.

Update Default Settings

In order to connect to existing public chains - ensure that the downloaded genesis.json file is copied into the ~/.mantrachain/config folder after initialisation. In addition, the following configuration settings are required in order to bring a FULL NODE online.

CONFIG_TOML="$HOME/.mantrachain/config/config.toml"
APP_TOML="$HOME/.mantrachain/config/app.toml"
PERSISTENT_PEERS=""
SEEDS=""

# configure minimum gas prices
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.01uom\"/g" $APP_TOML

# enable the api server
sed -i '/\[api\]/,+3 s/enable = false/enable = true/' $APP_TOML

# configure optimised peering configuration
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PERSISTENT_PEERS\"/" $CONFIG_TOML
sed -i.bak -e "s/^seeds =.*/seeds = \"$SEEDS\"/" $CONFIG_TOML
external_address=$(wget -qO- eth0.me)
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $CONFIG_TOML
sed -i.bak -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $CONFIG_TOML

# expose monitoring metrics via prometheus
sed -i.bak -e "s/^prometheus *=.*/prometheus = true/" $CONFIG_TOML

Client Interaction

When instantiating a node, GRPC and REST are defaulted to localhost to avoid unknown exposure of your node to the public. It is recommended to not expose these endpoints without a proxy that can handle load balancing or authentication is setup between your node and the public.

Last updated