client

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

go-eth2-client

Tag License GoDoc Lint Go Report Card

Go library providing an abstraction to multiple Ethereum beacon nodes. Its external API follows the official Ethereum beacon APIs specification.

This is a fork. ethpandaops/go-eth2-client is an ethPandaOps-maintained fork of attestantio/go-eth2-client. It preserves upstream's API so consumers can move between the two with minimal churn, while adding early support for Ethereum consensus forks that are still being specified.

About this fork

The upstream project, maintained by Attestant Limited, is the canonical Go client for the beacon APIs and targets stable, spec-frozen forks. This fork exists alongside it for a narrower purpose: to let ethPandaOps tooling speak to consensus clients that implement in-development forks before those forks are frozen.

Scope
  • Early fork support. Types, SSZ encodings, and additional endpoints for upcoming forks (e.g. Fulu, Gloas, and subsequent in-development hard forks) are added here as soon as they are needed by ethPandaOps tooling running devnets and short-lived testnets.
  • Upstream compatibility, best-effort. We track upstream changes and try to keep the public API source-compatible so downstream projects can swap between the two. This is a best-effort commitment, not a guarantee — when upstream and an in-development spec conflict, the spec wins for as long as it is WIP.
  • Not a replacement. We do not intend to replace the upstream library. If you do not need pre-release fork support, prefer attestantio/go-eth2-client.
Stability expectations

Because this fork follows specifications that are still moving:

  • Types, field names, and endpoints related to in-development forks will change as the specs evolve — sometimes in breaking ways, including between patch releases.
  • Stable mainnet fork types are only changed when upstream changes them or when an upstream merge forces it.
  • Tagged releases are cut when ethPandaOps tooling needs a new baseline; there is no fixed cadence.

If you pin this library, pin it to an exact version and expect to revisit that pin whenever you upgrade a consensus client running an unreleased fork.

Intended audience

This fork is built primarily for the ethPandaOps tool suite, which sits close to Ethereum R&D and therefore needs a client library that can keep up with bleeding-edge consensus client builds. If you are running ethPandaOps tooling against devnets, this is the version you want. Otherwise, the upstream library is almost certainly the better choice.

Install

go-eth2-client is a standard Go module which can be installed with:

go get github.com/ethpandaops/go-eth2-client

Support

go-eth2-client supports beacon nodes that comply with the standard beacon node API. For in-development forks, the usable surface depends on what the client under test has implemented — a devnet-only fork is only exposed on clients that already speak it.

Tested against:

Usage

Please read the Go documentation for this library for interface information.

Example

Below is a complete annotated example to access a beacon node.

package main

import (
    "context"
    "errors"
    "fmt"

    eth2client "github.com/ethpandaops/go-eth2-client"
    "github.com/ethpandaops/go-eth2-client/api"
    "github.com/ethpandaops/go-eth2-client/http"
    "github.com/rs/zerolog"
)

func main() {
    // Provide a cancellable context to the creation function.
    ctx, cancel := context.WithCancel(context.Background())
    client, err := http.New(ctx,
        // WithAddress supplies the address of the beacon node, as a URL.
        http.WithAddress("http://localhost:5052/"),
        // LogLevel supplies the level of logging to carry out.
        http.WithLogLevel(zerolog.WarnLevel),
    )
    if err != nil {
        panic(err)
    }

    fmt.Printf("Connected to %s\n", client.Name())

    // Client functions have their own interfaces. Not all functions are
    // supported by all clients, so checks should be made for each function when
    // casting the service to the relevant interface.
    if provider, isProvider := client.(eth2client.GenesisProvider); isProvider {
        genesisResponse, err := provider.Genesis(ctx, &api.GenesisOpts{})
        if err != nil {
            // Errors may be API errors, in which case they will have more detail
            // about the failure.
            var apiErr *api.Error
            if errors.As(err, &apiErr) {
                switch apiErr.StatusCode {
                case 404:
                    panic("genesis not found")
                case 503:
                    panic("node is syncing")
                }
            }
            panic(err)
        }
        fmt.Printf("Genesis time is %v\n", genesisResponse.Data.GenesisTime)
    }

    // You can also access the struct directly if required.
    httpClient := client.(*http.Service)
    genesisResponse, err := httpClient.Genesis(ctx, &api.GenesisOpts{})
    if err != nil {
        panic(err)
    }
    fmt.Printf("Genesis validators root is %s\n", genesisResponse.Data.GenesisValidatorsRoot)

    // Cancelling the context passed to New() frees up resources held by the
    // client, closes connections, clears handlers, etc.
    cancel()
}

