beacon-chain

command
v1.0.0-alpha.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

README

Prysmatic Labs Beacon Chain Implementation

This is the main project folder for the beacon chain implementation of Ethereum Serenity in Golang by 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 the latest beacon chain design spec, this design spec serves as a source of truth for the beacon chain implementation we follow at prysmatic labs. Check out the FAQs. Refer this page on why we are combining sharding and casper together.

Documentation

Overview

Package beacon-chain defines the entire runtime of an eth2 beacon node.

This code was adapted from https://github.com/ethereum/go-ethereum/blob/master/cmd/geth/usage.go

Directories

Path Synopsis
Package blockchain defines the life-cycle of the blockchain at the core of eth2, including processing of new blocks and attestations using casper proof of stake.
Package blockchain defines the life-cycle of the blockchain at the core of eth2, including processing of new blocks and attestations using casper proof of stake.
testing
Package testing includes useful mocks for writing unit tests which depend on logic from the blockchain package.
Package testing includes useful mocks for writing unit tests which depend on logic from the blockchain package.
Package cache includes all important caches for the runtime of an eth2 beacon node, ensuring the node does not spend resources computing duplicate operations such as committee calculations for validators during the same epoch, etc.
Package cache includes all important caches for the runtime of an eth2 beacon node, ensuring the node does not spend resources computing duplicate operations such as committee calculations for validators during the same epoch, etc.
depositcache
Package depositcache is the source of validator deposits maintained in-memory by the beacon node – deposits processed from the eth1 powchain are then stored in this cache to be accessed by any other service during a beacon node's runtime.
Package depositcache is the source of validator deposits maintained in-memory by the beacon node – deposits processed from the eth1 powchain are then stored in this cache to be accessed by any other service during a beacon node's runtime.
core
blocks
Package blocks contains block processing libraries according to the eth2spec.
Package blocks contains block processing libraries according to the eth2spec.
epoch
Package epoch contains epoch processing libraries according to spec, able to process new balance for validators, justify and finalize new check points, and shuffle validators to different slots and shards.
Package epoch contains epoch processing libraries according to spec, able to process new balance for validators, justify and finalize new check points, and shuffle validators to different slots and shards.
epoch/precompute
Package precompute provides gathering of nicely-structured data important to feed into epoch processing, such as attesting records and balances, for faster computation.
Package precompute provides gathering of nicely-structured data important to feed into epoch processing, such as attesting records and balances, for faster computation.
feed
Package feed defines event feed types for inter-service communication during a beacon node's runtime.
Package feed defines event feed types for inter-service communication during a beacon node's runtime.
feed/block
Package block contains types for block-specific events fired during the runtime of a beacon node.
Package block contains types for block-specific events fired during the runtime of a beacon node.
feed/operation
Package operation contains types for block operation-specific events fired during the runtime of a beacon node such as attestations, voluntary exits, and slashings.
Package operation contains types for block operation-specific events fired during the runtime of a beacon node such as attestations, voluntary exits, and slashings.
feed/state
Package state contains types for state operation-specific events fired during the runtime of a beacon node such state initialization, state updates, and chain start.
Package state contains types for state operation-specific events fired during the runtime of a beacon node such state initialization, state updates, and chain start.
helpers
Package helpers contains helper functions outlined in the eth2 beacon chain spec, such as computing committees, randao, rewards/penalties, and more.
Package helpers contains helper functions outlined in the eth2 beacon chain spec, such as computing committees, randao, rewards/penalties, and more.
state
Package state implements the whole state transition function which consists of per slot, per-epoch transitions, and bootstrapping the genesis state according to the eth2 spec.
Package state implements the whole state transition function which consists of per slot, per-epoch transitions, and bootstrapping the genesis state according to the eth2 spec.
state/interop
Package interop contains useful utilities for persisting ssz-encoded states and blocks to disk during each state transition for development purposes.
Package interop contains useful utilities for persisting ssz-encoded states and blocks to disk during each state transition for development purposes.
state/stateutils
Package stateutils contains useful tools for faster computation of state transitions using maps to represent validators instead of slices.
Package stateutils contains useful tools for faster computation of state transitions using maps to represent validators instead of slices.
validators
Package validators contains libraries to shuffle validators and retrieve active validator indices from a given slot or an attestation.
Package validators contains libraries to shuffle validators and retrieve active validator indices from a given slot or an attestation.
db
Package db defines the ability to create a new database for an eth2 beacon node.
Package db defines the ability to create a new database for an eth2 beacon node.
filters
Package filters specifies utilities for building a set of data attribute filters to be used when filtering data through database queries in practice.
Package filters specifies utilities for building a set of data attribute filters to be used when filtering data through database queries in practice.
iface
Package iface defines the actual database interface used by a Prysm beacon node, also containing useful, scoped interfaces such as a ReadOnlyDatabase.
Package iface defines the actual database interface used by a Prysm beacon node, also containing useful, scoped interfaces such as a ReadOnlyDatabase.
kafka
Package kafka defines an implementation of Database interface which exports streaming data using Kafka for data analysis.
Package kafka defines an implementation of Database interface which exports streaming data using Kafka for data analysis.
kv
Package kv defines a bolt-db, key-value store implementation of the Database interface defined by a Prysm beacon node.
Package kv defines a bolt-db, key-value store implementation of the Database interface defined by a Prysm beacon node.
testing
Package testing allows for spinning up a real bolt-db instance for unit tests throughout the Prysm repo.
Package testing allows for spinning up a real bolt-db instance for unit tests throughout the Prysm repo.
Package flags defines beacon-node specific runtime flags for setting important values such as ports, eth1 endpoints, and more.
Package flags defines beacon-node specific runtime flags for setting important values such as ports, eth1 endpoints, and more.
Package forkchoice implements the service to support fork choice for the eth2 beacon chain.
Package forkchoice implements the service to support fork choice for the eth2 beacon chain.
protoarray
Package protoarray implements proto array fork choice as outlined: https://github.com/protolambda/lmd-ghost#array-based-stateful-dag-proto_array This was motivated by the the original implementation by Sigma Prime here: https://github.com/sigp/lighthouse/pull/804
Package protoarray implements proto array fork choice as outlined: https://github.com/protolambda/lmd-ghost#array-based-stateful-dag-proto_array This was motivated by the the original implementation by Sigma Prime here: https://github.com/sigp/lighthouse/pull/804
Package gateway defines a gRPC gateway to serve HTTP-JSON traffic as a proxy and forward it to a beacon node's gRPC service.
Package gateway defines a gRPC gateway to serve HTTP-JSON traffic as a proxy and forward it to a beacon node's gRPC service.
server
Package main allows for creation of an HTTP-JSON to gRPC gateway as a binary go process.
Package main allows for creation of an HTTP-JSON to gRPC gateway as a binary go process.
Package interopcoldstart allows for spinning up a deterministic local chain without the need for eth1 deposits useful for local client development and interoperability testing.
Package interopcoldstart allows for spinning up a deterministic local chain without the need for eth1 deposits useful for local client development and interoperability testing.
Package node is the main service which launches a beacon node and manages the lifecycle of all its associated services at runtime, such as p2p, RPC, sync, gracefully closing them if the process ends.
Package node is the main service which launches a beacon node and manages the lifecycle of all its associated services at runtime, such as p2p, RPC, sync, gracefully closing them if the process ends.
operations
attestations
Package attestations defines an attestation pool service implementation which is used to manage the lifecycle of aggregated, unaggregated, and fork-choice attestations.
Package attestations defines an attestation pool service implementation which is used to manage the lifecycle of aggregated, unaggregated, and fork-choice attestations.
attestations/kv
Package kv includes a key-value store implementation of an attestation cache used to satisfy important use-cases such as aggregation in a beacon node runtime.
Package kv includes a key-value store implementation of an attestation cache used to satisfy important use-cases such as aggregation in a beacon node runtime.
slashings
Package slashings defines an in-memory pool of received slashing events by the beacon node, handling their lifecycle and performing integrity checks before serving them as objects for validators to include in blocks.
Package slashings defines an in-memory pool of received slashing events by the beacon node, handling their lifecycle and performing integrity checks before serving them as objects for validators to include in blocks.
voluntaryexits
Package voluntaryexits defines an in-memory pool of received voluntary exit events by the beacon node, handling their lifecycle and performing integrity checks before serving them as objects for validators to include in blocks.
Package voluntaryexits defines an in-memory pool of received voluntary exit events by the beacon node, handling their lifecycle and performing integrity checks before serving them as objects for validators to include in blocks.
p2p
Package p2p implements the Ethereum 2.0 networking specification.
Package p2p implements the Ethereum 2.0 networking specification.
connmgr
Package connmgr is forked from github.com/libp2p/go-libp2p-core/connmgr/connmgr.go
Package connmgr is forked from github.com/libp2p/go-libp2p-core/connmgr/connmgr.go
encoder
Package encoder allows for registering custom data encoders for information sent as raw bytes over the wire via p2p to other nodes.
Package encoder allows for registering custom data encoders for information sent as raw bytes over the wire via p2p to other nodes.
peers
Package peers provides information about peers at the eth2 protocol level.
Package peers provides information about peers at the eth2 protocol level.
testing
Package testing includes useful utilities for mocking a beacon node's p2p service for unit tests.
Package testing includes useful utilities for mocking a beacon node's p2p service for unit tests.
Package powchain defines a runtime service which is tasked with communicating with an eth1 endpoint, processing logs from a deposit contract, and the latest eth1 data headers for usage in the beacon node.
Package powchain defines a runtime service which is tasked with communicating with an eth1 endpoint, processing logs from a deposit contract, and the latest eth1 data headers for usage in the beacon node.
testing
Package testing provides useful mocks for an eth1 powchain service as needed by unit tests for the beacon node.
Package testing provides useful mocks for an eth1 powchain service as needed by unit tests for the beacon node.
rpc
Package rpc defines a gRPC server implementing the eth2 API as needed by validator clients and consumers of chain data.
Package rpc defines a gRPC server implementing the eth2 API as needed by validator clients and consumers of chain data.
beacon
Package beacon defines a gRPC beacon service implementation, providing useful endpoints for checking fetching chain-specific data such as blocks, committees, validators, assignments, and more.
Package beacon defines a gRPC beacon service implementation, providing useful endpoints for checking fetching chain-specific data such as blocks, committees, validators, assignments, and more.
node
Package node defines a gRPC node service implementation, providing useful endpoints for checking a node's sync status, peer info, genesis data, and version information.
Package node defines a gRPC node service implementation, providing useful endpoints for checking a node's sync status, peer info, genesis data, and version information.
testing
Package testing is a generated GoMock package.
Package testing is a generated GoMock package.
validator
Package validator defines a gRPC validator service implementation, providing critical endpoints for validator clients to submit blocks/attestations to the beacon node, receive assignments, and more.
Package validator defines a gRPC validator service implementation, providing critical endpoints for validator clients to submit blocks/attestations to the beacon node, receive assignments, and more.
Package state defines how the beacon chain state for eth2 functions in the running beacon node, using an advanced, immutable implementation of the state data structure.
Package state defines how the beacon chain state for eth2 functions in the running beacon node, using an advanced, immutable implementation of the state data structure.
stategen
Package stategen defines functions to regenerate beacon chain states by replaying blocks from a stored state checkpoint, useful for optimization and reducing a beacon node's resource consumption.
Package stategen defines functions to regenerate beacon chain states by replaying blocks from a stored state checkpoint, useful for optimization and reducing a beacon node's resource consumption.
stateutil
Package stateutil defines utility functions to compute state roots using advanced merkle branch caching techniques.
Package stateutil defines utility functions to compute state roots using advanced merkle branch caching techniques.
Package sync TODO(3147): Add details on how sync works.
Package sync TODO(3147): Add details on how sync works.
initial-sync
Package initialsync includes all initial block download and processing logic for the beacon node, using a round robin strategy and a finite-state-machine to handle edge-cases in a beacon node's sync status.
Package initialsync includes all initial block download and processing logic for the beacon node, using a round robin strategy and a finite-state-machine to handle edge-cases in a beacon node's sync status.
initial-sync/testing
Package testing includes useful mocks for testing initial sync status in unit tests.
Package testing includes useful mocks for testing initial sync status in unit tests.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL