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="v0.0.1-rc1"
git clone https://github.com/dydxprotocol/networks.git
cd networks
git checkout main
git pull origin main
ls dydx-testnet-1/binaries/$BINARY_VERSION

Choose the binary for the corresponding platform, and set up in $PATH (using linux-amd64 as example):

export DYDX_PLATFORM= "dydxprotocold-v0.0.1-rc1-linux-amd64.tar.gz"
tar -xvzf dydx-testnet-1/binaries/$BINARY_VERSION/dydxprotocold-$BINARY_VERSION-$DYDX_PLATFORM.tar.gz
mkdir -p "$HOME/local/bin"
export PATH="$HOME/local/bin:$PATH"
cp build/dydxprotocold-$BINARY_VERSION-$DYDX_PLATFORM "$HOME/local/bin/dydxprotocold"
rm -R build

To confirm that the node is well installed

dydxprotocold version --long

#commit: cc46ed065bade19e6ffa68a9d9e560c5dff4b4a1 #cosmos_sdk_version: v0.47.1 #go: go version go1.19.1 #name: dydxprotocol #server_name: dydxprotocold #version: 0.0.1-rc1

Setting up the Node

Save your Chain ID in dydxprotocold config

Save the testnet chain-id. This will make it so you do not have to manually pass in the chain-id flag for every CLI command.

dydxprotocold config chain-id dydx-testnet-1

Initialization node

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

# If you previously worked on a .dydxprotocol home directory, wipe it before proceeding
dydxprotocold init MONIKER_NAME --chain-id dydx-testnet-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 -O genesis.json https://github.com/dydxprotocol/networks/blob/main/dydx-testnet-1/genesis.json --inet4-only
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 = 25dd504d86d82673b9cf94fe78c00714f236c9f8@3.128.51.185:26656
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 --non-validating-full-node=true
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-testnet.service | journalctl -u dydx-testnet.service -f