Maintainers

This fork is maintained by the ethPandaOps team, primarily @pk910.

The upstream library was created and is maintained by Chris Berry (@bez625) and contributors at Attestant Limited.

Contribute

Contributions that target in-development fork support or keep this fork in sync with upstream are welcome. Please check the issues. Bugs or improvements that are not fork-specific are usually a better fit for upstream — we pull those changes in on a best-effort basis.

License

Apache-2.0

  • Original work © 2020–2025 Attestant Limited.
  • Fork modifications © 2025 ethPandaOps.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotActive is returned when a client is not active.
	ErrNotActive = errors.New("client is not active")
	// ErrNotSynced is returned when a client is not synced.
	ErrNotSynced = errors.New("client is not synced")
	// ErrNoOptions is returned when a request is made without options.
	ErrNoOptions = errors.New("no options specified")
	// ErrInvalidOptions is returned when a request is made with invalid options.
	ErrInvalidOptions = errors.New("invalid options")
	// ErrInconsistentResult is returned when a request returns with data at odds to that requested.
	ErrInconsistentResult = errors.New("inconsistent result")
)

Functions

This section is empty.

Types

type AggregateAttestationProvider

type AggregateAttestationProvider interface {
	// AggregateAttestation fetches the aggregate attestation for the given options.
	AggregateAttestation(ctx context.Context,
		opts *api.AggregateAttestationOpts,
	) (
		*api.Response[*spec.VersionedAttestation],
		error,
	)
}

AggregateAttestationProvider is the interface for providing aggregate attestations.

type AggregateAttestationsSubmitter

type AggregateAttestationsSubmitter interface {
	// SubmitAggregateAttestations submits aggregate attestations.
	SubmitAggregateAttestations(ctx context.Context, opts *api.SubmitAggregateAttestationsOpts) error
}

AggregateAttestationsSubmitter is the interface for submitting aggregate attestations.

type AttestationDataProvider

type AttestationDataProvider interface {
	// AttestationData fetches the attestation data for the given options.
	AttestationData(ctx context.Context,
		opts *api.AttestationDataOpts,
	) (
		*api.Response[*phase0.AttestationData],
		error,
	)
}

AttestationDataProvider is the interface for providing attestation data.

type AttestationPoolProvider

type AttestationPoolProvider interface {
	// AttestationPool fetches the attestation pool for the given options.
	AttestationPool(ctx context.Context,
		opts *api.AttestationPoolOpts,
	) (
		*api.Response[[]*spec.VersionedAttestation],
		error,
	)
}

AttestationPoolProvider is the interface for providing attestation pools.

type AttestationRewardsProvider

type AttestationRewardsProvider interface {
	// AttestationRewards provides rewards to the given validators for attesting.
	AttestationRewards(ctx context.Context,
		opts *api.AttestationRewardsOpts,
	) (
		*api.Response[*apiv1.AttestationRewards],
		error,
	)
}

AttestationRewardsProvider is the interface for providing attestation rewards.

type AttestationsSubmitter

type AttestationsSubmitter interface {
	// SubmitAttestations submits attestations.
	SubmitAttestations(ctx context.Context, opts *api.SubmitAttestationsOpts) error
}

AttestationsSubmitter is the interface for submitting attestations.

type AttesterDutiesProvider

type AttesterDutiesProvider interface {
	// AttesterDuties obtains attester duties.
	AttesterDuties(ctx context.Context,
		opts *api.AttesterDutiesOpts,
	) (
		*api.Response[[]*apiv1.AttesterDuty],
		error,
	)
}

AttesterDutiesProvider is the interface for providing attester duties.

type AttesterSlashingSubmitter

type AttesterSlashingSubmitter interface {
	// SubmitAttesterSlashing submits an attester slashing
	SubmitAttesterSlashing(ctx context.Context, slashing *phase0.AttesterSlashing) error
}

AttesterSlashingSubmitter is the interface for submitting attester slashings.

