# 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
# 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 in the user's home (i.e. ~/) folder.
nano ~/.zshrc
Add the "export Pathing" rules at the bottom, and then save the file:
To confirm that the installation has succeeded, you can run:
secretd version --long
Configuration of Shell Variables
For this guide, we will be using shell variables. This will enable the use of the client commands verbatim. It is important to remember that shell commands are only valid for the current shell session, and if the shell session is closed, the shell variables will need to be re-defined.
If you want variables to persist for multiple sessions, then set them explicitly in your shell .profile, as you did for the Go environment variables.
To clear a variable binding, use unset $VARIABLE_NAME. Shell variables should be named with ALL CAPS.
CHAIN_ID="secret-4"
MONIKER_NAME=<moniker-name>
Setting Up the Node
These instructions will direct you on how to initialize your node, synchronize to the network and upgrade your node to a validator.
Initialize the chain
Please replace YOUR_MONIKER with your own moniker.
secretd init YOUR_MONIKER --chain-id CHAIN_ID
This will generate the following files in ~/.osmosis/config/
We can add these persistent_peers to our config.toml:
sed -i "s/persistent_peers =.*/persistent_peers = \"d9bfa29e0cf9c4ce0cc9c26d98e5d97228f93b0b@65.109.88.38:17656,a58b4dec687b60ba05cf9a3e4cd1181b09c0661f@65.109.93.152:34656,edbd221ceecf4e0234fb60d617a025c6b0e56bf0@178.250.154.15:36656,3e7ef25f1c9829351936884618659167400eb0f1@142.132.149.171:26656,0179528068da0dfaf61005cf5aa28793ca42b129@85.25.74.163:26656,e46238ddcf2113b70f59b417994c375e2d67e265@71.236.119.108:40656,a859027129ee2524b57c43b9ecbe3bcc4d120efb@142.132.195.58:26656,65bf908c6c41cacfce9652ed69a17337b023d0d0@57.128.85.172:26656,ed68064620cebd196f56335bf801144efa9fb5ef@185.22.232.82:26656,f43c7c9a194ee5a97665a9aad8f887fdbb75e4ca@65.109.225.86:46656,358b375d2ed068e5670301760476637aa9ad79a0@51.79.19.15:30656,a19b89ebbf7331f435b8ef100ce501d2377922ea@209.126.116.182:26656,5d9146e9446df65ac30dd0a2dcb7e5887aaa6fa6@188.40.67.160:26656,a1f949c765bfc493ddd2e0e8477170bcc3b86a57@194.163.179.176:16656,f67f9a6f5121b6388c84812a812d5d6eca0b39e8@148.251.66.248:26656,7ff603bf2eb8249b9a1e695a232d99fdaf8a0f13@195.201.197.159:26156,abb367c73ef28fc90f5071e1258a23c0e5be17cd@103.107.183.89:26656,dc9c2ab4055a2ef8ddca435e9d8c120969562f98@194.247.13.139:26656,ed15ae05f17dd4e672eec0a96c38364d063b68dc@65.108.6.45:60756,eec4c706ee03921d103018647a4695706bc91b21@13.212.73.184:26656"\"/g" "${HOME}"/.secretd/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.0125uscrt\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^pruning *=.*|pruning = \"custom\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^pruning-keep-recent *=.*|pruning-keep-recent = \"113\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^pruning-keep-every *=.*|pruning-keep-every = \"0\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^pruning-interval *=.*|pruning-interval = \"17\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^snapshot-interval *=.*|snapshot-interval = \"0\"|" $HOME/.secretd/config/app.toml
sed -i -e "s|^snapshot-keep-recent *=.*|snapshot-keep-recent = \"2\"|" $HOME/.secretd/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 Secret Network. For Secret Network, we want to set the port prefix as 171. The port prefix will be used to replace the first 2 or 3 digits of the original ports.
# Set the prefix
export PREFIX=171
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
secretd keys add YOURKEY
# Restore existing juno wallet with mnemonic seed phrase.
# You will be prompted to enter mnemonic seed.
secretd keys add YOURKEY --recover
# Query the keystore for your public address
secretd keys show YOURKEY -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.
The above transaction is just an example. There are many more flags that can be set to customize your validator, such as your validator website, or keybase.io id, etc. To see a full list:
secretd tx staking create-validator --help
Backup critical files
There are certain files that you need to back up 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 ~/.secretd/config/:
priv_validator_key.json
node_key.json
It is recommended that you encrypt and backup of these files.