Setup your node
Install pre requis
sudo apt-get update && sudo apt upgrade -y
sudo apt-get install make build-essential gcc git jq chrony -y
Install go
sudo rm -rf /usr/local/go
wget https://golang.org/dl/go1.19.1.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.19.1.linux-amd64.tar.gz
rm go1.19.1.linux-amd64.tar.gz
Setting up go
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
Install Node
Install the Cosmos Hub node
binary by running the following commands
#from $HOME dir
git clone https://github.com/cosmos/gaia
cd gaia
git fetch
git checkout v10.0.2
make install
To confirm that the node is well installed
gaiad version
#v10.0.2
Setting up the Node
Initialization node
Please choose your MONIKER name and replace it in the next command, it will represent your node
gaiad init MONIKER_NAME --chain-id cosmoshub-4
This will generate severals files in ~/.gaia/config/
- node_key.json
- genesis.json
- priv_validator_key.json
Download and replace the genesis file
rm ~/.gaia/config/genesis.json
wget https://raw.githubusercontent.com/cosmos/mainnet/master/genesis/genesis.cosmoshub-4.json.gz
gzip -d genesis.cosmoshub-4.json.gz
mv genesis.cosmoshub-4.json ~/.gaia/config
Set minimum gas prices
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.0025uatom\"/" ~/.gaia/config/app.toml
Node connexion
In order to connect the node you can either use seeds
, lives peers
or address book
.
- Seeds
- Peers
- Addrbook
Set Seeds
SEEDS = ba3bacc714817218562f743178228f23678b2873@public-seed-node.cosmoshub.certus.one:26656,20e1000e88125698264454a884812746c2eb4807@seeds.lavenderfive.com:14956,ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:14956
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $HOME/.gaia/config/config.toml
Set Peers
PEERS = 2260657694c9dadeb216067b2a010885494de10e@65.108.108.42:26656,2286eeee09fcf37e768dfffc0db8c821b9231b7b@204.16.244.78:26656,d0134556f1d4bf5e30677dc2ea9a777776a69a3c@142.132.209.97:26656,df1b21a6a92c6045946b2263ada344628ee9a8b6@74.118.143.189:26656,b858ca4f3fed2c36b949cf67188b126e2542a39a@135.181.215.115:26726,53e53f044c818ee5dfdaaa09c1e611af54d959b8@35.213.140.7:26656,213857e741833d17275ea559bb2d0342398cec99@35.245.206.45:26656,ee767901f4a7eaf44603ef0a5b6e5edac118ba1e@74.118.136.149:26656,e1b058e5cfa2b836ddaa496b10911da62dcf182e@164.152.161.249:26656,e2b3cba06a28ff811e72f23d0e025c9354ed680d@35.206.163.4:26656,e726816f42831689eab9378d5d577f1d06d25716@176.9.188.21:26656,32b7b1a06120182c74c1fee38979dfa1c05b6bf9@71.236.119.108:18656
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.gaia/config/config.toml
Set Addrbook
wget -O addrbook.json https://dl2.quicksync.io/json/addrbook.cosmos.json --inet4-only
mv addrbook.json ~/.gaia/config
Setup service file
[Unit]
Description="cosmos node"
[Service]
User=USER
ExecStart=$(which gaiad) start
Restart=always
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
If you'd like to synchronise a node from a snapshot check the snapshot part
Start service file
systemctl daemon-reload
systemctl start cosmos.service | journalctl -u cosmos.service -f