type BLSToExecutionChangesSubmitter

type BLSToExecutionChangesSubmitter interface {
	// SubmitBLSToExecutionChanges submits BLS to execution address change operations.
	SubmitBLSToExecutionChanges(ctx context.Context, blsToExecutionChanges []*capella.SignedBLSToExecutionChange) error
}

BLSToExecutionChangesSubmitter is the interface for submitting BLS to execution address changes.

type BeaconBlockHeadersProvider

type BeaconBlockHeadersProvider interface {
	// BeaconBlockHeader provides the block header of a given block ID.
	BeaconBlockHeader(ctx context.Context,
		opts *api.BeaconBlockHeaderOpts,
	) (
		*api.Response[*apiv1.BeaconBlockHeader],
		error,
	)
}

BeaconBlockHeadersProvider is the interface for providing beacon block headers.

type BeaconBlockRootProvider

type BeaconBlockRootProvider interface {
	// BeaconBlockRoot fetches a block's root given a set of options.
	BeaconBlockRoot(ctx context.Context,
		opts *api.BeaconBlockRootOpts,
	) (
		*api.Response[*phase0.Root],
		error,
	)
}

BeaconBlockRootProvider is the interface for providing beacon block roots.

type BeaconBlockSubmitter

type BeaconBlockSubmitter interface {
	// SubmitBeaconBlock submits a beacon block.
	//
	// Deprecated: this will not work as of the deneb hard-fork.  Use ProposalSubmitter.SubmitProposal() instead.
	SubmitBeaconBlock(ctx context.Context, block *spec.VersionedSignedBeaconBlock) error
}

BeaconBlockSubmitter is the interface for submitting beacon blocks.

type BeaconCommitteeSelectionsProvider added in v0.1.0

type BeaconCommitteeSelectionsProvider interface {
	// BeaconCommitteeSelections obtains beacon committee selections.
	BeaconCommitteeSelections(ctx context.Context,
		opts *api.BeaconCommitteeSelectionsOpts,
	) (
		*api.Response[[]*apiv1.BeaconCommitteeSelection],
		error,
	)
}

BeaconCommitteeSelectionsProvider is the interface for obtaining beacon committee subnet selections. Used by DV middleware clients.

type BeaconCommitteeSubscriptionsSubmitter

type BeaconCommitteeSubscriptionsSubmitter interface {
	// SubmitBeaconCommitteeSubscriptions subscribes to beacon committees.
	SubmitBeaconCommitteeSubscriptions(ctx context.Context, subscriptions []*apiv1.BeaconCommitteeSubscription) error
}

BeaconCommitteeSubscriptionsSubmitter is the interface for submitting beacon committee subnet subscription requests.

type BeaconCommitteesProvider

type BeaconCommitteesProvider interface {
	// BeaconCommittees fetches all beacon committees for the given options.
	BeaconCommittees(ctx context.Context,
		opts *api.BeaconCommitteesOpts,
	) (*api.Response[[]*apiv1.BeaconCommittee],
		error,
	)
}

BeaconCommitteesProvider is the interface for providing beacon committees.

type BeaconStateProvider

type BeaconStateProvider interface {
	// BeaconState fetches a beacon state given a state ID.
	BeaconState(ctx context.Context,
		opts *api.BeaconStateOpts,
	) (*api.Response[*spec.VersionedBeaconState],
		error,
	)

	// AgnosticBeaconState fetches a beacon state given a state ID and returns
	// it as a fork-agnostic *all.BeaconState.
	AgnosticBeaconState(ctx context.Context,
		opts *api.BeaconStateOpts,
	) (*api.Response[*all.BeaconState],
		error,
	)
}

BeaconStateProvider is the interface for providing beacon state.

type BeaconStateRandaoProvider

type BeaconStateRandaoProvider interface {
	// BeaconStateRandao fetches a beacon state RANDAO given a state ID.
	BeaconStateRandao(ctx context.Context,
		opts *api.BeaconStateRandaoOpts,
	) (
		*api.Response[*phase0.Root],
		error,
	)
}

BeaconStateRandaoProvider is the interface for providing beacon state RANDAOs.

type BeaconStateRootProvider

