ethereum

package
v0.0.60 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package ethereum provides Ethereum beacon node functionality

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BeaconNode

type BeaconNode struct {
	// contains filtered or unexported fields
}

BeaconNode represents a connection to an Ethereum beacon node and manages any associated services (eg: metadata, etc).

func NewBeaconNode

func NewBeaconNode(
	log logrus.FieldLogger,
	traceID string,
	config *Config,
	sinks []sinks.ContributoorSink,
	clockDrift clockdrift.ClockDrift,
	cache *events.DuplicateCache,
	summary *events.Summary,
	metrics *events.Metrics,
	opt *Options,
) (*BeaconNode, error)

NewBeaconNode creates a new beacon node instance with the given configuration. It initializes any services and configures the beacon subscriptions.

func (*BeaconNode) GetEpoch

func (b *BeaconNode) GetEpoch(epoch uint64) ethwallclock.Epoch

GetEpoch returns the wallclock epoch for a given slot number.

func (*BeaconNode) GetEpochFromSlot

func (b *BeaconNode) GetEpochFromSlot(slot uint64) ethwallclock.Epoch

GetEpochFromSlot returns the wallclock epoch for a given slot.

func (*BeaconNode) GetSlot

func (b *BeaconNode) GetSlot(slot uint64) ethwallclock.Slot

GetSlot returns the wallclock slot for a given slot number.

func (*BeaconNode) GetWallclock

func (b *BeaconNode) GetWallclock() *ethwallclock.EthereumBeaconChain

GetWallclock returns the wallclock for the beacon chain.

func (*BeaconNode) IsHealthy added in v0.0.55

func (b *BeaconNode) IsHealthy() bool

IsHealthy returns whether the node is healthy.

func (*BeaconNode) Metadata

func (b *BeaconNode) Metadata() *services.MetadataService

Metadata returns the metadata service instance.

func (*BeaconNode) Node

func (b *BeaconNode) Node() beacon.Node

Node returns the underlying beacon node instance.

func (*BeaconNode) Start

func (b *BeaconNode) Start(ctx context.Context) (chan struct{}, error)

Start begins the beacon node operation and its services It returns a channel that will be closed when the node is healthy.

func (*BeaconNode) Stop

func (b *BeaconNode) Stop(ctx context.Context) error

Stop gracefully shuts down the beacon node and its services.

func (*BeaconNode) Synced

func (b *BeaconNode) Synced(ctx context.Context) error

Synced checks if the beacon node is synced and ready It verifies sync state, wallclock, and service readiness.

type BeaconNodeAPI added in v0.0.55

type BeaconNodeAPI interface {
	// Start starts the beacon node. Returns a channel that will be closed when the node is healthy.
	Start(ctx context.Context) (chan struct{}, error)
	// Stop stops the beacon node.
	Stop(ctx context.Context) error
	// Synced checks if the beacon node is synced and ready.
	Synced(ctx context.Context) error
}

BeaconNodeAPI is the interface for the BeaconNode.

type Config

type Config struct {
	// The address of the Beacon node to connect to
	BeaconNodeAddress string `yaml:"beaconNodeAddress"`
	// BeaconNodeHeaders is a map of headers to send to the beacon node.
	BeaconNodeHeaders map[string]string `yaml:"beaconNodeHeaders"`
	// BeaconSubscriptions is a list of beacon subscriptions to subscribe to.
	BeaconSubscriptions *[]string `yaml:"beaconSubscriptions"`
}

Config defines the configuration for the Ethereum beacon node.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks the configuration for the beacon node.

type Options

type Options struct {
	FetchBeaconCommittees bool
	FetchProposerDuties   bool
}

Options defines the options for the Ethereum beacon node.

func (*Options) WithFetchBeaconCommittees

func (o *Options) WithFetchBeaconCommittees(fetchBeaconCommittees bool) *Options

WithFetchBeaconCommittees sets the option to fetch beacon committees.

func (*Options) WithFetchProposerDuties

func (o *Options) WithFetchProposerDuties(fetchProposerDuties bool) *Options

WithFetchProposerDuties sets the option to fetch proposer duties.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
Package services provides Ethereum consensus client related functionality
Package services provides Ethereum consensus client related functionality

Jump to

Keyboard shortcuts

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