Go to file
2019-04-27 21:56:28 -05:00
.github Add config for probot stale bot (#1349) 2019-01-19 10:30:49 -05:00
beacon-chain Use HTTP for On Demand Block Requests (#2405) 2019-04-27 14:45:13 -05:00
contracts Fix bash scripts for initializing beacon-chain (#2080) 2019-04-02 15:45:40 -05:00
docs Update All Our Documentation (#2012) 2019-03-17 16:30:46 -06:00
k8s allow CORS from anywhere (#2375) 2019-04-24 15:57:06 -05:00
proto P2P handshake handling (#2306) 2019-04-27 14:08:27 -05:00
scripts Validator-multiple key (#2069) 2019-04-18 12:23:38 -05:00
shared Add a temporary commenting for issue #2408 (#2409) 2019-04-27 21:56:28 -05:00
tools Add nogo to introduce built time linting (#2317) 2019-04-21 22:14:34 +08:00
validator Added flag to disable rewards/penatlty logging (#2319) 2019-04-27 11:56:11 +08:00
.buildkite-bazelrc Remote caching with GCP (#2294) 2019-04-18 16:29:09 -05:00
.codecov.yml Adding Basic Private Key Management (#671) 2018-11-08 11:22:31 +08:00
.gitattributes linguist-generated=true for mock and pb go files (#1465) 2019-02-02 17:25:28 -05:00
.gitignore Validator: performing for multiple keys - update rpc proto (#2040) 2019-03-23 19:46:25 -05:00
.golangci.yml upgrading linter from gometalinter to golangci-lint (#2100) 2019-04-26 14:24:01 +08:00
.soliumignore Moving solidity lint check to bazel / buildkite (#629) 2018-10-07 13:20:59 -04:00
.soliumrc.json Update Registration Contract in Solidity (#996) 2018-11-30 07:12:23 -08:00
.travis.yml upgrading linter from gometalinter to golangci-lint (#2100) 2019-04-26 14:24:01 +08:00
BUILD.bazel Prevent Canceling Goroutines in Validator Client (#2324) 2019-04-21 16:49:57 -04:00
CONTRIBUTING.md Update All Our Documentation (#2012) 2019-03-17 16:30:46 -06:00
LICENSE.md update to GPLv3 (#297) 2018-07-20 10:23:48 -05:00
nogo_config.json Prevent Canceling Goroutines in Validator Client (#2324) 2019-04-21 16:49:57 -04:00
package.json Major Renovate Updates (#2264) 2019-04-15 18:32:59 +08:00
PULL_REQUEST_TEMPLATE.md Update All Our Documentation (#2012) 2019-03-17 16:30:46 -06:00
README.md upgrading linter from gometalinter to golangci-lint (#2100) 2019-04-26 14:24:01 +08:00
renovate.json Update renovate.json (#1965) 2019-03-11 11:04:14 -04:00
service-account.json.enc Bazel cache for travis (#236) 2018-07-07 16:01:58 -04:00
WORKSPACE Update Jaeger Export Tracing (#2382) 2019-04-25 10:59:18 -05:00
yarn.lock Major Renovate Updates (#2264) 2019-04-15 18:32:59 +08:00

Prysmatic Labs Ethereum Serenity Implementation

Build status

This is the main repository for the Go implementation of the Ethereum 2.0 Serenity 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 Roadmap Reference Implementation Doc. This doc provides a background on the milestones we aim for the project to achieve.

Table of Contents

Installation

You can either choose to run our system via:

  • Use Our Build Tool, Bazel (Recommended)
  • Use Docker

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

You can prepare our entire repo for a local build by simply running:

bazel build //...

Deploying a Validator Deposit Contract

If you want to run our system locally, you'll need to have a Validator Deposit Contract deployed on the Goerli Ethereum 1.0 testnet. You'll need to acquire some Goerli ETH first and then you can easily deploy our deposit contract with Bazel:

bazel run //contracts/deposit-contract/deployContract -- --httpPath=https://goerli.prylabs.net
 --privKey=${YOUR_GOERLI_PRIV_KEY}

You'll see the deposit contract address printed out, which we'll use when running our Eth 2.0 beacon nodes below:

INFO: Build completed successfully, 1 total action
[2019-03-17 11:54:27]  INFO main: New contract deployed address=0x1be4cbd38AC5b68727dCD2B73fc0553c1832ca42

Copy the address, you'll need it in the next step:

Running The Beacon Chain

To start your beacon node with bazel:

bazel run //beacon-chain -- --deposit-contract=DEPOSIT_CONTRACT_ADDRESS

The chain will then be waiting for the Validator Deposit Contract to reach a deposit threshold before it begins! Now, you'll need to spin up enough validator clients that can reach the threshold with the following next steps:

Running an ETH2.0 Validator Client

Once your beacon node is up, you'll need to attach a validator client as a separate process. Each validator represents 32ETH being staked in the system, so you can spin up as many as you want to have more at stake in the network.

To get started, you'll need to create a new validator account with a unique password and data directory to store your encrypted private keys:

bazel run //validator --\
  accounts create --password YOUR_PASSWORD \
  --keystore-path /path/to/validator/keystore/dir

Once you create your validator account, you'll see a special piece of information printed out below:

[2019-03-17 11:57:55]  INFO accounts: Account creation complete! Copy and paste the deposit data shown below when issuing a transaction into the ETH1.0 deposit contract to activate your validator client

========================Deposit Data=======================

0xbc00000060000000814eb687f39e9a0be79552cd51711dfb1711274a892e4ccae1e61d0bb28ef82c85e81b68b4911f73ca06e6694133c9610a6677d512df7a6a0289ecd1a218a8b2de29fa298c24c9e17dac4d7fb268992e8d08d74fafa076757d28ffa29ea7a36b30000000996e3494661110bf9c72f1bacee84d1b64039092bf1e6856eaf8d87b1a992999d4bff9c3701ded7714e8421c8ec1fd4520000000001e1ba7155f64eda1d1a87f3ed4eaf0280b86bef90b2cd1d9b905e370650251

===========================================================

Keep this deposit data string, as you'll need it in the next section.

bazel run //validator --\
  --password YOUR_PASSWORD \
  --keystore-path /path/to/validator/keystore/dir

This will connect you to your running beacon node and listen for validator 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. To then run the validator, use the command:

Given this is a local network, you'll need to create and run enough validators to reach the deposit contract threshold so your chain can begin.

Depositing 32ETH and Starting the Eth 2.0 Network

Once you launch your beacon chain and validators, your nodes won't do much and will simply listen for the deposit contract to reach a valid threshold. You'll need an Eth 1.0 wallet that can send transactions via the Goerli network such as Metamask loaded with enough Ether to make deposits into the contract. Using the deposit contract address from earlier and your validator deposit data from the previous step, send a transactions with the validator deposit data as the data parameter in your web3 provider such as Metamask to kick things off. Once you make enough deposits, your beacon node will start and your system will begin running the phase 0 beacon chain!

Running Via Docker

docker run -p 4000:4000 -v gcr.io/prysmaticlabs/prysm/beacon-chain:latest \
  --rpc-port 4000 \
  --deposit-contract DEPOSIT_CONTRACT_ADDRESS

Then, to run a validator client, use:

docker run gcr.io/prysmaticlabs/prysm/validator:latest \
  --beacon-rpc-provider http://{YOUR_LOCAL_IP}:4000 \
  --password YOUR_PASSWORD \
  --keystore-path /path/to/your/validator/keystore/dir

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 Under Windows

The best way to run under Windows is to clone the repository and then run the node with go run from the Windows command line. Go 1.10 fails due to documented permission errors so be sure you are running Go 1.11 or later. Go through the source code and resolve any dependencies. Create two empty files for use as data directories by the beacon chain and validator respectively. The contents of these files should be deleted each time you run the software. After cloning the Prsym repository, run the node as follows:

go run ./beacon-chain main.go \
  --deposit-contract DEPOSIT_CONTRACT_ADDRESS

After the beacon chain is up and running, run the validator client as a separate process as follows:

go run ./validator/main.go \
  --password YOUR_PASSWORD \
  --keystore-path /path/to/your/validator/keystore/dir

Testing

To run the unit tests of our system do:

bazel test //...

To run our linter, make sure you have golangci-lint installed and then run:

golangci-lint run

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