type BeaconStateRootProvider interface {
	// BeaconStateRoot fetches a beacon state root given a state ID.
	BeaconStateRoot(ctx context.Context,
		opts *api.BeaconStateRootOpts,
	) (
		*api.Response[*phase0.Root],
		error,
	)
}

BeaconStateRootProvider is the interface for providing beacon state roots.

type BlindedBeaconBlockSubmitter

type BlindedBeaconBlockSubmitter interface {
	// SubmitBlindedBeaconBlock submits a beacon block.
	//
	// Deprecated: this will not work as of the deneb hard-fork.  Use BlindedProposalSubmitter.SubmitBlindedProposal() instead.
	SubmitBlindedBeaconBlock(ctx context.Context, block *api.VersionedSignedBlindedBeaconBlock) error
}

BlindedBeaconBlockSubmitter is the interface for submitting blinded beacon blocks.

type BlindedProposalSubmitter

type BlindedProposalSubmitter interface {
	// SubmitBlindedProposal submits a beacon block.
	SubmitBlindedProposal(ctx context.Context,
		opts *api.SubmitBlindedProposalOpts,
	) error
}

BlindedProposalSubmitter is the interface for submitting blinded proposals.

type BlobSidecarsProvider

type BlobSidecarsProvider interface {
	// BlobSidecars fetches the blobs given a block ID.
	BlobSidecars(ctx context.Context,
		opts *api.BlobSidecarsOpts,
	) (
		*api.Response[[]*deneb.BlobSidecar],
		error)
}

BlobSidecarsProvider is the interface for providing blobs for a given beacon block.

type BlobsProvider

type BlobsProvider interface {
	// Blobs fetches the blobs given a block ID.
	Blobs(ctx context.Context,
		opts *api.BlobsOpts,
	) (
		*api.Response[apiv1.Blobs],
		error)
}

BlobsProvider is the interface for providing blobs for a given beacon block.

type BlockRewardsProvider

type BlockRewardsProvider interface {
	// BlockRewards provides rewards for proposing a block.
	BlockRewards(ctx context.Context,
		opts *api.BlockRewardsOpts,
	) (
		*api.Response[*apiv1.BlockRewards],
		error,
	)
}

BlockRewardsProvider is the interface for providing block rewards.

type DepositContractProvider

type DepositContractProvider interface {
	// DepositContract provides details of the execution deposit contract for the chain.
	DepositContract(ctx context.Context,
		opts *api.DepositContractOpts,
	) (
		*api.Response[*apiv1.DepositContract],
		error,
	)
}

DepositContractProvider is the interface for providing details about the deposit contract.

type DomainProvider

type DomainProvider interface {
	// Domain provides a domain for a given domain type at a given epoch.
	Domain(ctx context.Context, domainType phase0.DomainType, epoch phase0.Epoch) (phase0.Domain, error)

	// GenesisDomain returns the domain for the given domain type at genesis.
	// N.B. this is not always the same as the domain at epoch 0.  It is possible
	// for a chain's fork schedule to have multiple forks at genesis.  In this situation,
	// GenesisDomain() will return the first, and Domain() will return the last.
	GenesisDomain(ctx context.Context, domainType phase0.DomainType) (phase0.Domain, error)
}

DomainProvider provides a domain for a given domain type at an epoch.

type EpochFromStateIDProvider

type EpochFromStateIDProvider interface {
	// EpochFromStateID converts a state ID to its epoch.
	//
	// Deprecated: will be removed in a future release.
	EpochFromStateID(ctx context.Context, stateID string) (phase0.Epoch, error)
}

EpochFromStateIDProvider is the interface for providing epochs from state IDs.

type EventsProvider

type EventsProvider interface {
	// Events feeds requested events with the given topics to the supplied handler.
	Events(ctx context.Context, opts *api.EventsOpts) error
}

EventsProvider is the interface for providing events.

type ExecutionPayloadProvider

