Skip to content

Commit

Permalink
Run a full node update (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
zachfc authored Jul 31, 2024
1 parent 48b9bed commit e326659
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 70 deletions.
81 changes: 75 additions & 6 deletions pages/infrastructure_providers-network/resources.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Tab, Tabs } from 'nextra-theme-docs';

# Resources

## `networks` repositories
## `networks` Repositories

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>https://github.com/dydxprotocol/v4-testnets/tree/main/dydx-testnet-4</Tab>
Expand Down Expand Up @@ -72,7 +72,7 @@ For **the deployment by DYDX token holders**:
</Tab>
</Tabs>

## Indexer endpoints
## Indexer Endpoints

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>
Expand All @@ -95,7 +95,7 @@ For **the deployment by DYDX token holders**:
</Tab>
</Tabs>

## StateSync nodes
## StateSync Nodes

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>
Expand Down Expand Up @@ -123,6 +123,30 @@ For **the deployment by DYDX token holders**:

</Tab>
</Tabs>

## State Sync Service

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>
For **Testnet**:

| Team | URI |
| ------------- | --------------------------------------------------------------------------------------- |
| Lavender.Five | https://services.lavenderfive.com/testnet/dydx/statesync |

</Tab>
<Tab>
For **the deployment by DYDX token holders**:

| Team | URI |
| ------------- | -------------------------------------------------------------------------------------- |
| Polkachu | https://polkachu.com/state_sync/dydx |
| Lavender.Five | https://services.lavenderfive.com/mainnet/dydx/statesync |
| AutoStake | https://autostake.com/networks/dydx/#state-sync |

</Tab>
</Tabs>

## Snapshot Service

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
Expand All @@ -148,7 +172,52 @@ For **the deployment by DYDX token holders**:
</Tab>
</Tabs>

## Full node endpoints
## Live Peer Node Providers

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>
For **Testnet**:

| Team | URI |
| ------------- | --------------------------------------------------------------------------------------- |
| Lavender.Five | `https://services.lavenderfive.com/testnet/dydx#live-peers` |

</Tab>
<Tab>
For **the deployment by DYDX token holders**:

| Team | URI |
| ------------- | -------------------------------------------------------------------------------------- |
| Lavender.Five | `https://services.lavenderfive.com/mainnet/dydx#live-peers` |
| Polkachu | `https://polkachu.com/live_peers/dydx` |

</Tab>
</Tabs>

## Address Book Providers

<Tabs items={['dydx-testnet-4', 'dydx-mainnet-1']}>
<Tab>
For **Testnet**:

| Team | URI |
| ------------- | --------------------------------------------------------------------------------------- |
| Lavender.Five | `https://services.lavenderfive.com/testnet/dydx#latest-addrbook` |

</Tab>
<Tab>
For **the deployment by DYDX token holders**:

| Team | URI |
| ------------- | -------------------------------------------------------------------------------------- |
| AutoStake | `https://autostake.com/networks/dydx/` |
| Polkachu | `https://polkachu.com/addrbooks/dydx` |
| Lavender.Five | `https://services.lavenderfive.com/mainnet/dydx#latest-addrbook` |

</Tab>
</Tabs>

## Full Node Endpoints

<Tabs items={["dydx-testnet-4", "dydx-mainnet-1"]}>
<Tab>
Expand Down Expand Up @@ -224,13 +293,13 @@ For **the deployment by DYDX token holders**:
</Tab>
</Tabs>

## Archival node endpoints
## Archival Node Endpoints

<Tabs items={["dydx-testnet-4", "dydx-mainnet-1"]}>
<Tab>
For **Testnet**:

No Archival nodes
No Archival Nodes.

