-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates documentation on how to run a full node #175
Changes from 6 commits
d237925
7abb208
7837503
f0c2d02
96eaa5f
f938c95
15263b9
a8bb170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,60 +4,124 @@ | |
1. Linux (Ubuntu Server 22.04.3 recommended) | ||
2. 8-cpu (ARM or x86_64), 64 GB RAM, 500 GB SSD NVME Storage | ||
|
||
## Get the dydxprotocold binary and initialize the data directory | ||
> **Note:** the example values below align with the **deployment by DYDX token holders**. For alternatives, please visit the [Network Constants page](https://docs.dydx.exchange/network/network_constants). | ||
|
||
## Install Full Node | ||
Install a full node to participate in the network. The following steps will guide you through the process of setting up a full node. Refer or use the script at https://github.com/dydxprotocol/v4-chain/blob/main/protocol/scripts/create_full_node.sh for a more automated process. | ||
|
||
### Step 1: Update System and Install Dependencies | ||
|
||
```bash | ||
sudo apt-get -y update | ||
sudo apt-get install -y curl jq lz4 | ||
``` | ||
|
||
### Step 2: Install Go | ||
Install Go and set the environment variables. This allows cosmovisor to be installed. amd64 architecture is used in this example. | ||
```bash | ||
wget https://golang.org/dl/go1.22.2.linux-amd64.tar.gz | ||
sudo tar -C /usr/local -xzf go1.22.2.linux-amd64.tar.gz | ||
rm go1.22.2.linux-amd64.tar.gz | ||
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bashrc | ||
eval "$(cat $HOME/.bashrc | tail -n +10)" | ||
``` | ||
|
||
### Step 3: Install Cosmovisor | ||
Cosmovisor is a process manager for Cosmos SDK-based blockchains. It allows for the automatic updating of the binary without downtime. The following command installs Cosmovisor. | ||
```bash | ||
go install cosmossdk.io/tools/cosmovisor/cmd/[email protected] | ||
``` | ||
|
||
### Step 4: Download dydxprotocold Binaries and Initialize Node | ||
1. From https://github.com/dydxprotocol/v4-chain/releases/ | Look for the `protocol` assets. | ||
2. For example, as of `10/19/2023`, this was the correct binary to use: | ||
|
||
2. For example, as of `04/26/2024`, this was the correct binary to use: | ||
 | ||
3. Download, extract, and rename the binary to `dydxprotocold`. Move it to a directory in your `$PATH`. Now, initialize the data directory (create the directory first if it doesn’t exist). | ||
3. Download, extract, and rename the binary to `dydxprotocold`. Move it to a directory in your `$PATH`. Now, initialize the dydx home directory (create the directory first if it doesn’t exist). | ||
```bash | ||
CHAIN_ID=dydx-mainnet-1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
DYDX_HOME=/home/vmware/.dydx-mainnet-1 | ||
NODE_NICKNAME=mydydxfullnode | ||
NODE_NAME=mydydxfullnode | ||
dydxprotocold init --chain-id=$CHAIN_ID $NODE_NAME | ||
|
||
dydxprotocold init --chain-id=$CHAIN_ID --home=$DYDX_HOME $NODE_NICKNAME | ||
by default, the dydx home directory is created in $HOME/.dydxprotocol | ||
``` | ||
|
||
## Get the latest applicable genesis.json file and install | ||
> **Note:** the example values below align with the **deployment by DYDX token holders**. For alternatives, please visit the [Network Resources page](../network/resources.md). | ||
### Step 5: Create Cosmovisor Directories and Move Binaries | ||
|
||
1. Use | ||
```bash | ||
curl https://dydx-ops-rpc.kingnodes.com/genesis | python3 -c 'import json,sys;print(json.dumps(json.load(sys.stdin)["result"]["genesis"], indent=2))' > genesis.json | ||
mkdir -p $HOME/.dydxprotocol/cosmovisor/genesis/bin | ||
mkdir -p $HOME/.dydxprotocol/cosmovisor/upgrades | ||
mv dydxprotocold $HOME/.dydxprotocol/cosmovisor/genesis/bin/ | ||
``` | ||
to get the applicable Genesis state of the network. | ||
|
||
2. Copy the applicable `genesis.json` file to the data directory’s `config/` directory | ||
3. (Alternatives): If the RPC endpoint above does not work, there are these alternatives: | ||
- https://dydx-dao-rpc.polkachu.com/genesis | ||
- https://dydx-mainnet-full-rpc.public.blastapi.io/genesis | ||
- Also check [Full node endpoints → RPC](../network/resources.md#full-node-endpoints) | ||
### Step 6: Get Genesis and Update Config | ||
|
||
## Install Bware’s snapshot (optional but saves days) | ||
> **Note:** the example values below align with the **deployment by DYDX token holders**. For alternatives, please visit the [Network Resources page](../network/resources.md). | ||
```bash | ||
curl https://dydx-rpc.lavenderfive.com/genesis | python3 -c 'import json,sys;print(json.dumps(json.load(sys.stdin)["result"]["genesis"], indent=2))' > $WORKDIR/config/genesis.json | ||
|
||
1. From https://bwarelabs.com/snapshots/dydx | ||
2. Download and extract (using `lz4 -dc < snapshotfile.tar.lz4 | tar xf -`) the snapshot contents in the data directory (make sure you are in the data directory before running the tar command). Important: The home directory (`$DYDX_HOME` or `/home/vmware/.dydx-mainnet-1` in our example) contains another `data/` directory. | ||
3. (Alternatives): If the above is not available, there are these alternatives: | ||
- https://polkachu.com/tendermint_snapshots/dydx | ||
- https://dydx-archive-snapshot.kingnodes.com/ | ||
- Also check [Snapshot service](../network/resources.md#snapshot-service) | ||
# For a more updated list of seed nodes, visit https://docs.dydx.exchange/network/resources#seed-nodes | ||
SEED_NODES=("[email protected]:23856", | ||
"[email protected]:23856", | ||
"f04a77b92d0d86725cdb2d6b7a7eb0eda8c27089@dydx-mainnet-seed.bwarelabs.com:36656", | ||
"[email protected]:23856", | ||
"c2c2fcb5e6e4755e06b83b499aff93e97282f8e8@tenderseed.ccvalidators.com:26401", | ||
"a9cae4047d5c34772442322b10ef5600d8e54900@dydx-mainnet-seednode.allthatnode.com:26656", | ||
"[email protected]:26656", | ||
"ebc272824924ea1a27ea3183dd0b9ba713494f83@dydx-mainnet-seed.autostake.com:27366" | ||
) | ||
|
||
## Start the full node | ||
> **Note:** the example values below align with the **deployment by DYDX token holders**. For alternatives, please visit the [Network Resources page](../network/resources.md). | ||
sed -i 's/seeds = ""/seeds = "'"${SEED_NODES[*]}"'"/' $HOME/.dydxprotocol/config/config.toml | ||
``` | ||
|
||
### Step 7: Create Service to Start Full Node | ||
|
||
We will create a systemd service to start the full node. This will allow the full node to start automatically on boot. | ||
|
||
1. Start the full node. Note that you may need to change the `--p2p.seeds` parameter depending on the applicable v4 software blockchain network – you can find an example on [Resources page under “Seed nodes”](../network/resources.md#seed-nodes) | ||
```bash | ||
DYDX_HOME=/home/vmware/.dydx-mainnet-1 | ||
sudo tee /etc/systemd/system/dydxprotocold.service > /dev/null << EOF | ||
[Unit] | ||
Description=osmosis node service | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: dydxprotocol node service |
||
After=network-online.target | ||
|
||
[Service] | ||
User=$USER | ||
ExecStart=/$HOME/go/bin/cosmovisor run start --non-validating-full-node=true | ||
WorkingDirectory=$HOME/.dydxprotocol | ||
Restart=always | ||
RestartSec=5 | ||
LimitNOFILE=4096 | ||
Environment="DAEMON_HOME=$HOME/.dydxprotocol" | ||
Environment="DAEMON_NAME=dydxprotocold" | ||
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false" | ||
Environment="DAEMON_RESTART_AFTER_UPGRADE=true" | ||
Environment="UNSAFE_SKIP_BACKUP=true" | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
EOF | ||
|
||
sudo systemctl daemon-reload | ||
sudo systemctl enable dydxprotocold | ||
|
||
nohup dydxprotocold start --p2p.seeds="[email protected]:23856,[email protected]:23856,f04a77b92d0d86725cdb2d6b7a7eb0eda8c27089@dydx-mainnet-seed.bwarelabs.com:36656,[email protected]:23856,c2c2fcb5e6e4755e06b83b499aff93e97282f8e8@tenderseed.ccvalidators.com:26401,[email protected]:26656,a9cae4047d5c34772442322b10ef5600d8e54900@dydx-mainnet-seednode.allthatnode.com:26656,[email protected]:26656,[email protected]:666,ebc272824924ea1a27ea3183dd0b9ba713494f83@dydx-mainnet-seed.autostake.com:27366" --home=$DYDX_HOME --non-validating-full-node=true > /tmp/fullnode.log 2>&1 & | ||
``` | ||
2. You can tail the log to see the progress. | ||
|
||
### Step 8: Get Snapshot | ||
> **Note:** the example values below align with the **deployment by DYDX token holders**. For alternatives, please visit the [Network Resources page](../network/resources.md). | ||
|
||
1. Choose a snapshot from https://docs.dydx.exchange/network/resources#snapshot-service | ||
2. Download and extract (using `lz4 -dc < snapshotfile.tar.lz4 | tar xf -`) the snapshot contents in the dydxprotocol home directory (make sure you are in this directory before running the tar command). In this example, the home directory is `$HOME/.dydxprotocol` | ||
|
||
### Step 9: Start Service | ||
|
||
```bash | ||
sudo systemctl start dydxprotocold | ||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also add command on how to stop the service |
||
|
||
### Check logs for the service to ensure it is running | ||
|
||
```bash | ||
tail -f /tmp/fullnode.log | ||
sudo journalctl -u dydxprotocold -f | ||
``` | ||
3. The full node is now syncing. To determine whether the full node is caught up with the chain head, please check the applicable block explorer to determine when it reaches the current block – an example block explorer is shown on https://www.mintscan.io/dydx | ||
The full node is now syncing. To determine whether the full node is caught up with the chain head, please check the applicable block explorer to determine when it reaches the current block – an example block explorer is shown on https://www.mintscan.io/dydx | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would also add a small section on different interesting queries you can run. for ex, command to see how much the node has synced rather than parsing through logs |
||
|
||
## Things you can do with the full node | ||
GET CURRENT BLOCK: You can get the current block with this program https://github.com/chiwalfrm/dydxexamples/blob/main/v4block_subscribe.py | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we provide instructions on how to figure out which version to use at any given time?