type ExecutionPayloadProvider interface {
	// SignedExecutionPayloadEnvelope fetches a signed execution payload
	// envelope given a block ID. Returns a versioned wrapper so callers can
	// branch on Version regardless of which fork's envelope is populated.
	SignedExecutionPayloadEnvelope(ctx context.Context,
		opts *api.SignedExecutionPayloadEnvelopeOpts,
	) (
		*api.Response[*spec.VersionedSignedExecutionPayloadEnvelope],
		error,
	)

	// AgnosticSignedExecutionPayloadEnvelope fetches a signed execution
	// payload envelope given a block ID and returns it as a fork-agnostic
	// *all.SignedExecutionPayloadEnvelope.
	AgnosticSignedExecutionPayloadEnvelope(ctx context.Context,
		opts *api.SignedExecutionPayloadEnvelopeOpts,
	) (
		*api.Response[*all.SignedExecutionPayloadEnvelope],
		error,
	)
}

ExecutionPayloadProvider is the interface for providing execution payloads.

type FarFutureEpochProvider

type FarFutureEpochProvider interface {
	// FarFutureEpoch provides the far future epoch of the chain.
	FarFutureEpoch(ctx context.Context) (phase0.Epoch, error)
}

FarFutureEpochProvider is the interface for providing the far future epoch of a chain.

type FinalityProvider

type FinalityProvider interface {
	// Finality provides the finality given a state ID.
	Finality(ctx context.Context,
		opts *api.FinalityOpts,
	) (
		*api.Response[*apiv1.Finality],
		error,
	)
}

FinalityProvider is the interface for providing finality information.

type ForkChoiceProvider

type ForkChoiceProvider interface {
	// Fork fetches all current fork choice context.
	ForkChoice(ctx context.Context,
		opts *api.ForkChoiceOpts,
	) (
		*api.Response[*apiv1.ForkChoice],
		error,
	)
}

ForkChoiceProvider is the interface for providing fork choice information.

type ForkProvider

type ForkProvider interface {
	// Fork fetches fork information for the given state.
	Fork(ctx context.Context,
		opts *api.ForkOpts,
	) (
		*api.Response[*phase0.Fork],
		error,
	)
}

ForkProvider is the interface for providing fork information.

type ForkScheduleProvider

type ForkScheduleProvider interface {
	// ForkSchedule provides details of past and future changes in the chain's fork version.
	ForkSchedule(ctx context.Context,
		opts *api.ForkScheduleOpts,
	) (
		*api.Response[[]*phase0.Fork],
		error,
	)
}

ForkScheduleProvider is the interface for providing fork schedule data.

type GenesisProvider

type GenesisProvider interface {
	// Genesis fetches genesis information for the chain.
	Genesis(ctx context.Context,
		opts *api.GenesisOpts,
	) (
		*api.Response[*apiv1.Genesis],
		error,
	)
}

GenesisProvider is the interface for providing genesis information.

type GenesisTimeProvider deprecated

type GenesisTimeProvider interface {
	// GenesisTime provides the genesis time of the chain.
	GenesisTime(ctx context.Context) (time.Time, error)
}

GenesisTimeProvider is the interface for providing the genesis time of a chain.

Deprecated: use Genesis().

type NodeClientProvider

type NodeClientProvider interface {
	// NodeClient provides the client for the node.
	NodeClient(ctx context.Context) (*api.Response[string], error)
}

NodeClientProvider provides the client for the node.

type NodePeersProvider

type NodePeersProvider interface {
	// NodePeers provides the peers of the node.
	NodePeers(ctx context.Context,
		opts *api.NodePeersOpts,
	) (
		*api.Response[[]*apiv1.Peer],
		error,
	)
}

NodePeersProvider is the interface for providing peer information.

type NodeSyncingProvider

type NodeSyncingProvider interface {
	// NodeSyncing provides the state of the node's synchronization with the chain.
	NodeSyncing(ctx context.Context,
		opts *api.NodeSyncingOpts,
	) (
		*api.Response[*apiv1.SyncState],
		error,
	)
}

NodeSyncingProvider is the interface for providing synchronization state.

type NodeVersionProvider

type NodeVersionProvider interface {
	// NodeVersion returns a free-text string with the node version.
	NodeVersion(ctx context.Context,
		opts *api.NodeVersionOpts,
	) (
		*api.Response[string],
		error,
	)
}

NodeVersionProvider is the interface for providing the node version.

type PendingConsolidationsProvider

type PendingConsolidationsProvider interface {
	// PendingConsolidations provides the pending consolidations for a given state.
	PendingConsolidations(ctx context.Context,
		opts *api.PendingConsolidationsOpts,
	) (
		*api.Response[[]*electra.PendingConsolidation],
		error,
	)
}

