* Fix issues with testnet dir, update docs * Remove "simple testnet" docs * Tear out old "bn testnet" stuff * Add back ClientGenesis::Interop * Tidy * Remove lighthouse-bootstrap module * Fix bug with spec constant mismatch * Ensure beacon-node.toml is written to correct dir * Add -t alias for --testnet-dir * Update book/src/local-testnets.md Co-Authored-By: Age Manning <Age@AgeManning.com> * Add --purge CLI flag * Update purge docs * Perform manual delete of files in purge * Rename --purge to --purge-db * Address Michael's comments Co-authored-by: Age Manning <Age@AgeManning.com>
3.5 KiB
Local Testnets
This section is about running your own private local testnets.
- If you wish to join the ongoing public testnet, please read become a validator.
It is possible to create local, short-lived Lighthouse testnets that don't require a deposit contract and Eth1 connection. There are two components required for this:
- Creating a "testnet directory", containing the configuration of your new testnet.
- Using the
--dummy-eth1flag on your beacon node to avoid needing an Eth1 node for block production.
There is a TL;DR (too long; didn't read), followed by detailed steps if the TL;DR isn't adequate.
TL;DR
lcli new-testnet
lcli interop-genesis 128
lighthouse bn --testnet-dir ~/.lighthouse/testnet --dummy-eth1 --http
lighthouse vc --testnet-dir ~/.lighthouse/testnet --allow-unsynced testnet insecure 0 128
Optionally update the genesis time to now:
lcli change-genesis-time ~/.lighthouse/testnet/genesis.ssz $(date +%s)
1. Creating a testnet directory
1.1 Install lcli
This guide requires lcli, the "Lighthouse CLI tool". It is a development tool
used for starting testnets and debugging.
Install lcli from the root directory of this repository with:
cargo install --path lcli --force
1.2 Create a testnet directory
The default location for a testnet directory is ~/.lighthouse/testnet. We'll
use this directory to keep the examples simple, however you can always specify
a different directory using the --testnet-dir flag.
Once you have lcli installed, create a new testnet directory with:
lcli new-testnet
- This will create a "mainnet" spec testnet. To create a minimal spec use
lcli --spec minim new-testnet.- The
lcli new-testnetcommand has many options, uselcli new-testnet --helpto see them.
1.3 Create a genesis state
Your new testnet directory at ~/.lighthouse/testnet doesn't yet have a
genesis state (genesis.ssz). Since there's no deposit contract in this
testnet, there's no way for nodes to find genesis themselves.
Manually create an "interop" genesis state with 128 validators:
lcli interop-genesis 128
- A custom genesis time can be provided with
-t.- See
lcli interop-genesis --helpfor more info.
2. Start the beacon nodes and validator clients
Now the testnet has been specified in ~/.lighthouse/testnet, it's time to
start a beacon node and validator client.
2.1 Start a beacon node
Start a beacon node:
lighthouse bn --testnet-dir ~/.lighthouse/testnet --dummy-eth1 --http
--testnet-dirinstructs the beacon node to use the spec we generated earlier.--dummy-eth1uses deterministic "junk data" for linking to the eth1 chain, avoiding the requirement for an eth1 node. The downside is that new validators cannot be on-boarded after genesis.--httpstarts the REST API so the validator client can produce blocks.
2.2 Start a validator client
Once the beacon node has started and begun trying to sync, start a validator client:
lighthouse vc --testnet-dir ~/.lighthouse/testnet --allow-unsynced testnet insecure 0 128
--testnet-dirinstructs the validator client to use the spec we generated earlier.--allow-unsyncedstops the validator client checking to see if the beacon node is synced prior to producing blocks.testnet insecure 0 128instructs the validator client to use insecure testnet private keys and that it should control validators from0to127(inclusive).