February 23, 2023

Dymension Installation Guide

WebSite | Discord | Github | Explorer

Dymension makes it easy to deploy your own blockchains called RollApps
The Dymension Hub is the calculated protocol layer and acts as a decentralized source of truth for the network. Dymension Hub is a Proof of Stake blockchain that provides consensus, security and liquidity for RollApps

Node

# Update the repositories
apt update && apt upgrade -y
# Install developer packages
apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y
# Install Go (one command)
ver="1.20.1" && \
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 version

# go version go1.19.1 linux/amd64
# Set the variables

# Come up with the name of your node and replace it instead <your_moniker>
MONIKER_DYMENSION=<your_moniker>

echo 'export MONIKER_DYMENSION='$MONIKER_DYMENSION >> $HOME/.bash_profile
echo "export CHAIN_ID_DYMENSION=35-C" >> $HOME/.bash_profile
echo "export PORT_DYMENSION=35" >> $HOME/.bash_profile
source $HOME/.bash_profile
# check whether the last command was executed
# Download binary files
cd $HOME 
git clone https://github.com/dymensionxyz/dymension
cd dymension
git fetch --all 
git checkout v0.2.0-beta
make install
sudo cp $HOME/go/bin/dymd /usr/local/bin/dymd
dymd version --long | grep -e version -e commit
# v0.2.0-beta
# Initialize the node
dymd init $MONIKER_DYMENSION --chain-id $CHAIN_ID_DYMENSION
# Download Genesis
wget https://raw.githubusercontent.com/obajay/nodes-Guides/main/Dymension/genesis.json -O $HOME/.dymension/config/genesis.json

# Check Genesis
sha256sum $HOME/.dymension/config/genesis.json
# cf20e3b15d089ceeaaa9bb2abcd48a50f98e9f2274f4320aeae534d6972c4ee2
# Set the ports

# config.toml
sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${PORT_DYMENSION}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${PORT_DYMENSION}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${PORT_DYMENSION}061\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${PORT_DYMENSION}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${PORT_DYMENSION}660\"%" $HOME/.dymension/config/config.toml

# app.toml
sed -i.bak -e "s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${PORT_DYMENSION}90\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${PORT_DYMENSION}91\"%; s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${PORT_DYMENSION}27\"%" $HOME/.dymension/config/app.toml

# client.toml
sed -i.bak -e "s%^node = \"tcp://localhost:26657\"%node = \"tcp://localhost:${PORT_DYMENSION}657\"%" $HOME/.dymension/config/client.toml

external_address=$(wget -qO- eth0.me)
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:${PORT_DYMENSION}656\"/" $HOME/.dymension/config/config.toml

Setup config

# correct config (so we can no longer use the chain-id flag for every CLI command in client.toml)
dymd config chain-id 35-C

# adjust if necessary keyring-backend в client.toml 
dymd config keyring-backend os

dymd config node tcp://localhost:${PORT_DYMENSION}657

# Set the minimum price for gas
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.025udym\"/;" ~/.dymension/config/app.toml

# Add seeds/peers в config.toml
peers="ebc272824924ea1a27ea3183dd0b9ba713494f83@dymension-testnet-peer.autostake.net:27086,9111fd409e5521470b9b33a46009f5e53c646a0d@178.62.81.245:45656,f8a0d7c7db90c53a989e2341746b88433f47f980@209.182.238.30:30657,1bffcd1690806b5796415ff72f02157ce048bcdd@144.76.67.53:2580,c17a4bcba59a0cbb10b91cd2cee0940c610d26ee@95.217.144.107:20556,e6ea3444ac85302c336000ac036f4d86b97b3d3e@38.146.3.199:20556,b473a649e58b49bc62b557e94d35a2c8c0ee9375@95.214.53.46:36656,db0264c412618949ce3a63cb07328d027e433372@146.19.24.101:26646,281190aa44ca82fb47afe60ba1a8902bae469b2a@dymension.peers.stavr.tech:17806,d8b1bcfc123e63b24d0ebf86ab674a0fc5cb3b06@51.159.97.212:26656,55f233c7c4bea21a47d266921ca5fce657f3adf7@168.119.240.200:26656,139340424dddf85e54e0a54179d06875013e1e39@65.109.87.88:24656"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.dymension/config/config.toml

seeds="f97a75fb69d3a5fe893dca7c8d238ccc0bd66a8f@dymension-testnet.seed.brocha.in:30584"
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.dymension/config/config.toml

# Set up filter for "bad" peers
sed -i -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $HOME/.dymension/config/config.toml

