Go to file
shayzluf 0df12261a1
slasher retrieve and cache validator public key (#5220)
* cache and retrieval of validator public keys

* fix comments

* fix comment

* fix variables

* gaz

* ivan feedback fixes

* goimports

* fix test

* comments on in line slice update

Co-authored-by: terence tsao <terence@prysmaticlabs.com>
2020-04-02 06:08:23 +03:00
.github Create FUNDING.yml (#2800) 2019-06-17 01:49:06 -04:00
.well-known add security file (#2662) 2019-05-20 12:55:38 -04:00
beacon-chain Release Skip Slot Cache to All (#5280) 2020-04-01 19:09:54 -07:00
contracts Fix typos and inconsistencies (#4453) 2020-01-07 20:36:55 -06:00
docs Update READINGS.md (#3832) 2019-10-24 10:11:03 +08:00
endtoend Release Skip Slot Cache to All (#5280) 2020-04-01 19:09:54 -07:00
proto Productionization new state service part 1 (#5230) 2020-03-27 13:28:38 -07:00
scripts Fix go pbs (#4626) 2020-01-23 16:03:11 +05:30
shared Release Skip Slot Cache to All (#5280) 2020-04-01 19:09:54 -07:00
slasher slasher retrieve and cache validator public key (#5220) 2020-04-02 06:08:23 +03:00
third_party Add configurations for BLS builds (#5254) 2020-03-31 01:58:27 +00:00
tools Micro optimizations on new-state-mgmt service for initial syncing (#5241) 2020-03-30 17:10:45 -05:00
validator Enable slashing protection in validator by default (#5278) 2020-04-01 23:17:32 +00:00
.bazelrc Debug: add cgo symbolizer (#5255) 2020-03-30 20:20:27 -07:00
.bazelversion Create .bazelversion (#5003) 2020-03-04 21:49:22 +00:00
.buildkite-bazelrc Buildkite changes (#5178) 2020-03-23 19:00:37 +00:00
.codecov.yml Update codecov to ignore generated code (#2794) 2019-06-12 10:45:17 -04:00
.dockerignore Add tool and script for interop testing (#3417) 2019-09-09 17:31:19 -04:00
.gitattributes linguist-generated=true for mock and pb go files (#1465) 2019-02-02 17:25:28 -05:00
.gitignore Debug: add cgo symbolizer (#5255) 2020-03-30 20:20:27 -07:00
.golangci.yml upgrading linter from gometalinter to golangci-lint (#2100) 2019-04-26 14:24:01 +08:00
.travis.yml Resolve Proto Lint Issues (#3044) 2019-07-22 14:10:17 -05:00
bazel.sh Update bazel.sh (#5028) 2020-03-06 17:43:06 +00:00
BUILD.bazel Kafka exporter (#3840) 2019-12-06 02:05:58 +00:00
CONTRIBUTING.md Update CONTRIBUTING.md (#2679) 2019-05-23 06:30:00 -07:00
interop.Dockerfile Add tool and script for interop testing (#3417) 2019-09-09 17:31:19 -04:00
INTEROP.md Update docs for keymanager (#4651) 2020-01-25 06:25:58 -08:00
LICENSE.md update to GPLv3 (#297) 2018-07-20 10:23:48 -05:00
nogo_config.json Nogo fix for mac (#3043) 2019-07-22 07:39:37 -07:00
prysm.sh Add prysm.sh script (#5042) 2020-03-09 12:19:53 -05:00
PULL_REQUEST_TEMPLATE.md Update All Our Documentation (#2012) 2019-03-17 16:30:46 -06:00
README.md Replace no-genesis-delay with custom-genesis-delay (#4678) 2020-01-28 21:07:43 +00:00
renovate.json Update renovate.json (#3780) 2019-10-14 15:23:20 -07:00
service-account.json.enc Bazel cache for travis (#236) 2018-07-07 16:01:58 -04:00
TESTNET.md Update TESTNET.md (#3831) 2019-10-23 17:53:33 +08:00
VERSION Spec freeze updates (#2312) 2019-07-19 19:16:10 -05:00
WORKSPACE Debug: add cgo symbolizer (#5255) 2020-03-30 20:20:27 -07:00

Prysm: An Ethereum 2.0 Client Written in Go

Build status ETH2.0_Spec_Version 0.9.3 Discord Gitter

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

Prysm can be installed either with Docker (recommended) 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
  • The latest release of cmake
  • The latest release of git
  • A modern UNIX operating system macOS included

Installing Prysm

Build via Docker

  1. Ensure you are running the most recent version of Docker by issuing the command:
docker -v
  1. To pull the Prysm images, 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

  1. Open a terminal window. Ensure you are running the most recent version of Bazel by issuing the command:
bazel version
  1. Clone Prysm's main repository and enter the directory:
git clone https://github.com/prysmaticlabs/prysm
cd prysm
  1. Build both the beacon chain node 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.

Connecting to the testnet: running a beacon node

Below are instructions for initialising a beacon node and connecting to the public testnet. To further understand the role that the beacon node plays in Prysm, see this section of the documentation.

NOTE: It is recommended to open up port 13000 on your local router to improve connectivity and receive more peers from the network. To do so, navigate to 192.168.0.1 in your browser and login if required. Follow along with the interface to modify your routers firewall settings. When this task is completed, append the parameter--p2p-host-ip=$(curl -s ident.me) to your selected beacon startup command presented in this section to use the newly opened port.

Running via Docker

Docker on Linux/macOS:

To start your beacon node, issue the following command:

docker run -it -v $HOME/prysm:/data -p 4000:4000 -p 13000:13000 --name beacon-node \
  gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
  --datadir=/data

The beacon node can be halted by either using Ctrl+c or with the command:

docker stop beacon-node

To restart the beacon node, issue the following command:

docker start -ai beacon-node

To delete a corrupted container, issue the following command:

docker rm beacon-node

To recreate a deleted container and refresh the chain database, issue the start command with an additional --clear-db parameter:

docker run -it -v $HOME/prysm:/data -p 4000:4000 -p 13000:13000 --name beacon-node \
  gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
  --datadir=/data \
  --clear-db

Docker on Windows:

  1. You will need to 'share' the local drive you wish to mount to e.g. C:.

    1. Enter Docker settings right click the tray icon
    2. Click 'Shared Drives'
    3. Select a drive to share
    4. Click 'Apply'
  2. You will next need to create a directory named /prysm/ 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 that C: is your prior-selected shared Drive.

  3. To run the beacon node, issue the following command:

docker run -it -v c:/prysm/:/data -p 4000:4000 -p 13000:13000 --name beacon-node gcr.io/prysmaticlabs/prysm/beacon-chain:latest --datadir=/data --clear-db

Running via Bazel

To start your Beacon Node with Bazel, issue the following command:

bazel run //beacon-chain -- --clear-db --datadir=$HOME/prysm

This will sync up the beacon node with the latest head block in the network.

NOTE: 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 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 a validator deposit contract in order to activate your validator discussed in the section below. First though, you will need to create this validator and connect to this node to participate in consensus.

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.

Activating your validator: depositing 3.2 Göerli ETH

To begin setting up a validator, follow the instructions found on prylabs.net to use the Göerli ETH faucet and make a deposit. For step-by-step assistance with the deposit page, see the Activating a Validator section of this documentation.

It will take a while for the nodes in the network to process a deposit. Once the node is active, the validator will immediately begin performing its responsibilities.

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, a validator will start gradually losing its deposit until it is removed from the network entirely.

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 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 generate a beacon genesis state and initiate Prysm with 64 validators with the genesis time set to your machines UNIX time.

Open up two terminal windows. In the first, issue the command:

bazel run //beacon-chain -- \
--custom-genesis-delay=0 \
--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 -- --keymanager=interop --keymanageropts='{"keys":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 our linter, make sure you have golangci-lint installed and then issue the command:

golangci-lint run

Contributing

Want to get involved? Check out our Contribution Guide to learn more!

License

GNU General Public License v3.0