package forkid
import "github.com/ethereum/go-ethereum/core/forkid"
Package forkid implements EIP-2124 (https://eips.ethereum.org/EIPS/eip-2124).
Index ¶
- Variables
- type Blockchain
- type Filter
- func NewFilter(chain Blockchain) Filter
- func NewStaticFilter(config *params.ChainConfig, genesis *types.Block) Filter
- type ID
Variables ¶
var ( // ErrRemoteStale is returned by the validator if a remote fork checksum is a // subset of our already applied forks, but the announced next fork block is // not on our already passed chain. ErrRemoteStale = errors.New("remote needs update") // ErrLocalIncompatibleOrStale is returned by the validator if a remote fork // checksum does not match any local checksum variation, signalling that the // two chains have diverged in the past at some point (possibly at genesis). ErrLocalIncompatibleOrStale = errors.New("local incompatible or needs update") )
Types ¶
type Blockchain ¶
type Blockchain interface { // Config retrieves the chain's fork configuration. Config() *params.ChainConfig // Genesis retrieves the chain's genesis block. Genesis() *types.Block // CurrentHeader retrieves the current head header of the canonical chain. CurrentHeader() *types.Header }
Blockchain defines all necessary method to build a forkID.
type Filter ¶
Filter is a fork id filter to validate a remotely advertised ID.
func NewFilter ¶
func NewFilter(chain Blockchain) Filter
NewFilter creates a filter that returns if a fork ID should be rejected or not based on the local chain's status.
func NewStaticFilter ¶
func NewStaticFilter(config *params.ChainConfig, genesis *types.Block) Filter
NewStaticFilter creates a filter at block zero.
type ID ¶
type ID struct { Hash [4]byte // CRC32 checksum of the genesis block and passed fork block numbers Next uint64 // Block number of the next upcoming fork, or 0 if no forks are known }
ID is a fork identifier as defined by EIP-2124.
func NewID ¶
NewID calculates the Ethereum fork ID from the chain config, genesis hash, head and time.
func NewIDWithChain ¶
func NewIDWithChain(chain Blockchain) ID
NewIDWithChain calculates the Ethereum fork ID from an existing chain instance.
Source Files ¶
- Version
- v1.15.11 (latest)
- Published
- May 5, 2025
- Platform
- linux/amd64
- Imports
- 11 packages
- Last checked
- 1 day ago –
Tools for package owners.