lighthouse-pulse/scripts/local_testnet
Pawan Dhananjay d3b4cbed53 Packet filter cli option (#2523)
## Issue Addressed

N/A

## Proposed Changes

Adds a cli option to disable packet filter in `lighthouse bootnode`. This is useful in running local testnets as the bootnode bans requests from the same ip(localhost) if the packet filter is enabled.
2021-08-26 00:29:39 +00:00
..
beacon_node.sh Packet filter cli option (#2523) 2021-08-26 00:29:39 +00:00
bootnode.sh Packet filter cli option (#2523) 2021-08-26 00:29:39 +00:00
clean.sh Update testnet scripts (#1807) 2020-10-23 00:18:05 +00:00
ganache_test_node.sh Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
README.md Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
reset_genesis_time.sh Update local testnet scripts, fix eth1 sim (#1184) 2020-05-26 18:30:44 +10:00
setup.sh Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00
validator_client.sh Doppelganger detection (#2230) 2021-07-31 03:50:52 +00:00
vars.env Altair validator client and HTTP API (#2404) 2021-08-06 00:47:31 +00:00

Simple Local Testnet

These scripts allow for running a small local testnet with multiple beacon nodes and validator clients. This setup can be useful for testing and development.

Requirements

The scripts require lcli and lighthouse to be installed on PATH. From the root of this repository, run:

make
make install-lcli

Starting the testnet

Start a local eth1 ganache server

./ganache_test_node.sh

Assuming you are happy with the configuration in var.env, deploy the deposit contract, make deposits, create the testnet directory, genesis state and validator keys with:

./setup.sh

Generate bootnode enr and start a discv5 bootnode so that multiple beacon nodes can find each other

./bootnode.sh

Start a beacon node:

./beacon_node.sh <DATADIR> <NETWORK-PORT> <HTTP-PORT> <OPTIONAL-DEBUG-LEVEL>

e.g.

./beacon_node.sh $HOME/.lighthouse/local-testnet/node_1 9000 8000

In a new terminal, start the validator client which will attach to the first beacon node:

./validator_client.sh <DATADIR> <BEACON-NODE-HTTP> <OPTIONAL-DEBUG-LEVEL>

e.g. to attach to the above created beacon node

./validator_client.sh $HOME/.lighthouse/local-testnet/node_1 http://localhost:8000

You can create additional beacon node and validator client instances with appropriate parameters.

Additional Info

Adjusting number and distribution of validators

The VALIDATOR_COUNT parameter is used to specify the number of insecure validator keystores to generate and make deposits for. The NODE_COUNT parameter is used to adjust the division of these generated keys among separate validator client instances. For e.g. for VALIDATOR_COUNT=80 and NODE_COUNT=4, the validator keys are distributed over 4 datadirs with 20 keystores per datadir. The datadirs are located in $DATADIR/node_{i} which can be passed to separate validator client instances using the --datadir parameter.

Starting fresh

Delete the current testnet and all related files using:

./clean.sh

Updating the genesis time of the beacon state

If it's been a while since you ran ./setup then the genesis time of the genesis state will be far in the future, causing lots of skip slots.

Update the genesis time to now using:

./reset_genesis_time.sh

Note: you probably want to drop the beacon node database and the validator client slashing database if you do this. When using small validator counts it's probably easy to just use ./clean.sh && ./setup.sh.