package params

import "github.com/ethereum/go-ethereum/beacon/params"

Index

Constants

const (
	EpochLength      = 32
	SyncPeriodLength = 8192

	BLSSignatureSize = 96
	BLSPubkeySize    = 48

	SyncCommitteeSize          = 512
	SyncCommitteeBitmaskSize   = SyncCommitteeSize / 8
	SyncCommitteeSupermajority = (SyncCommitteeSize*2 + 2) / 3
)
const (
	StateIndexGenesisTime              = 32
	StateIndexGenesisValidators        = 33
	StateIndexForkVersion              = 141
	StateIndexLatestHeader             = 36
	StateIndexBlockRoots               = 37
	StateIndexStateRoots               = 38
	StateIndexHistoricRoots            = 39
	StateIndexFinalBlockOld            = 105
	StateIndexFinalBlockElectra        = 169
	StateIndexSyncCommitteeOld         = 54
	StateIndexSyncCommitteeElectra     = 86
	StateIndexNextSyncCommitteeOld     = 55
	StateIndexNextSyncCommitteeElectra = 87
	StateIndexExecPayload              = 56
	StateIndexExecHead                 = 908

	BodyIndexExecPayload = 25
)

Variables

var (
	MainnetLightConfig = (&ChainConfig{
		GenesisValidatorsRoot: common.HexToHash("0x4b363db94e286120d76eb905340fdd4e54bfe9f06bf33ff6cf5ad27f511bfe95"),
		GenesisTime:           1606824023,
		Checkpoint:            common.HexToHash(checkpointMainnet),
	}).
		AddFork("GENESIS", 0, []byte{0, 0, 0, 0}).
		AddFork("ALTAIR", 74240, []byte{1, 0, 0, 0}).
		AddFork("BELLATRIX", 144896, []byte{2, 0, 0, 0}).
		AddFork("CAPELLA", 194048, []byte{3, 0, 0, 0}).
		AddFork("DENEB", 269568, []byte{4, 0, 0, 0}).
		AddFork("ELECTRA", 364032, []byte{5, 0, 0, 0})

	SepoliaLightConfig = (&ChainConfig{
		GenesisValidatorsRoot: common.HexToHash("0xd8ea171f3c94aea21ebc42a1ed61052acf3f9209c00e4efbaaddac09ed9b8078"),
		GenesisTime:           1655733600,
		Checkpoint:            common.HexToHash(checkpointSepolia),
	}).
		AddFork("GENESIS", 0, []byte{144, 0, 0, 105}).
		AddFork("ALTAIR", 50, []byte{144, 0, 0, 112}).
		AddFork("BELLATRIX", 100, []byte{144, 0, 0, 113}).
		AddFork("CAPELLA", 56832, []byte{144, 0, 0, 114}).
		AddFork("DENEB", 132608, []byte{144, 0, 0, 115}).
		AddFork("ELECTRA", 222464, []byte{144, 0, 0, 116})

	HoleskyLightConfig = (&ChainConfig{
		GenesisValidatorsRoot: common.HexToHash("0x9143aa7c615a7f7115e2b6aac319c03529df8242ae705fba9df39b79c59fa8b1"),
		GenesisTime:           1695902400,
		Checkpoint:            common.HexToHash(checkpointHolesky),
	}).
		AddFork("GENESIS", 0, []byte{1, 1, 112, 0}).
		AddFork("ALTAIR", 0, []byte{2, 1, 112, 0}).
		AddFork("BELLATRIX", 0, []byte{3, 1, 112, 0}).
		AddFork("CAPELLA", 256, []byte{4, 1, 112, 0}).
		AddFork("DENEB", 29696, []byte{5, 1, 112, 0}).
		AddFork("ELECTRA", 115968, []byte{6, 1, 112, 0})

	HoodiLightConfig = (&ChainConfig{
		GenesisValidatorsRoot: common.HexToHash("0x212f13fc4df078b6cb7db228f1c8307566dcecf900867401a92023d7ba99cb5f"),
		GenesisTime:           1742212800,
		Checkpoint:            common.HexToHash(""),
	}).
		AddFork("GENESIS", 0, common.FromHex("0x10000910")).
		AddFork("ALTAIR", 0, common.FromHex("0x20000910")).
		AddFork("BELLATRIX", 0, common.FromHex("0x30000910")).
		AddFork("CAPELLA", 0, common.FromHex("0x40000910")).
		AddFork("DENEB", 0, common.FromHex("0x50000910")).
		AddFork("ELECTRA", 2048, common.FromHex("0x60000910")).
		AddFork("FULU", 18446744073709551615, common.FromHex("0x70000910"))
)

Functions

func StateIndexFinalBlock

func StateIndexFinalBlock(forkName string) uint64

func StateIndexNextSyncCommittee

func StateIndexNextSyncCommittee(forkName string) uint64

func StateIndexSyncCommittee

func StateIndexSyncCommittee(forkName string) uint64

Types

type ChainConfig

type ChainConfig struct {
	GenesisTime           uint64      // Unix timestamp of slot 0
	GenesisValidatorsRoot common.Hash // Root hash of the genesis validator set, used for signature domain calculation
	Forks                 Forks
	Checkpoint            common.Hash
	CheckpointFile        string
}

ChainConfig contains the beacon chain configuration.

func (*ChainConfig) AddFork

func (c *ChainConfig) AddFork(name string, epoch uint64, version []byte) *ChainConfig

AddFork adds a new item to the list of forks.

func (*ChainConfig) ForkAtEpoch

func (c *ChainConfig) ForkAtEpoch(epoch uint64) Fork

ForkAtEpoch returns the latest active fork at the given epoch.

func (*ChainConfig) LoadForks

func (c *ChainConfig) LoadForks(path string) error

LoadForks parses the beacon chain configuration file (config.yaml) and extracts the list of forks.

func (*ChainConfig) SaveCheckpointToFile

func (c *ChainConfig) SaveCheckpointToFile(checkpoint common.Hash) (bool, error)

SaveCheckpointToFile saves the given checkpoint to file if a checkpoint import/export file has been specified.

func (*ChainConfig) SetCheckpointFile

func (c *ChainConfig) SetCheckpointFile(checkpointFile string) (bool, error)

SetCheckpointFile sets the checkpoint import/export file name and attempts to read the checkpoint from the file if it already exists. It returns true if a checkpoint has been loaded.

type ClientConfig

type ClientConfig struct {
	ChainConfig
	Apis         []string
	CustomHeader map[string]string
	Threshold    int
	NoFilter     bool
}

ClientConfig contains beacon light client configuration.

type Fork

type Fork struct {
	// Name of the fork in the chain config (config.yaml) file
	Name string

	// Epoch when given fork version is activated
	Epoch uint64

	// Fork version, see https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#custom-types
	Version []byte
	// contains filtered or unexported fields
}

Fork describes a single beacon chain fork and also stores the calculated signature domain used after this fork.

type Forks

type Forks []*Fork

Forks is the list of all beacon chain forks in the chain configuration.

func (Forks) Len

func (f Forks) Len() int

func (Forks) Less

func (f Forks) Less(i, j int) bool

func (Forks) SigningRoot

func (f Forks) SigningRoot(epoch uint64, root common.Hash) (common.Hash, error)

SigningRoot calculates the signing root of the given header.

func (Forks) Swap

func (f Forks) Swap(i, j int)

Source Files

config.go networks.go params.go

Version
v1.16.1 (latest)
Published
Jul 2, 2025
Platform
linux/amd64
Imports
14 packages
Last checked
16 hours ago

Tools for package owners.