Skip to main content

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 dYdX-node binary by running the following commands

#from $HOME dir 
export BINARY_VERSION="v1.0.0"
git clone https://github.com/dydxprotocol/v4-chain dydx
cd dydx
git fetch
git checkout v1.0.0
make install

Initialization node

Please choose your MONIKER name and replace it in the next command, it will represent your node

dydxprotocold init MONIKER_NAME --chain-id dydx-mainnet-1

This will generate severals files in ~/.dydxprotocol/config/

  • node_key.json
  • genesis.json
  • priv_validator_key.json

Download and replace the genesis file

rm ~/.dydxprotocol/config/genesis.json 
wget https://raw.githubusercontent.com/dydxopsdao/networks/main/dydx-mainnet-1/genesis.json
mv genesis.json ~/.dydxprotocol/config

Node connexion

In order to connect the node you can either use seeds, lives peers or address book.

Set Seeds

SEEDS = ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:23856,65b740ee326c9260c30af1f044e9cda63c73f7c1@seeds.kingnodes.net:23856,c2c2fcb5e6e4755e06b83b499aff93e97282f8e8@tenderseed.ccvalidators.com:26401,20e1000e88125698264454a884812746c2eb4807@seeds.lavenderfive.com:23856,f04a77b92d0d86725cdb2d6b7a7eb0eda8c27089@dydx-mainnet-seed.bwarelabs.com:36656
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" $HOME/.dydxprotocol/config/config.toml

Setup service file

[Unit]
Description="dYdX node"


[Service]
User=USER
ExecStart=$(which dydxprotocold) 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 dydx.service | journalctl -u dydx.service -f