# update the local package list and install any available upgrades
sudo apt-get update && sudo apt upgrade -y
# install toolchain and ensure accurate time synchronization
sudo apt-get install make build-essential gcc git jq chrony -y
Install Go
Follow the instructions to install Go.
For an Ubuntu LTS, we can use:
# find location of existing GO (if any)
which go
go version
# remove old GO if existing
sudo rm -rf /usr/local/go
# install updated GO
wget https://golang.org/dl/go1.20.3.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz
rm -rf go1.20.3.linux-amd64.tar.gz
Unless you want to configure in a non standard way, then set these in the .zshrc file (or whatever you're using for a profile) in the user's home (i.e. ~/) folder.
#profile
nano ~/.profile
# zsh
nano ~/.zshrc
Add the "export Pathing" rules at the bottom, and then save the file:
This will generate the following files in ~/.mantleNode/config/
genesis.json
node_key.json
priv_validator_key.json
Download the genesis file
cd ~/.mantleNode/config
rm genesis.json
curl -fsSL https://raw.githubusercontent.com/AssetMantle/genesisTransactions/main/mantle-1/final_genesis.json >> genesis.json
This will replace the genesis file created using mantleNode init command with the mainnet genesis.json.
Set persistent peers
Using sed, we can set the persistent_peers easily:
sed -i'' 's/persistent_peers = ""/persistent_peers = "6e08b23315a9f0e1b23c7ed847934f7d6f848c8b@165.232.156.86:26656,ee27245d88c632a556cf72cc7f3587380c09b469@45.79.249.253:26656,538ebe0086f0f5e9ca922dae0462cc87e22f0a50@34.122.34.67:26656,d3209b9f88eec64f10555a11ecbf797bb0fa29f4@34.125.169.233:26656,bdc2c3d410ca7731411b7e46a252012323fbbf37@34.83.209.166:26656,585794737e6b318957088e645e17c0669f3b11fc@54.160.123.34:26656,5b4ed476e01c49b23851258d867cc0cfc0c10e58@206.189.4.227:26656"/' $HOME/.mantleNode/config/config.toml
Update Node configs
We can use sed to update various node configuration values without having to manually edit each file - which can be a pain.
Replace the values below with your own. These commands will update the following:
minimum_gas_prices
pruning configs
snapshot configs
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.025umntl\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^pruning *=.*|pruning = \"custom\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^pruning-keep-recent *=.*|pruning-keep-recent = \"113\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^pruning-keep-every *=.*|pruning-keep-every = \"0\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^pruning-interval *=.*|pruning-interval = \"17\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^snapshot-interval *=.*|snapshot-interval = \"0\"|" $HOME/.mantleNode/config/app.toml
sed -i -e "s|^snapshot-keep-recent *=.*|snapshot-keep-recent = \"2\"|" $HOME/.mantleNode/config/app.tom
Updating node ports
We'll use a powerful tool called sed for this process. sed is a stream editor that can perform operations, like substitutions, on a text file.
We will specifically focus on updating the ports to use a standardized prefix for your chain. This ensures consistency and improves overall system organization. It will also allow you to run multiple chains on a single server.
Let's start by understanding what we're updating:
proxy_app: This is the address used for inter-process communication between the ABCI application and the consensus engine.
laddr: This is the address that your node listens on for incoming connections.
pprof_laddr: This is the address for the profiling server to listen on.
prometheus_listen_addr: This is the address for the Prometheus metrics server to listen on.
address: These are various addresses that your node may use to listen for different types of connections.
Set Your Chain and Port Prefix
Your chain in this case is Asset Mantle. For Asset Mantle, we want to set the port prefix as 104. The port prefix will be used to replace the first 2 or 3 digits of the original ports.
# Set the prefix
export PREFIX=104
Update config.toml
Next, we will update the config.toml file. For 5-digit ports, the first 3 digits will be replaced. Here is how to calculate the new port values and update the config.toml file:
Either create a new key pair or restore an existing wallet for your validator:
# Create new keypair
mantleNode keys add <KEYNAME>
# Restore existing gaia wallet with mnemonic seed phrase.
# You will be prompted to enter mnemonic seed.
mantleNode keys add <KEYNAME> --recover
# Query the keystore for your public address
mantleNode keys show <KEYNAME> -a
After creating a new key, the key information and seed phrase will be shown. It is essential to write this seed phrase down and keep it in a safe place. The seed phrase is the only way to restore your keys.
Setup cosmovisor
Upgrade to a validator
Do not attempt to upgrade your node to a validator until the node is fully in sync as per the previous step.
To upgrade the node to a validator, you will need to submit a create-validator transaction:
The above transaction is just an example. There are many more flags that can be set to customise your validator, such as your validator website, or keybase.io id, etc. To see a full list:
mantleNode tx staking create-validator --help
Backup critical files
There are certain files that you need to backup to be able to restore your validator if, for some reason, it damaged or lost in some way. Please make a secure backup of the following files located in ~/.mantleNode/config/:
priv_validator_key.json
node_key.json
It is recommended that you encrypt the backup of these files.
Follow the instructions to setup cosmovisor and start the node.