Skip to content

Starting a test parallel network from an existing ledger state

Elliot Lee edited this page Mar 7, 2023 · 1 revision

For testing purposes, it may be useful to start a new network, but start from an existing ledger state.

  1. Run a server connected to the network that you want to clone.
  2. Copy the db to all of the validators on the new/private network.
  • You can start rippled with: rippled --ledger <ledger hash>.
  • When rippled is running, the server_info request returns a response with a result.info.complete_ledgers field.
  • fast_load=1 in the [node_db] config section is supposed to load the last ledger regardless of which one it is.

If the ledger does not advance:

  • Use a unique [node_seed] in each node's config file.

  • Start with --valid along with --ledger <hash>.

  • Consider [peer_private] 1. It keeps random connections out, which can be helpful for a private net. Also, having a specific [network_id] is good because that puts a cookie in every peer message that identifies the network. It's an integer, so conflict is possible, but it also helps make the network closed off.

Note that having fast_load = 1 in the config is similar to using --load when starting the service. It loads the last ledger in the database, just like --load, and then it reads from disk in parallel. This makes it faster to sync to the network.

  • Consider deleting: wallet.db, peerfinder.sqlite.
  • Add [fast_load].

Here are some steps to try:

  1. Have a server sync'd to the Mainnet (or desired network) and shut down rippled.
  2. In the DB directory, remove wallet.db and peerfinder.sqlite and then create a tar file that can be copied around.
  3. Extract the database to each node in the test network.

This assumes that you have the test network already configured so that they can see each other with things like ips_fixed and the UNL configured. This is important; if the network doesn't work with a generic ledger from scratch, then it won't work with a ledger copied from the Mainnet. You'll save trouble-shooting steps if you configure the network first and have it bring up a genesis ledger. Then, once you have that, shut it down, delete the data and copy the Mainnet data to it.

Start rippled on each node at the same time. They'll sync up to each other in a few minutes.

  • Set up a unique [node_seed] in each node's config file; this mostly has the same effect as deleting wallet.db.

  • Set up [peer_private], which could have a similar effect as deleting peerfinder.sqlite.

  • Start rippled with a --ledger hash and the --valid option.

  • Have fast_load configured anyway, to save time on startup.