PendingConsolidationsProvider is the interface for providing pending consolidations.

type PendingDepositProvider

type PendingDepositProvider interface {
	// PendingDeposits provides the pending deposits for a given state.
	PendingDeposits(ctx context.Context,
		opts *api.PendingDepositsOpts,
	) (
		*api.Response[[]*electra.PendingDeposit],
		error,
	)
}

PendingDepositProvider is the interface for providing pending deposit information.

type PendingPartialWithdrawalsProvider

type PendingPartialWithdrawalsProvider interface {
	// PendingPartialWithdrawals provides the pending partial withdrawals for a given state.
	PendingPartialWithdrawals(ctx context.Context,
		opts *api.PendingPartialWithdrawalsOpts,
	) (
		*api.Response[[]*electra.PendingPartialWithdrawal],
		error,
	)
}

PendingPartialWithdrawalsProvider is the interface for providing pending partial withdrawals.

type ProposalPreparationsSubmitter

type ProposalPreparationsSubmitter interface {
	// SubmitProposalPreparations provides the beacon node with information required if a proposal for the given validators
	// shows up in the next epoch.
	SubmitProposalPreparations(ctx context.Context, preparations []*apiv1.ProposalPreparation) error
}

ProposalPreparationsSubmitter is the interface for submitting proposal preparations.

type ProposalProvider

type ProposalProvider interface {
	// Proposal fetches a proposal for signing.
	Proposal(ctx context.Context,
		opts *api.ProposalOpts,
	) (
		*api.Response[*api.VersionedProposal],
		error,
	)
}

ProposalProvider is the interface for providing proposals.

type ProposalSlashingSubmitter

type ProposalSlashingSubmitter interface {
	SubmitProposalSlashing(ctx context.Context, slashing *phase0.ProposerSlashing) error
}

ProposalSlashingSubmitter is the interface for submitting proposal slashings.

type ProposalSubmitter

type ProposalSubmitter interface {
	// SubmitProposal submits a proposal.
	SubmitProposal(ctx context.Context,
		opts *api.SubmitProposalOpts,
	) error
}

ProposalSubmitter is the interface for submitting proposals.

type ProposerDutiesProvider

type ProposerDutiesProvider interface {
	// ProposerDuties obtains proposer duties for the given options.
	ProposerDuties(ctx context.Context,
		opts *api.ProposerDutiesOpts,
	) (
		*api.Response[[]*apiv1.ProposerDuty],
		error,
	)
}

ProposerDutiesProvider is the interface for providing proposer duties.

type Service

type Service interface {
	// Name returns the name of the client implementation.
	Name() string

	// Address returns the address of the client.
	Address() string

	// IsActive returns true if the client is active.
	IsActive() bool

	// IsSynced returns true if the client is synced.
	IsSynced() bool
}

Service is the service providing a connection to an Ethereum 2 client.

type SignedBeaconBlockProvider

type SignedBeaconBlockProvider interface {
	// SignedBeaconBlock fetches a signed beacon block given a block ID.
	SignedBeaconBlock(ctx context.Context,
		opts *api.SignedBeaconBlockOpts,
	) (
		*api.Response[*spec.VersionedSignedBeaconBlock],
		error,
	)

	// AgnosticSignedBeaconBlock fetches a signed beacon block given a block ID
	// and returns it as a fork-agnostic *all.SignedBeaconBlock.
	AgnosticSignedBeaconBlock(ctx context.Context,
		opts *api.SignedBeaconBlockOpts,
	) (
		*api.Response[*all.SignedBeaconBlock],
		error,
	)
}

SignedBeaconBlockProvider is the interface for providing beacon blocks.

type SlotDurationProvider

type SlotDurationProvider interface {
	// SlotDuration provides the duration of a slot of the chain.
	//
	// Deprecated: use Spec()
	SlotDuration(ctx context.Context) (time.Duration, error)
}

SlotDurationProvider is the interface for providing the duration of each slot of a chain.

type SlotFromStateIDProvider

type SlotFromStateIDProvider interface {
	// SlotFromStateID converts a state ID to its slot.
	//
	// Deprecated: will be removed in a future release.
	SlotFromStateID(ctx context.Context, stateID string) (phase0.Slot, error)
}

