Go to file
Preston Van Loon c972925dbd
Buildkite bazel config (#620)
* testing buildkite config for bazel with remote cache on gcp

* Remove remote caching, it's going really slow for some reason with golib
2018-10-03 20:20:57 -04:00
beacon-chain fix shuffle (#611) 2018-10-03 09:08:12 -04:00
contracts Migrate dependencies on @com_github_ethereum_go_ethereum//event (#601) 2018-10-02 21:49:01 -04:00
docs Update Documentation to Reflect Latest Changes, Demo Instructions (#599) 2018-10-02 22:54:35 -05:00
k8s Update Documentation + Create a Subproject for Important Markdown Docs (#451) 2018-09-01 21:25:06 -05:00
proto Validator Assignment RPC Beacon Node Stream (#563) 2018-09-26 21:34:35 -05:00
scripts Pending TODO Script Checker in Codebase (#540) 2018-09-22 18:07:03 -04:00
shared Migrate dependencies on @com_github_ethereum_go_ethereum//event (#601) 2018-10-02 21:49:01 -04:00
validator Migrate dependencies on @com_github_ethereum_go_ethereum//event (#601) 2018-10-02 21:49:01 -04:00
.buildkite-bazelrc Buildkite bazel config (#620) 2018-10-03 20:20:57 -04:00
.gitattributes Merge branch 'master' of github.com:ethereum/go-ethereum 2018-04-06 20:06:43 -04:00
.gitignore Testing Codecov (#375) 2018-08-06 22:58:21 -05:00
.gometalinter.json Add Golint (#344) 2018-07-28 21:18:56 -04:00
.soliumrc.json contracts: Add Solidity Linter to Travis (#376) 2018-08-06 10:12:55 -05:00
.travis-bazelrc Disable sandboxing (#581) 2018-09-26 21:33:21 -04:00
.travis.yml Disable remote caching for now (#612) 2018-10-03 14:28:00 -04:00
BUILD.bazel Add Go tools in bazel (#608) 2018-10-02 22:04:36 -04:00
CONTRIBUTING.md Fixed Broken Markdown links (#483) 2018-09-08 06:50:21 -07:00
genesis.json Validator Client Use Assignment Stream to Determine Responsibility (#566) 2018-09-27 14:46:07 -07:00
LICENSE.md update to GPLv3 (#297) 2018-07-20 10:23:48 -05:00
PULL_REQUEST_TEMPLATE.md Create PULL_REQUEST_TEMPLATE.md (#532) 2018-09-18 12:40:55 +08:00
README.md Update README.md (#615) 2018-10-03 15:33:29 -04:00
service-account.json.enc Bazel cache for travis (#236) 2018-07-07 16:01:58 -04:00
WORKSPACE Add Go tools in bazel (#608) 2018-10-02 22:04:36 -04:00

Prysmatic Labs Ethereum 2.0 Implementation

Travis Build

This is the main repository for the beacon chain and sharding implementation for Ethereum 2.0 Prysmatic Labs.

Before you begin, check out our Contribution Guidelines and join our active chat room on Discord or Gitter below:

Discord Gitter

Also, read our Sharding Reference Implementation Doc. This doc provides a background on the sharding implementation we follow at Prysmatic Labs.

Table of Contents

Running Our Demo Release

To run our current release, v0.0.0, as a local demo, you'll need to run a beacon chain node and a validator client.

In this local demo, you can start a beacon chain from genesis, connect as a validator client through a public key, and propose/vote on beacon blocks during each cycle. For more information on the full scope of the public demo, see the demo information here.

Installation

You can either choose to run our system via:

  • Downloading our Precompiled Binaries from our latest release
  • Use Docker
  • Use Our Build Tool, Bazel (Recommended)

Run Our Pre-Compiled Binaries

First, download our latest release for your operating system. Then:

chmod +x ./beacon-chain
chmod +x ./validator

First, clone our repository:

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

Download the Bazel build tool by Google here and ensure it works by typing:

bazel version

Bazel manages all of the dependencies for you (including go and necessary compilers) so you are all set to build prysm.

Building

Then, build both parts of our system: a beacon chain node implementation, and a validator client:

bazel build //beacon-chain:beacon-chain
bazel build //validator:validator

Running The Beacon Chain

To start the system, we need to seed the beacon chain state with an initial validator set for local development. We created a reference genesis.json in our latest release you can use for this! You'll also need a special data directory where all the beacon chain data will be persisted to.

Then, you can run the node as follows:

With the binary executable:

./beacon-chain \
  --genesis-json /path/to/genesis.json \
  --datadir /path/to/your/datadir \
  --rpc-port 4000 \
  --simulator \
  --demo-config

With bazel:

bazel run //beacon-chain --\
  --genesis-json /path/to/genesis.json \
  --datadir /path/to/your/datadir \
  --rpc-port 4000 \
  --simulator \
  --demo-config

We added a --simulator flag that simulates other nodes connected to you sending your node blocks for processing. Given this is a local development version and you'll only be running 1 validator client, this gives us a good idea of what the system will need to handle in the wild and will help advance the chain.

We also have a --demo-config flag that configures some internal parameters for you to run a local demo version of the system.

If you want to see what's happening in the system underneath the hood, add a --verbosity debug flag to show every single thing the beacon chain node does during its run time. If you want to rerun the beacon chain, delete and create a new data directory for the system to start from scratch.

beaconsystem

Running an ETH2.0 Validator Client

Once your beacon node is up, you'll need to attach a validator client as a separate process. This validator is in charge of running Casper+Sharding responsibilities (shard state execution to be designed in phase 2). This validator will listen for incoming beacon blocks and shard assignments and determine when its time to perform attester/proposer responsibilities accordingly.

To get started, you'll need to use a public key from the initial validator set of the beacon node. Here are a few you can try out:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

Run as follows:

With the binary executable:

./validator \
  --beacon-rpc-provider http://localhost:4000 \
  --datadir /path/to/uniquevalidatordatadir \
  --pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

With Bazel:

bazel run //validator --\
  --beacon-rpc-provider http://localhost:4000 \
  --datadir /path/to/uniquevalidatordatadir \
  --pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

This will connect you to your running beacon node and listen for shard/slot assignments! The beacon node will update you at every cycle transition and shuffle your validator into different shards and slots in order to vote on or propose beacon blocks.

if you want to run multiple validator clients, each one needs to have its own data directory where it will persist information, so create a new one each time and pass it into the validator command with the flag --datadir /path/to/validatordatadir.

Running Via Docker

docker run -p 4000:4000 -v /path/to/genesis.json:/genesis.json gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
  --genesis-json /genesis.json \
  --rpc-port 4000 \
  --simulator \
  --demo-config

Then, to run a validator client, use:

docker run gcr.io/prysmaticlabs/prysm/validator:latest \
  --beacon-rpc-provider http://{YOUR_LOCAL_IP}:4000 \
  --pubkey CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC

This will connect you to your running beacon node and listen for shard/slot assignments! The beacon node will update you at every cycle transition and shuffle your validator into different shards and slots in order to vote on or propose beacon blocks.

Running While Connected to a Mainchain Ethereum 1.0 Node

If you want to run the system with a real Web3 endpoint to listen for incoming Ethereum 1.0 block hashes, follow the instructions on setting up a geth node here.

Testing

To run the unit tests of our system do:

bazel test //...

To run our linter, make sure you have gometalinter installed and then run:

gometalinter ./...

Contributing

We have put all of our contribution guidelines into CONTRIBUTING.md! Check it out to get started.

nyancat

License

GNU General Public License v3.0