beacon-chain/

directory
v5.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: GPL-3.0

README

Prysmatic Labs Beacon Chain Implementation

This is the main project folder for the beacon chain implementation of Ethereum written in Go by Prysmatic Labs.

You can also read our main README and join our active chat room on Discord.

Discord

Also, read the official beacon chain specification, this design spec serves as a source of truth for the beacon chain implementation we follow at Prysmatic Labs.

Directories

Path Synopsis
Package blockchain defines the life-cycle of the blockchain at the core of Ethereum, including processing of new blocks and attestations using proof of stake.
Package blockchain defines the life-cycle of the blockchain at the core of Ethereum, including processing of new blocks and attestations using proof of stake.
kzg
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 Ethereum 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 Ethereum 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.
depositsnapshot
Package depositsnapshot implements the EIP-4881 standard for minimal sparse Merkle tree.
Package depositsnapshot implements the EIP-4881 standard for minimal sparse Merkle tree.
core
blocks
Package blocks contains block processing libraries according to the Ethereum beacon chain spec.
Package blocks contains block processing libraries according to the Ethereum beacon chain spec.
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.
Package operation contains types for block operation-specific events fired during the runtime of a beacon node.
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 Ethereum Beacon Chain spec, such as computing committees, randao, rewards/penalties, and more.
Package helpers contains helper functions outlined in the Ethereum Beacon Chain spec, such as computing committees, randao, rewards/penalties, and more.
transition
Package transition implements the whole state transition function which consists of per slot, per-epoch transitions.
Package transition implements the whole state transition function which consists of per slot, per-epoch transitions.
transition/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.
transition/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 Ethereum Beacon Node.
Package db defines the ability to create a new database for an Ethereum 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.
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.
slasherkv
Package slasherkv defines a bolt-db, key-value store implementation of the slasher database interface for Prysm.
Package slasherkv defines a bolt-db, key-value store implementation of the slasher database interface for Prysm.
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 interopcoldstart allows for spinning up a deterministic-genesis local chain without the need for eth1 deposits useful for local client development and interoperability testing.
Package interopcoldstart allows for spinning up a deterministic-genesis local chain without the need for eth1 deposits useful for local client development and interoperability testing.
Package execution 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 execution 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.
Package forkchoice implements the service to support fork choice for the Ethereum beacon chain.
Package forkchoice implements the service to support fork choice for the Ethereum beacon chain.
doubly-linked-tree
Package doublylinkedtree implements eth2 LMD GHOST fork choice using the doubly linked proto array node structure.
Package doublylinkedtree implements eth2 LMD GHOST fork choice using the doubly linked proto array node structure.
Package monitor defines a runtime service which receives notifications triggered by events related to performance of tracked validating keys.
Package monitor defines a runtime service which receives notifications triggered by events related to performance of tracked validating keys.
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.
blstoexec
Package blstoexecchanges defines an in-memory pool of received BLS-to-ETH1 change objects.
Package blstoexecchanges defines an in-memory pool of received BLS-to-ETH1 change objects.
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 consensus networking specification.
Package p2p implements the Ethereum consensus networking specification.
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 Ethereum consensus protocol level.
Package peers provides information about peers at the Ethereum consensus 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.
types
Package types contains all the respective p2p types that are required for sync but cannot be represented as a protobuf schema.
Package types contains all the respective p2p types that are required for sync but cannot be represented as a protobuf schema.
rpc
Package rpc defines a gRPC server implementing the Ethereum consensus API as needed by validator clients and consumers of chain data.
Package rpc defines a gRPC server implementing the Ethereum consensus API as needed by validator clients and consumers of chain data.
eth/beacon
Package beacon defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
Package beacon defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
eth/debug
Package debug defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
Package debug defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
eth/events
Package events defines a gRPC events service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
Package events defines a gRPC events service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/.
eth/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.
prysm/v1alpha1/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.
prysm/v1alpha1/debug
Package debug defines a gRPC server implementation of a debugging service which allows for helpful endpoints to debug a beacon node at runtime, this server is gated behind the feature flag --enable-debug-rpc-endpoints.
Package debug defines a gRPC server implementation of a debugging service which allows for helpful endpoints to debug a beacon node at runtime, this server is gated behind the feature flag --enable-debug-rpc-endpoints.
prysm/v1alpha1/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.
prysm/v1alpha1/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.
nolint:dupword
nolint:dupword
Package state defines the actual beacon state interface used by a Prysm beacon node, also containing useful, scoped interfaces such as a ReadOnlyState and WriteOnlyBeaconState.
Package state defines the actual beacon state interface used by a Prysm beacon node, also containing useful, scoped interfaces such as a ReadOnlyState and WriteOnlyBeaconState.
state-native
Package state_native defines how the beacon chain state for Ethereum functions in the running beacon node, using an advanced, immutable implementation of the state data structure.
Package state_native defines how the beacon chain state for Ethereum 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.
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