SlotFromStateIDProvider is the interface for providing slots from state IDs.

type SlotsPerEpochProvider

type SlotsPerEpochProvider interface {
	// SlotsPerEpoch provides the slots per epoch of the chain.
	//
	// Deprecated: use Spec()
	SlotsPerEpoch(ctx context.Context) (uint64, error)
}

SlotsPerEpochProvider is the interface for providing the number of slots in each epoch of a chain.

type SpecProvider

type SpecProvider interface {
	// Spec provides the spec information of the chain.
	Spec(ctx context.Context,
		opts *api.SpecOpts,
	) (
		*api.Response[map[string]any],
		error,
	)
}

SpecProvider is the interface for providing spec data.

type SyncCommitteeContributionProvider

type SyncCommitteeContributionProvider interface {
	// SyncCommitteeContribution provides a sync committee contribution.
	SyncCommitteeContribution(ctx context.Context,
		opts *api.SyncCommitteeContributionOpts,
	) (
		*api.Response[*altair.SyncCommitteeContribution],
		error,
	)
}

SyncCommitteeContributionProvider is the interface for providing sync committee contributions.

type SyncCommitteeContributionsSubmitter

type SyncCommitteeContributionsSubmitter interface {
	// SubmitSyncCommitteeContributions submits sync committee contributions.
	SubmitSyncCommitteeContributions(ctx context.Context, contributionAndProofs []*altair.SignedContributionAndProof) error
}

SyncCommitteeContributionsSubmitter is the interface for submitting sync committee contributions.

type SyncCommitteeDutiesProvider

type SyncCommitteeDutiesProvider interface {
	// SyncCommitteeDuties obtains sync committee duties.
	// If validatorIndices is nil it will return all duties for the given epoch.
	SyncCommitteeDuties(ctx context.Context,
		opts *api.SyncCommitteeDutiesOpts,
	) (
		*api.Response[[]*apiv1.SyncCommitteeDuty],
		error,
	)
}

SyncCommitteeDutiesProvider is the interface for providing sync committee duties.

type SyncCommitteeMessagesSubmitter

type SyncCommitteeMessagesSubmitter interface {
	// SubmitSyncCommitteeMessages submits sync committee messages.
	SubmitSyncCommitteeMessages(ctx context.Context, messages []*altair.SyncCommitteeMessage) error
}

SyncCommitteeMessagesSubmitter is the interface for submitting sync committee messages.

type SyncCommitteeRewardsProvider

type SyncCommitteeRewardsProvider interface {
	// SyncCommitteeRewards provides rewards to the given validators for being members of a sync committee.
	SyncCommitteeRewards(ctx context.Context,
		opts *api.SyncCommitteeRewardsOpts,
	) (
		*api.Response[[]*apiv1.SyncCommitteeReward],
		error,
	)
}

SyncCommitteeRewardsProvider is the interface for providing sync committee rewards.

type SyncCommitteeSubscriptionsSubmitter

type SyncCommitteeSubscriptionsSubmitter interface {
	// SubmitSyncCommitteeSubscriptions subscribes to sync committees.
	SubmitSyncCommitteeSubscriptions(ctx context.Context, subscriptions []*apiv1.SyncCommitteeSubscription) error
}

SyncCommitteeSubscriptionsSubmitter is the interface for submitting sync committee subnet subscription requests.

type SyncCommitteesProvider

type SyncCommitteesProvider interface {
	// SyncCommittee fetches the sync committee for the given state.
	SyncCommittee(ctx context.Context,
		opts *api.SyncCommitteeOpts,
	) (
		*api.Response[*apiv1.SyncCommittee],
		error,
	)
}

SyncCommitteesProvider is the interface for providing sync committees.

type SyncStateProvider

type SyncStateProvider interface {
	// SyncState provides the state of the node's synchronization with the chain.
	//
	// Deprecated: use NodeSyncing()
	SyncState(ctx context.Context) (*apiv1.SyncState, error)
}

SyncStateProvider is the interface for providing synchronization state.

type TargetAggregatorsPerCommitteeProvider

