fb431c11c1
* skip process slot if it's same slots * Merge branch 'master' into optimize-process-slots * Merge refs/heads/master into optimize-process-slots |
||
---|---|---|
.github | ||
.well-known | ||
beacon-chain | ||
contracts | ||
docs | ||
endtoend | ||
proto | ||
scripts | ||
shared | ||
slasher | ||
third_party | ||
tools | ||
validator | ||
.bazelrc | ||
.buildkite-bazelrc | ||
.codecov.yml | ||
.dockerignore | ||
.gitattributes | ||
.gitignore | ||
.golangci.yml | ||
.travis.yml | ||
BUILD.bazel | ||
CONTRIBUTING.md | ||
interop.Dockerfile | ||
INTEROP.md | ||
LICENSE.md | ||
nogo_config.json | ||
PULL_REQUEST_TEMPLATE.md | ||
README.md | ||
renovate.json | ||
service-account.json.enc | ||
TESTNET.md | ||
VERSION | ||
WORKSPACE |
Prysm: An Ethereum 2.0 Client Written in Go
This is the core repository for Prysm, a Golang implementation of the Ethereum 2.0 client specifications developed by Prysmatic Labs.
Need assistance?
A more detailed set of installation and usage instructions as well as breakdowns of each individual component are available in the official documentation portal. If you still have questions, feel free to stop by either our Discord or Gitter and a member of the team or our community will be happy to assist you.
Come join the testnet!
Participation is now open to the public for our Ethereum 2.0 phase 0 testnet release. Visit prylabs.net for more information on the project or to sign up as a validator on the network.
Table of Contents
- Dependencies
- Installation
- Connecting to the public testnet: running a beacon node
- Staking ETH: running a validator client
- Setting up a local ETH2 development chain
- Testing Prysm
- Contributing
- License
Dependencies
Prysm can be installed either with Docker (recommended method) or using our build tool, Bazel. The below instructions include sections for performing both.
For Docker installations:
- The latest release of Docker
For Bazel installations:
- The latest release of Bazel
- A modern UNIX operating system (MacOS included)
Installation
Build via Docker
- Ensure you are running the most recent version of Docker by issuing the command:
docker -v
- To pull the Prysm images from the server, issue the following commands:
docker pull gcr.io/prysmaticlabs/prysm/validator:latest
docker pull gcr.io/prysmaticlabs/prysm/beacon-chain:latest
This process will also install any related dependencies.
Build via Bazel
- Open a terminal window. Ensure you are running the most recent version of Bazel by issuing the command:
bazel version
- Clone this repository and enter the directory:
git clone https://github.com/prysmaticlabs/prysm
cd prysm
- Build both the beacon chain node implementation and the validator client:
bazel build //beacon-chain:beacon-chain
bazel build //validator:validator
Bazel will automatically pull and install any dependencies as well, including Go and necessary compilers.
- Build the configuration for the Prysm testnet by issuing the commands:
bazel build --define ssz=minimal //beacon-chain:beacon-chain
bazel build --define ssz=minimal //validator:validator
The binaries will be built in an architecture-dependent subdirectory of bazel-bin
, and are supplied as part of Bazel's build process. To fetch the location, issue the command:
$ bazel build --define ssz=minimal //beacon-chain:beacon-chain
...
Target //beacon-chain:beacon-chain up-to-date:
bazel-bin/beacon-chain/linux_amd64_stripped/beacon-chain
...
In the example above, the beacon chain binary has been created in bazel-bin/beacon-chain/linux_amd64_stripped/beacon-chain
.
Connecting to the testnet: running a beacon node
This section contains instructions for initialising a beacon node and connecting to the public testnet. To further understand the role that both the beacon node and validator play in Prysm, see this section of our documentation.
Running via Docker
Docker on Linux/Mac
To start your beacon node, issue the following command:
docker run -v $HOME/prysm-data:/data -p 4000:4000 \
--name beacon-node \
gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--no-genesis-delay \
--datadir=/data
(Optional) If you want to enable gRPC, then run this command instead of the one above:
docker run -v $HOME/prysm-data:/data -p 4000:4000 -p 7000:7000 \
--name beacon-node \
gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--datadir=/data \
--no-genesis-delay \
--grpc-gateway-port=7000
You can halt the beacon node using Ctrl+c
or with the following command:
docker stop beacon-node
To restart the beacon node, issue the command:
docker start -ai beacon-node
To delete a corrupted container, issue the command:
docker rm beacon-node
To recreate a deleted container and refresh the chain database, issue the start command with an additional --force-clear-db
parameter:
docker run -it -v $HOME/prysm-data:/data -p 4000:4000 --name beacon-node \
gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
--datadir=/data \
--force-clear-db
Docker on Windows
-
You will need to share the local drive you wish to mount to to container (e.g. C:).
- Enter Docker settings (right click the tray icon)
- Click 'Shared Drives'
- Select a drive to share
- Click 'Apply'
-
You will next need to create a directory named
/tmp/prysm-data/
within your selected shared Drive. This folder will be used as a local data directory for Beacon Node chain data as well as account and keystore information required by the validator. Docker will not create this directory if it does not exist already. For the purposes of these instructions, it is assumed thatC:
is your prior-selected shared Drive. -
To run the beacon node, issue the command:
docker run -it -v c:/tmp/prysm-data:/data -p 4000:4000 gcr.io/prysmaticlabs/prysm/beacon-chain:latest --datadir=/data
Running via Bazel
- To start your Beacon Node with Bazel, issue the command:
bazel run //beacon-chain -- --datadir=/tmp/prysm-data
This will sync up the Beacon Node with the latest head block in the network. Note that the beacon node must be completely synced before attempting to initialise a validator client, otherwise the validator will not be able to complete the deposit and funds will be lost.
Staking ETH: running a validator client
Once your beacon node is up, the chain will be waiting for you to deposit 3.2 Goerli ETH into the Validator Deposit Contract to activate your validator (discussed in the section below). First though, you will need to create a validator client to connect to this node in order to stake and participate. Each validator represents 3.2 Goerli ETH being staked in the system, and it is possible to spin up as many as you desire in order to have more stake in the network.
For more information on the functionality of validator clients, see this section of our official documentation.
Activating your validator: depositing 3.2 Goerli ETH
Using your validator deposit data from the previous step, follow the instructions found on https://prylabs.net/participate to make a deposit.
It will take a while for the nodes in the network to process your deposit, but once your node is active, the validator will begin doing its responsibility. In your validator client, you will be able to frequently see your validator balance as it goes up over time. Note that, should your node ever go offline for a long period, you'll start gradually losing your deposit until you are removed from the system.
Starting the validator with Bazel
- Open another terminal window. Enter your Prysm directory and run the validator by issuing the following command:
cd prysm
bazel run //validator
Congratulations, you are now running Ethereum 2.0 Phase 0!
Setting up a local ETH2 development chain
This section outlines the process of setting up Prysm for local interop testing with other Ethereum 2.0 client implementations. See the INTEROP.md file for advanced configuration options. For more background information on interoperability development, see this blog post.
Installation and dependencies
To begin setting up a local ETH2 development chain, follow the Bazel instructions found in the dependencies and installation sections respectively.
Running a local beacon node and validator client
The example below will deterministically generate a beacon genesis state, initiate Prysm with 64 validators and set the genesis time to your local machines current UNIX time.
- Open up two terminal windows. In the first, issue the command:
bazel run //beacon-chain -- \
--no-genesis-delay \
--bootstrap-node= \
--deposit-contract $(curl https://prylabs.net/contract) \
--clear-db \
--interop-num-validators 64 \
--interop-eth1data-votes
- Wait a moment for the beacon chain to start. In the other terminal, issue the command:
bazel run //validator -- --interop-num-validators 64
This command will kickstart the system with your 64 validators performing their duties accordingly.
Testing Prysm
To run the unit tests of our system, issue the command:
bazel test //...
To run the linter, ensure you have golangci-lint installed, then issue the command:
golangci-lint run
Contributing
Want to get involved? Check out our Contribution Guide to learn more!