</Tab>
<Tab>
Expand Down
4 changes: 2 additions & 2 deletions pages/infrastructure_providers-validators/_meta.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"hardware_requirements": "Hardware Requirements",
"required_node_configs": "Required Node Configs",
"how_to_set_up_full_node": "Set Up a Full Node",
"running_full_node": "Running a Full Node",
"how_to_set_up_full_node": "How to set up a full node",
"running_full_node": "Run a Full Node",
"running_a_validator": "Running a Validator",
"snapshots": "Snapshots",
"full_node_streaming": "Full Node Streaming",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ sudo systemctl daemon-reload
sudo systemctl enable dydxprotocold
```

The system service definition above holds environment variables. When you start it, the service will run the command `/$HOME/go/bin/cosmovisor run start --non-validating-full-node=true`
The system service definition above holds environment variables. When you start it, the service will run the command `/$HOME/go/bin/cosmovisor run start --non-validating-full-node=true`.

> The flag `--non-validating-full-node` is required. It disables the functionality intended for validator nodes and enables additional logic for reading data.
### Step 10: Start the service
To start your node using the `systemd` service that you created, run the following command:
Expand Down
109 changes: 48 additions & 61 deletions pages/infrastructure_providers-validators/running_full_node.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,60 @@
# Running a Full Node

### Save your Chain ID in `dydxprotocold` config

Save the [chain-id](../infrastructure_providers-network/network_constants.mdx#chain-id). This will make it so you do not have to manually pass in the chain-id flag for every CLI command.

```bash
dydxprotocold config chain-id $CHAIN_ID
# Run a Full Node
Running a full node allows your system to participate in a dYdX chain network. The recommended settings and best practices on this page help ensure your node stays healthy and up to date with the network.

> Code snippets on this page use example values. Replace them with your own. See the [Network Configuration](../infrastructure_providers-network/network_constants.mdx) section of the documentation for network constants and other resources you need to configure a full node.
## Prerequisites
You need a running, non-validating full node that is connected to network.

- If you created a system service for your node by following the instructions on the previous page, [Set Up a Full Node](../infrastructure_providers-validators/how_to_set_up_full_node.md), start your node with the following command:
```bash
stystemctl start dydxprotocold
```
- To start your node with Cosmovisor, include the flag `--non-validating-full-node=true`. Cosmovisor may prompt you to configure additional variables in your environment or include them in your command.
```bash
cosmovisor run start --non-validating-full-node=true
```
> The flag `--non-validating-full-node` is required. It disables the functionality intended for validator nodes and enables additional logic for reading data.
- To start your node directly with the `dydxprotocold` binary, include the flag `--non-validating-full-node=true`. `dydxprotocold` may prompt you to configure additional variables in your environment or include them in your command.

