osmosis node guide
Osmosis DEX chain.
Installation
Before you start. Replace every <PLACEHOLDER> with your own value and double-check the commands against the project's official documentation. Never share your mnemonic or priv_validator_key.json, and never run the same validator key on two servers.
1. Install dependencies
sudo apt update && sudo apt upgrade -y sudo apt install -y curl git wget htop tmux build-essential jq make lz4 gcc unzip ufw2. Install Go
cd $HOME VER="1.22.5" wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz" sudo rm -rf /usr/local/go sudo tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz" rm "go$VER.linux-amd64.tar.gz" echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile source $HOME/.bash_profile go version3. Build the binary
cd $HOME rm -rf osmosis git clone https://github.com/osmosis-labs/osmosis cd osmosis git checkout <VERSION> make install # check the binary osmosisd version --long | grep -e version -e commit4. Initialise the node
osmosisd init <MONIKER> --chain-id osmosis-1 --home $HOME/.osmosisd osmosisd config set client chain-id osmosis-1 --home $HOME/.osmosisd osmosisd config set client keyring-backend file --home $HOME/.osmosisd osmosisd config set client node tcp://localhost:12657 --home $HOME/.osmosisd5. Genesis and addrbook
wget -O $HOME/.osmosisd/config/genesis.json <GENESIS_URL> wget -O $HOME/.osmosisd/config/addrbook.json <ADDRBOOK_URL>6. Configure the node
# minimum gas price, seeds and peers sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.0025uosmo\"|" $HOME/.osmosisd/config/app.toml sed -i -e "s|^seeds *=.*|seeds = \"<SEEDS>\"|" $HOME/.osmosisd/config/config.toml sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"<PEERS>\"|" $HOME/.osmosisd/config/config.toml # pruning (validator) sed -i -e 's|^pruning *=.*|pruning = "custom"|' \ -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \ -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \ -e 's|^pruning-interval *=.*|pruning-interval = "19"|' $HOME/.osmosisd/config/app.toml # indexer off for a validator-only node (keep "kv" if this node serves RPC/API to users) sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.osmosisd/config/config.toml # prometheus metrics (bound by the port plan below, keep it firewalled) sed -i -e 's|^prometheus *=.*|prometheus = true|' $HOME/.osmosisd/config/config.toml7. Custom ports
# every chain on the server gets its own port block (12xxx) so nodes never collide PORT=12 sed -i.bak -e "s%:26658%:${PORT}658%g; s%:26657%:${PORT}657%g; s%:6060%:${PORT}060%g; s%:26656%:${PORT}656%g; s%:26660%:${PORT}660%g" $HOME/.osmosisd/config/config.toml sed -i.bak -e "s%:1317%:${PORT}317%g; s%:8080%:${PORT}080%g; s%:9090%:${PORT}090%g; s%:9091%:${PORT}091%g; s%:8545%:${PORT}545%g; s%:8546%:${PORT}546%g; s%:6065%:${PORT}065%g" $HOME/.osmosisd/config/app.toml # advertise the public p2p port EXT_IP=$(curl -s https://api.ipify.org) sed -i -e "s|^external_address *=.*|external_address = \"${EXT_IP}:${PORT}656\"|" $HOME/.osmosisd/config/config.toml # open ONLY the p2p port to the world; RPC/API/gRPC stay private sudo ufw allow ${PORT}656/tcp comment 'osmosisd p2p'8. Create the service
sudo tee /etc/systemd/system/osmosisd.service > /dev/null <<EOF2 [Unit] Description=osmosisd node After=network-online.target [Service] User=$USER ExecStart=$(which osmosisd) start --home $HOME/.osmosisd Restart=on-failure RestartSec=5 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF2 sudo systemctl daemon-reload sudo systemctl enable osmosisd9. Start and sync
sudo systemctl start osmosisd sudo journalctl -u osmosisd -f -o cat # in another terminal: wait until "catching_up" is false osmosisd status 2>&1 | jq .sync_info10. Wallet and validator
# 1) wallet (write the mnemonic down OFFLINE; never share it) osmosisd keys add wallet --keyring-backend file --home $HOME/.osmosisd # or restore: osmosisd keys add wallet --recover # 2) fund the wallet, then wait for the node to finish syncing (catching_up = false) # 3) validator definition cat > $HOME/validator.json <<EOF2 { "pubkey": $(osmosisd comet show-validator --home $HOME/.osmosisd), "amount": "1000000uosmo", "moniker": "<MONIKER>", "identity": "<KEYBASE_IDENTITY>", "website": "<WEBSITE>", "security": "<SECURITY_EMAIL>", "details": "<DETAILS>", "commission-rate": "0.05", "commission-max-rate": "0.20", "commission-max-change-rate": "0.01", "min-self-delegation": "1" } EOF2 # 4) create the validator osmosisd tx staking create-validator $HOME/validator.json \ --from wallet \ --chain-id osmosis-1 \ --keyring-backend file \ --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo \ --home $HOME/.osmosisd -y
Cheat sheet
### Node
osmosisd status 2>&1 | jq .sync_info # sync status
sudo journalctl -u osmosisd -f -o cat # live logs
sudo systemctl restart osmosisd # restart
curl -s localhost:12657/net_info | jq .result.n_peers # peers count
### Keys and balance
osmosisd keys list --home $HOME/.osmosisd
osmosisd q bank balances $( osmosisd keys show wallet -a --home $HOME/.osmosisd )
### Staking
osmosisd tx staking delegate <VALOPER> 1000000uosmo --from wallet --chain-id osmosis-1 --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo -y
osmosisd tx distribution withdraw-all-rewards --from wallet --chain-id osmosis-1 --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo -y
osmosisd tx distribution withdraw-rewards <VALOPER> --commission --from wallet --chain-id osmosis-1 --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo -y
### Validator
osmosisd tx slashing unjail --from wallet --chain-id osmosis-1 --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo -y
osmosisd q staking validator <VALOPER>
osmosisd q slashing signing-info $(osmosisd comet show-validator --home $HOME/.osmosisd)
### Governance
osmosisd q gov proposals --status voting_period
osmosisd tx gov vote <PROPOSAL_ID> yes --from wallet --chain-id osmosis-1 --gas auto --gas-adjustment 1.5 --gas-prices 0.0025uosmo -y