#
sed -i -e "s/^timeout_commit *=.*/timeout_commit = \"10s\"/" $HOME/.dymension/config/config.toml
sed -i -e "s/^timeout_propose *=.*/timeout_propose = \"10s\"/" $HOME/.dymension/config/config.toml
sed -i -e "s/^create_empty_blocks_interval *=.*/create_empty_blocks_interval = \"10s\"/" $HOME/.dymension/config/config.toml
sed -i 's/create_empty_blocks = .*/create_empty_blocks = true/g' ~/.dymension/config/config.toml
sed -i 's/timeout_broadcast_tx_commit = ".*s"/timeout_broadcast_tx_commit = "10s"/g' ~/.dymension/config/config.tom

# Set up pruning
pruning="custom"
pruning_keep_recent="1000"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.dymension/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.dymension/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.dymension/config/app.toml

(OPTIONAL) Turn off indexing in config.toml

indexer="null"
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.dymension/config/config.toml

SnapShot

snapshot_interval=1000
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" ~/.dymension/config/app.toml

cd $HOME
apt install lz4
sudo systemctl stop dymd
cp $HOME/.dymension/data/priv_validator_state.json $HOME/.dymension/priv_validator_state.json.backup
rm -rf $HOME/.dymension/data
curl -o - -L http://dymension.snapshot.stavr.tech:1019/dymension/dymension-snap.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.dymension --strip-components 2
mv $HOME/.dymension/priv_validator_state.json.backup $HOME/.dymension/data/priv_validator_state.json
wget -O $HOME/.dymension/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Dymension/addrbook.json"

sudo systemctl restart dymd && journalctl -u dymd -f -o cat

State Sync

SNAP_RPC=http://dymension.rpc.t.stavr.tech:17087
peers="281190aa44ca82fb47afe60ba1a8902bae469b2a@dymension.peers.stavr.tech:17086"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.dymension/config/config.toml
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 100)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.dymension/config/config.toml

# Reset
dymd tendermint unsafe-reset-all --home /root/.dymension
# AddrBook
wget -O $HOME/.dymension/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Dymension/addrbook.json"
# Restart
systemctl restart dymd && journalctl -u dymd -f -o cat

Cosmovisor

# Install Cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest
# Create directories
mkdir -p ~/.dymension/cosmovisor
mkdir -p ~/.dymension/cosmovisor/genesis
mkdir -p ~/.dymension/cosmovisor/genesis/bin
mkdir -p ~/.dymension/cosmovisor/upgrades
# Copy the binary file to the cosmovisor folder
cp `which dymd` ~/.dymension/cosmovisor/genesis/bin/dymd
# Create service file (One command)
sudo tee /etc/systemd/system/dymd.service > /dev/null <<EOF
[Unit]
Description=dymd daemon
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) run start --x-crisis-skip-assert-invariants
Restart=always
RestartSec=3
LimitNOFILE=infinity

Environment="DAEMON_NAME=dymd"
Environment="DAEMON_HOME=${HOME}/.dymension"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"

[Install]
WantedBy=multi-user.target
EOF
# Start the node
systemctl daemon-reload
systemctl enable dymd
systemctl restart dymd && journalctl -u dymd -f -o cat

# Escape from logs ctrl+c
# Check the logs again
journalctl -u dymd -f -o cat

# Escape from logs ctrl+c

If you cannot connect to peers long time download addrbook

wget -O $HOME/.dymension/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Dymension/addrbook.json"

systemctl restart dymd && journalctl -u dymd -f -o cat

Now all ok, Check status

dymd status 2>&1 | jq "{catching_up: .SyncInfo.catching_up}"
"catching_up": false означає, що нода синхронізована, чекаємо повної синхронізації

Wallets

# Create wallet
dymd keys add wallet

Create a password for the wallet and write it down so you don't forget it. The wallet has been created. In the last line there will be a phrase that must be written down

# If the wallet was already there, restore it
dymd keys add wallet --recover
# Insert the seed phrase from your wallet
# If everything is correct, you will see your wallet data

Go to the # faucet branch and request tokens

# Save the wallet address
# Replace <your_address> with your wallet address
WALLET_DYMENSION=<your_address>
echo "export WALLET_DYMENSION="${WALLET_DYMENSION}"" >> $HOME/.bash_profile
source $HOME/.bash_profile
# Check the ballance
andromedad q bank balances $WALLET_DYMENSION

Validator

Do not forget to create a profile on https://keybase.io/ and set a profile photo there that will be imported by key and used for your validators.