type TargetAggregatorsPerCommitteeProvider interface {
	// TargetAggregatorsPerCommittee provides the target number of aggregators for each attestation committee.
	//
	// Deprecated: use Spec()
	TargetAggregatorsPerCommittee(ctx context.Context) (uint64, error)
}

TargetAggregatorsPerCommitteeProvider is the interface for providing the target number of aggregators in each attestation committee.

type ValidatorBalancesProvider

type ValidatorBalancesProvider interface {
	// ValidatorBalances provides the validator balances for the given options.
	ValidatorBalances(ctx context.Context,
		opts *api.ValidatorBalancesOpts,
	) (
		*api.Response[map[phase0.ValidatorIndex]phase0.Gwei],
		error,
	)
}

ValidatorBalancesProvider is the interface for providing validator balances.

type ValidatorIDProvider

type ValidatorIDProvider interface {
	ValidatorIndexProvider
	ValidatorPubKeyProvider
}

ValidatorIDProvider is the interface that provides the identifiers (pubkey, index) of a validator.

type ValidatorIndexProvider

type ValidatorIndexProvider interface {
	// Index provides the index of the validator.
	Index(ctx context.Context) (phase0.ValidatorIndex, error)
}

ValidatorIndexProvider is the interface for entities that can provide the index of a validator.

type ValidatorLivenessProvider

type ValidatorLivenessProvider interface {
	// ValidatorLiveness provides the liveness data to the given validators.
	ValidatorLiveness(ctx context.Context,
		opts *api.ValidatorLivenessOpts,
	) (
		*api.Response[[]*apiv1.ValidatorLiveness],
		error,
	)
}

ValidatorLivenessProvider is the interface for providing validator liveness data.

type ValidatorPubKeyProvider

type ValidatorPubKeyProvider interface {
	// PubKey provides the public key of the validator.
	PubKey(ctx context.Context) (phase0.BLSPubKey, error)
}

ValidatorPubKeyProvider is the interface for entities that can provide the public key of a validator.

type ValidatorRegistrationsSubmitter

type ValidatorRegistrationsSubmitter interface {
	// SubmitValidatorRegistrations submits a validator registration.
	SubmitValidatorRegistrations(ctx context.Context, registrations []*api.VersionedSignedValidatorRegistration) error
}

ValidatorRegistrationsSubmitter is the interface for submitting validator registrations.

type ValidatorsProvider

type ValidatorsProvider interface {
	// Validators provides the validators, with their balance and status, for the given options.
	Validators(ctx context.Context,
		opts *api.ValidatorsOpts,
	) (
		*api.Response[map[phase0.ValidatorIndex]*apiv1.Validator],
		error,
	)
}

ValidatorsProvider is the interface for providing validator information.

type VoluntaryExitPoolProvider

type VoluntaryExitPoolProvider interface {
	// VoluntaryExitPool fetches the voluntary exit pool.
	VoluntaryExitPool(ctx context.Context,
		opts *api.VoluntaryExitPoolOpts,
	) (
		*api.Response[[]*phase0.SignedVoluntaryExit],
		error,
	)
}

VoluntaryExitPoolProvider is the interface for providing voluntary exit pools.

type VoluntaryExitSubmitter

type VoluntaryExitSubmitter interface {
	// SubmitVoluntaryExit submits a voluntary exit.
	SubmitVoluntaryExit(ctx context.Context, voluntaryExit *phase0.SignedVoluntaryExit) error
}

VoluntaryExitSubmitter is the interface for submitting voluntary exits.

Directories

Path Synopsis
api
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
metadata
Package metadata contains keys for well-known metadata fields provided in an API response.
Package metadata contains keys for well-known metadata fields provided in an API response.
v1
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v1/bellatrix
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v1/capella
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v1/deneb
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v1/electra
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v1/fulu
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
v2
Package metrics tracks various metrics that measure the performance of vouch.
Package metrics tracks various metrics that measure the performance of vouch.
all
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
altair
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
bellatrix
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
capella
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
deneb
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
electra
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
fulu
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
gloas
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
heze
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
phase0
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
util
bellatrix
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
capella
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
deneb
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
electra
Code generated by dynamic-ssz.
Code generated by dynamic-ssz.
proof
Package proof provides helper functions for merkle tree operations.
Package proof provides helper functions for merkle tree operations.

Jump to

Keyboard shortcuts

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