2.3 KiB
2.3 KiB
Simple Local Testnet
This guide is about running your own private local testnet.
- If you wish to join the ongoing public testnet, please read become a validator.
This guide will help you setup your own private local testnet.
First, install Lighthouse.
Then, get the current unix time in seconds; you can use
epochconverter.com or $ date +%s. It
should look like this 1576803034 and you should use it wherever we put
<time>.
If you choose a time that's more than several minutes in the past the validator client will refuse to produce blocks. We will loosen this restriction in the future, the issue is tracked here.
Starting a beacon node
Start a new node with:
$ lighthouse bn --http testnet -r quick 8 <time>
Notes:
- The
--httpflag starts the API so the validator can produce blocks.- The
-rflag creates a random data directory to avoid clashes with other nodes.8is number of validators with deposits in the genesis state.- See
$ lighthouse bn testnet --helpfor more configuration options, includingminimal/mainnetspecification.
Starting a validator client
In a new terminal window, start the validator client with:
$ lighthouse vc testnet insecure 0 8
Notes:
- 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 by starting a new terminal and running:
lighthouse bn -z --libp2p-addresses /ip4/127.0.0.1/tcp/9000 testnet -r quick 8 <time>
Notes:
- The
z(or--zero-ports) flag sets all listening ports to be zero, which then means that the OS chooses random available ports. This avoids port collisions with the first node.- The
--libp2p-addressesflag instructs the new node to connect to the first node.