2.7 KiB
2.7 KiB
Simple Local Testnet
You can setup a local, two-node testnet in Only Three CLI Commands™.
Follow the Quick instructions version if you're confident, or see Detailed instructions for more.
Quick instructions
Setup a development environment, build the project and navigate to the
target/release directory.
- Start the first node:
$ ./beacon_node testnet -f recent 8 - Start a validator client:
$ ./validator_client testnet -b insecure 0 8 - Start another node
$ ./beacon_node -b 10 testnet -f bootstrap http://localhost:5052
Repeat #3 to add more nodes.
Detailed instructions
First, setup a Lighthouse development environment and navigate to the
target/release directory (this is where the binaries are located).
Starting the Beacon Node
Start a new node (creating a fresh database and configuration in ~/.lighthouse), using:
$ ./beacon_node testnet -f recent 8
Notes:
- The
-fflag ignores any existing database or configuration, backing them up before re-initializing.8is number of validators with deposits in the genesis state.- See
$ ./beacon_node testnet recent --helpfor more configuration options, includingminimal/mainnetspecification.
Starting the Validator Client
In a new terminal window, start the validator client with:
$ ./validator_client testnet -b insecure 0 8
Notes:
- The
-bflag means the validator client will "bootstrap" specs and config from the beacon node.- The
insecurecommand uses predictable, well-known private keys. Since this is just a local testnet, these are fine.- The
0 8indicates that this validator client should manage 8 validators, starting at validator 0 (the first deposited validator).- The validator client will try to connect to the beacon node at
localhost. See--helpto configure that address and other features.
Adding another Beacon Node
You may connect another (non-validating) node to your local network using the
lighthouse bootstrap command.
In a new terminal terminal, run:
$ ./beacon_node -b 10 testnet -r bootstrap
Notes:
- The
-b(or--port-bump) increases all the listening TCP/UDP ports of the new node to10higher. Your first node's HTTP server was at TCP5052but this one will be at5062.- The
-rflag creates a new data directory with a random string appended (avoids data directory collisions between nodes).- The default bootstrap HTTP address is
http://localhost:5052. The new node will download configuration via HTTP before starting sync via libp2p.- See
$ ./beacon_node testnet bootstrap --helpfor more configuration.