# Change <identity> to your key from keybase
dymd tx staking create-validator \
--amount 1000000udym \
--from=$WALLET_DYMENSION \
--commission-rate "0.15" \
--commission-max-rate "0.20" \
--commission-max-change-rate "0.1" \
--min-self-delegation "1" \
--pubkey=$(dymd tendermint show-validator) \
--moniker=$MONIKER_DYMENSION \
--chain-id=$CHAIN_ID_DYMENSION \
--fees=5000udym \
--identity="" \
--details="" \
--website="" \
-y

Check yourself in the list експлоуері

Or by command

dymd query staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker=="$MONIKER_ANDROMEDA")' | jq
# Edit the validator
dymd tx staking edit-validator \
  --new-moniker=$MONIKER_DYMENSION \
  --website="" \
  --identity=<identity> \
  --details="" \
  --chain-id=$CHAIN_ID_DYMENSION \
  --fees=1000uandr \
  --from=wallet
  
# Save valoper_address in bash
# Change <your_valoper_address> to the address of the validator, starting with andrvaloper...
VALOPER_DYMENSION=<your_valoper_address>
echo "export VALOPER_DYMENSION="${VALOPER_DYMENSION}"" >> $HOME/.bash_profile
source $HOME/.bash_profile

!!! Save priv_validator_key.json which located in /root/.dymension/config

Information

# Check the blocks
dymd status 2>&1 | jq ."SyncInfo"."latest_block_height"

# Check logs
journalctl -u dymd -f -o cat

# Check status
dymd status 2>&1 | jq .SyncInfo

# Check balance
dymd q bank balances $WALLET_DYMENSION

# Check pubkey of validator
dymd tendermint show-validator

# Check validator
dymd q staking validator $VALOPER_DYMENSION
dymd q staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker="$MONIKER_DYMENSION")' | jq

# Check information of TX_HASH
dymd q tx <TX_HASH>

# Check how many blocks were passed by the validator and from which block the asset
dymd q slashing signing-info $(dymd tendermint show-validator)
Transactions

# Collect rewards from all validators delegated to them (without commission)
dymd tx distribution withdraw-all-rewards --from <name_wallet> --fees 5000udym -y

# Collect rewards from a separate validator or rewards + commission from your own validator
dymd tx distribution withdraw-rewards <valoper_address> --from <name_wallet> --fees 5000udym --commission -y

# Delegate yourself (this is how 1 coin is sent)
dymd tx staking delegate <valoper_address> 1000000udym --from <name_wallet> --fees 5000udym -y

# Redelegate to other validator
dymd tx staking redelegate <src-validator-addr> <dst-validator-addr> 1000000udym --from <name_wallet> --fees 5000udym -y

# Unbond 
dymd tx staking unbond <addr_valoper> 1000000udym --from <name_wallet> --fees 5000udym -y

# Send tokens to other adress
dymd tx bank send <name_wallet> <address> 1000000udym --fees 5000udym -y

# Unjail
dymd tx slashing unjail --from <name_wallet> --fees 5000udym -y

! If the transactions are not sent with the error account sequence mismatch, expected 18, got 17: incorrect account sequence, then add the flag -s 18 to the command (replace the number with the one that is waiting for the sequence)

Work with wallets

# Chech the wallets list
dymd keys list

# Delete wallet
dymd keys delete <name_wallet>

Delete Node

sudo systemctl stop dymd && \
sudo systemctl disable dymd && \
rm /etc/systemd/system/dymd.service && \
sudo systemctl daemon-reload && \
cd $HOME && \
rm -rf dymension && \
rm -rf .dymension && \
rm -rf $(which dymd)

Governance

# List proposals
dymd q gov proposals

# Check voting result
dymd q gov proposals --voter $VALOPER_DYMENSION

# Vote
dymd tx gov vote 1 yes --from $WALLET_DYMENSION

# Make Deposit for proposal
dymd tx gov deposit 1 1000000uheart --from $WALLET_DYMENSION

Peers and RPC

FOLDER=.dymension

# Check your peer
PORTR=$(grep -A 3 "\[p2p\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+") && \
echo $(dymd tendermint show-node-id)@$(curl ifconfig.me)$PORTR

# Check port of RPC
echo -e "\033[0;32m$(grep -A 3 "\[rpc\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+")\033[0m"

# Check peers quantity
PORT=
curl -s http://localhost:$PORT_DYMENSION/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr | split(":")[2])"' | wc -l

We are a small group of enthusiasts who participate in testnet and validate projects on the mainet, invest in promising projects.

Discord -

Telegram -