```bash
dydxprotocold run start --non-validating-full-node=true
```
> The flag `--non-validating-full-node` is required. It disables the functionality intended for validator nodes and enables additional logic for reading data.
## Connect to Healthy Peers
To keep your full node up to date, connect to healthy peers with the latest state of the network. Request a list of healthy peers for your deployment from a [Live Peer Node](../infrastructure_providers-network/resources#live-peer-node-providers) provider.

From the list of healthy peers that you retrieve from peer node provider, choose any 5 for your node to query for the latest state. Add a comma-separated list of those peer addresses to the `persistent_peers` field in your `config.toml`, like in the following example:

```yaml
# config.toml
# Example values from Polkachu for dydx-mainnet-1
persistent_peers=83c299de2052db247f08422b6592e1383dd7a104@136.243.36.60:23856,[email protected]:26656,[email protected]:26656,[email protected]:23856,[email protected]:26656
```

### Getting a Snapshot

See [snapshot service](../infrastructure_providers-network/resources.mdx#snapshot-service).

### Starting a Full Node

Find the seed node's ID and the IP address from [Resources](../infrastructure_providers-network/resources.mdx#seed-nodes). Then, run the following command to start a non-validating full node.

For example,
```bash
dydxprotocold start --p2p.seeds="..." --bridge-daemon-eth-rpc-endpoint="<eth rpc endpoint>" --non-validating-full-node=true
```

💡**Note**: if you want to disable gRPC on your full node, it is important to start the node with the
`--non-validating-full-node=true` flag. Otherwise, the application will require that gRPC be enabled.


## Staying up-to-date with the Latest State

### Connecting to Healthy Peers

In order for the full node to have the latest state, it needs to connect to peers which have the latest state Use the following links to get a list of live peers which have the latest state

https://services.lavenderfive.com/mainnet/dydx#live-peers

https://polkachu.com/live_peers/dydx

Update `persistent_peers` in the config.toml file to include a randomly selected list of 5 peers from the list of live peers obtained using the links above

### Snapshots

Snapshots contain a compressed copy of the chain data which allow the full node to bootstrap to a recent state in the blockchain. A list of snapshot services can be found [here](../infrastructure_providers-network/resources.mdx#snapshot-service).

### State sync (Alternative to snapshots)

State Sync enables a new node to join the network by obtaining a snapshot of the application state from a state sync node at a recent height. This eliminates the need to fetch and replay all historical blocks. A list of state sync services with instructions are listed below

https://polkachu.com/state_sync/dydx

https://services.lavenderfive.com/mainnet/dydx/statesync

https://autostake.com/networks/dydx/#state-sync

### Address Book
## Save an Address Book
Download the latest `addrbook.json` file, which stores configuration details that help your node efficiently connect to peers in its network. Download an up-to-date address book file for your deployment from an [Address Book](../infrastructure_providers-network/resources#address-book-providers) provider.

The **`addrbook.json`** file is used to store configuration details that help a node connect to other peers in the network more efficiently. This can be obtained from the one of the below services and needs to be stored in the `config` folder.
Save the `addrbook.json` file in your `/.dydxprotocol/config` directory.

https://polkachu.com/addrbooks/dydx
## Back Up Your Node
> If you followed the procedure on the previous page, [Set Up a Full Node](../infrastructure_providers-validators/how_to_set_up_full_node.md), you already have a snapshot installed.
https://services.lavenderfive.com/mainnet/dydx#latest-addrbook
Your full node needs a backup plan to replay the history of the network in case it falls out of sync. You can back up your node in one of two ways.

https://autostake.com/networks/dydx/
### Snapshot
You can use a **snapshot** stored on the system that your node runs on. A snapshot contains a compressed copy of the application state at the time the snapshot was taken. If your node falls out of sync, a snapshot allows the node to recover to that saved state before replaying the rest of the history of the network. This speeds up the syncing process because you avoid replaying the entire history of the network, instead starting from your stored application state snapshot. To use a snapshot to back up your full node, install a snapshot for your deployment from a [Snapshot Service](../infrastructure_providers-network/resources.mdx#snapshot-service).

## Pruning Settings
### State Sync
You can use **state sync**, a set of configuration settings that allow your node to retrieve a snapshot from the network. If your node falls out of sync, it queries a state sync node for a verified, recent snapshot of the application state. This speeds up the syncing process because you avoid replaying the entire history of the network, instead starting from the network's most recent application state snapshot. To use state sync to back up your full node, follow the instructions for your deployment from a [State Sync](../infrastructure_providers-network/resources#state-sync-service) service.

For optimal storage, use the following pruning setting in the app.toml file:
## Optimize Pruning Settings
In general, dYdX recommends the following pruning setting, configured in your `app.toml` file:

```bash
# 2 latest states will be kept; pruning at 10 block intervals.
pruning = "everything"
# app.toml
pruning = "everything" # 2 latest states will be kept; pruning at 10 block intervals
```

If the full node is being used for historical queries, a custom strategy should be used to maintain more states. This will increase storage requirements.
However, if you want to use your node to query historical data, configure a custom pruning strategy to retain more states. Retaining more states increases storage requirements.

1 comment on commit e326659

@vercel
Copy link

@vercel vercel bot commented on e326659 Jul 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You must have Developer access to commit code to dYdX Trading on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes.

Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles

Please sign in to comment.