Skip to content

Snapshot Node Configurations

Snapshots are important for a network to ensure nodes are able to sync up to the latest state of the network as quickly as possible. Before nodes can be used, they must sync up to the current state of the network, by starting from a recent snapshot these nodes can fast-track a majority of the syncing.

TIP

If you're looking for instructions on syncing a node from a snapshot, please refer to Syncing A Node

Types of Snapshots

There are two ways you can can help other node operators sync up with the network:

Pruning Options

Because snapshots are used to sync up a new node, your pruning settings are dependent on what type of nodes will use these snapshots.

Pruning:

  • default - Useful for nodes running with default settings
  • nothing - Useful for Archive Nodes
  • everything - Useful for nodes to download the least amount of data to sync up to latest block
  • custom - Useful for any special purpose / advanced snapshot configurations

How to Setup a State Sync Node

State sync is a syncing method in which nodes connect directly to your specific node to download the latest state data, skipping a lot of early data that is not necessary for all types of nodes. In order to allow other nodes to state sync against your node you will need to:

  1. Enable state syncing in your node
  2. Provide an RPC endpoint for other nodes to use when state syncing

Enabling State Sync Snapshots

State sync snapshots are disabled by default, so you'll want to edit a few lines in your app.toml config file.

Under the [state-sync] section, you'll want to set appropriate values for these variables:

  • snapshot-interval
  • snapshot-keep-recent

Here are some recommended settings:

toml
###############################################################################
###                        State Sync Configuration                         ###
###############################################################################

# State sync snapshots allow other nodes to rapidly join the network without replaying historical
# blocks, instead downloading and applying a snapshot of the application state at a given height.
[state-sync]

# snapshot-interval specifies the block interval at which local state sync snapshots are
# taken (0 to disable).
snapshot-interval = 1000

# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
snapshot-keep-recent = 2
###############################################################################
###                        State Sync Configuration                         ###
###############################################################################

# State sync snapshots allow other nodes to rapidly join the network without replaying historical
# blocks, instead downloading and applying a snapshot of the application state at a given height.
[state-sync]

# snapshot-interval specifies the block interval at which local state sync snapshots are
# taken (0 to disable).
snapshot-interval = 1000

# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
snapshot-keep-recent = 2

Providing an RPC Endpoint for Others

The exact way you choose to expose this endpoint is up to you, but it's important to note that state sync does not occur via P2P network discovery so in order for people to utilize your state sync node they must have a direct link to the node.

It's common practice to put your node behind a human-readable URL so it's easier to share with others.

How to Create Snapshots

Serving traditional snapshots is a process in which you save your node's data to a zip file and host it for other node operators to directly download and insert into their node. This enables their nodes to start up from the exact point at which the snapshot was taken.

This means in order to serve snapshots you'll need to:

  1. Take a snapshot of your node
  2. Host and share your snapshot

Taking a snapshot

There are various ways to take a snapshot, as you are simply backing up the state of your node at that point in time. Here is an example of how you could do so:

shell
aws s3 sync s3://your_bucket/validator1 $HOME/.berad/data
aws s3 sync s3://your_bucket/validator1 $HOME/.berad/data

Additionally, it's recommended to set this up to be a recurring process such that your snapshots do not need too much additional time in order sync up to the latest state of the chain when used by another node operator.

Hosting a Snapshot

Snapshots can be hosted in various ways and this is up to your discretion. You'll want to find a hosting location that you are comfortable with. Many node operators choose to use cloud providers in order to integrate it directly into their recurring backup system.