Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

prysmaticlabs/prysmaticlabs.gitbook.io

Repository files navigation

description
This guide outlines the process of installing the Prysm testnet as well as depositing the Göerli ETH required to fully participate as a validator in the network.

Getting Started with Prysm

This documentation portal is depreciated and no longer maintained. Please visit docs.prylabs.network for the most recent iteration.

Need assistance?

If you have questions about this documentation, feel free to stop by either the Prysmatic Discord's #documentation channel or our Gitter and a member of the team or the community will be happy to assist you.

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

Ensure you are running the most recent version of Docker by issuing the command:

docker -v

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

Open a terminal window. Ensure you are running the most recent version of Bazel by issuing the command:

bazel version

Clone Prysm's main repository and enter the directory:

git clone https://github.com/prysmaticlabs/prysm
cd prysm

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.

{% hint style="info" %} 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. {% endhint %}

Running via Docker

Docker on Linux/Mac:

To start your beacon node, issue the following command (it is recommended to also include the --p2p-host-ip and --min-peers (set to 7) flags to improve peering):

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 to container (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 (it is recommended to also include the --p2p-host-ip and --min-peers (set to 7) flags to improve peering):
docker run -it -v c:/prysm/:/data -p 4000:4000 -p 13000:13000 gcr.io/prysmaticlabs/prysm/beacon-chain:latest --datadir=/dat --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.

{% hint style="warning" %} 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. {% endhint %}

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 -- \
--bootstrap-node= \
--deposit-contract 0xD775140349E6A5D12524C6ccc3d6A1d4519D4029 \
--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 our linter, make sure you have golangci-lint installed and then issue the command:

golangci-lint run