yace132 / lodestar

🌟 Ethereum 2.0: TypeScript Implementation of the Beacon Chain

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ChainSafe ETH2.0 Projects

Note: There is a lot of work being done that are core infrastructural pieces for Eth2.0. Contributions to any of the below repositories would be greatly appreciated. All the libraries are written in TypeScript (or in the process of being converted from pure JS to TypeScript):
-- PM / Meta Repo
|-- Beacon Chain
|-- Validator Client
|-- Simple Serialize (SSZ)
|-- BLS Signatures and Signature Aggregation
|-- Hobbits
|-- Gossipsub

Discord codecov Maintainability ETH2.0_Spec_Version 0.8.1

Overview

The goal of this repository is to provide an implementation of the beacon chain. As even the Ethereum Core dev team don't know how the finalized beacon chain will be implemented, this is our contribution to the effort to transitioning Ethereum from a PoW blockchain to a PoS blockchain.

What you need

You will need to go over the specification. You will also need to have a basic understanding of sharding. Note that that the specification is an ongoing document and will get outdated. The reference implementation by the Ethereum development team is written in Python and can be found here.

Run

  1. yarn install
  2. git submodule foreach git lfs pull
  3. yarn test

Note: to run spec tests execute git submodules foreach git lfs pull

Generating flame graphs from spec tests

Example of cpu-profile generation of blocksanity tests in current directory

GEN_PROFILE_DIR=$PWD mocha -r ./.babel-register 'test/spec/sanity/blocks/blocksanity_s_mainnet.test.ts'

To view results:

npm i -g ox
0x --visualize-cpu-profile ./0\ -\ blocksanity-1561705313935.cpuprofile

Open resulting html file in favorite browser.

Usage

  1. If you haven't yarn install
  2. yarn build
  3. ./bin/lodestar --help

Starting private eth1 chain

./bin/lodestar eth1:dev -m "vast thought differ pull jewel broom cook wrist tribe word before omit"

This will start ganache server on http://127.0.0.1:8545. For more configuration check ./bin/lodestar eth1:dev --help

Starting lodestar beacon chain

./bin/lodestar beacon --db test-db --eth1RpcUrl http://127.0.0.1:8545 --depositContract <depositContractAddress>

You will see deposit contract address in console if you used ./bin/lodestar eth1:dev.

Making validator deposit

./bin/lodestar deposit -m "vast thought differ pull jewel broom cook wrist tribe word before omit" -n http://127.0.0.1:8545 -c <depositContractAddress>>

This will trigger 10 deposits to deposit contract which will trigger beacon chain initialization. Make sure to use same mnemonic which you used to start eth1 network.

Contributors

If you would like to contribute, please submit an issue or talk to us on our discord.

Donations

We are a local group of Toronto open source developers. As such, all of our open source work is funded by grants. We all take the time out of our hectic lives to contribute to the Ethereum ecosystem. If you want to donate, you can send us ETH at the following address: 0xBceDE714283f348EBB3e5cBaF8A947Cab3C8bE8d

About

🌟 Ethereum 2.0: TypeScript Implementation of the Beacon Chain

License:GNU Lesser General Public License v3.0


Languages

Language:TypeScript 99.8%Language:Dockerfile 0.1%Language:Shell 0.1%Language:JavaScript 0.0%