beaconapi

package
v0.0.0-...-5f8afbd Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 5 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Block

func Block(ctx context.Context, cli eth2api.Client, blockId eth2api.BlockId, dest *phase0.SignedBeaconBlock) (exists bool, err error)

Retrieves block details for given block id.

func BlockAttestations

func BlockAttestations(ctx context.Context, cli eth2api.Client, blockId eth2api.BlockId, dest *[]phase0.Attestation) (exists bool, err error)

Retrieves attestations included in requested block.

func BlockHeader

func BlockHeader(ctx context.Context, cli eth2api.Client, blockId eth2api.BlockId, dest *eth2api.BeaconBlockHeaderAndInfo) (exists bool, err error)

Retrieves block header for given block id.

func BlockHeaders

func BlockHeaders(ctx context.Context, cli eth2api.Client, slot *common.Slot, parentRoot *common.Root, dest *[]eth2api.BeaconBlockHeaderAndInfo) (exists bool, err error)

Retrieves block headers matching given query. By default it will fetch current head slot blocks.

func BlockRoot

func BlockRoot(ctx context.Context, cli eth2api.Client, blockId eth2api.BlockId) (root common.Root, exists bool, err error)

Retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader.

func BlockV2

func BlockV2(ctx context.Context, cli eth2api.Client, blockId eth2api.BlockId, dest *eth2api.VersionedSignedBeaconBlock) (exists bool, err error)

Retrieves block details for given block id.

func EpochCommittees

func EpochCommittees(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId,
	epoch *common.Epoch,
	index *common.CommitteeIndex,
	slot *common.Slot,
	dest *[]eth2api.Committee) (exists bool, err error)

Retrieves the committees for the given state.

Optional query parameters: - epoch: Fetch committees for the given epoch. If not present then the committees for the epoch of the state will be obtained. - index: Restrict returned values to those matching the supplied committee index. - slot: Restrict returned values to those matching the supplied slot.

func FinalityCheckpoints

func FinalityCheckpoints(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId, dest *eth2api.FinalityCheckpoints) (exists bool, err error)

Returns finality checkpoints for state with given 'stateId'. In case finality is not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root.

func Fork

func Fork(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId, dest *common.Fork) (exists bool, err error)

Returns Fork object for state with given 'stateId'

func Genesis

func Genesis(ctx context.Context, cli eth2api.Client, dest *eth2api.GenesisResponse) (exists bool, err error)

Retrieve details of the chain's genesis which can be used to identify chain.

func PoolAttestations

func PoolAttestations(ctx context.Context, cli eth2api.Client, slot *common.Slot, committeeIndex *common.CommitteeIndex, dest *[]phase0.Attestation) error

Retrieves attestations known by the node but not necessarily incorporated into any block

func PoolAttesterSlashings

func PoolAttesterSlashings(ctx context.Context, cli eth2api.Client, dest *[]phase0.AttesterSlashing) error

Retrieves attester slashings known by the node but not necessarily incorporated into any block.

func PoolProposerSlashings

func PoolProposerSlashings(ctx context.Context, cli eth2api.Client, dest *[]phase0.ProposerSlashing) error

Retrieves proposer slashings known by the node but not necessarily incorporated into any block.

func PoolVoluntaryExits

func PoolVoluntaryExits(ctx context.Context, cli eth2api.Client, dest *[]phase0.SignedVoluntaryExit) error

Retrieves voluntary exits known by the node but not necessarily incorporated into any block.

func PublishBlock

func PublishBlock(ctx context.Context, cli eth2api.Client, block eth2api.SignedBeaconBlock) (valid bool, err error)

Instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be included in the beacon chain. The beacon node is not required to validate the signed `BeaconBlock`, and a successful response (20X, i.e. no error returned) only indicates that the broadcast has been successful. The beacon node is expected to integrate the new block into its state, and therefore validate the block internally, however blocks which fail the validation are still broadcast but a different status code is returned (202, `valid` will be false)

func StateRoot

func StateRoot(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId) (root common.Root, exists bool, err error)

Calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned.

func StateValidator

func StateValidator(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId, validatorId eth2api.ValidatorId, dest *eth2api.ValidatorResponse) (exists bool, err error)

Returns validator specified by state and id or public key along with status and balance.

func StateValidatorBalances

func StateValidatorBalances(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId, validatorIds []eth2api.ValidatorId, dest *[]eth2api.ValidatorBalanceResponse) (exists bool, err error)

Returns filterable list of validator balances.

Note that any invalid validators with invalid IDs may be ignored, and omitted from the otherwise valid response.

func StateValidators

func StateValidators(ctx context.Context, cli eth2api.Client,
	stateId eth2api.StateId, validatorIds []eth2api.ValidatorId, statusFilter []eth2api.ValidatorStatus, dest *[]eth2api.ValidatorResponse) (exists bool, err error)

Returns filterable list of validators with their balance, status and index. The status filter is optional, and filters the query to just the given set of status enum values.

Note that any invalid validators with invalid IDs may be ignored, and omitted from the otherwise valid response.

func SubmitAttestations

func SubmitAttestations(ctx context.Context, cli eth2api.Client, attestations []phase0.Attestation) (failures []eth2api.IndexedErrorMessageItem, err error)

Submits Attestation objects to the node. Each attestation in the request body is processed individually.

If an attestation is validated successfully the node MUST publish that attestation on the appropriate subnet.

If one or more attestations fail validation the node MUST return a 400 error with details of which attestations have failed, and why. In that case, a non-nil list of errors will be returned, with entries pointing to original array indices of input attestations

func SubmitAttesterSlashing

func SubmitAttesterSlashing(ctx context.Context, cli eth2api.Client, attSlashing *phase0.AttesterSlashing) error

Submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.

func SubmitBLSToExecutionChanges

func SubmitBLSToExecutionChanges(ctx context.Context, cli eth2api.Client, changes common.SignedBLSToExecutionChanges) error

Submits SignedBLSToExecutionChanges object to node's pool and if passes validation node MUST broadcast it to network.

func SubmitProposerSlashing

func SubmitProposerSlashing(ctx context.Context, cli eth2api.Client, propSlashing *phase0.ProposerSlashing) error

Submits ProposerSlashing object to node's pool and if passes validation node MUST broadcast it to network.

func SubmitSyncCommitteeMessages

func SubmitSyncCommitteeMessages(ctx context.Context, cli eth2api.Client, messages []altair.SyncCommitteeMessage) error

Submits sync committee signature objects to the node.

If a sync committee signature is validated successfully the node MUST publish that sync committee signature on all applicable subnets.

If one or more sync committee signatures fail validation the node MUST return a 400 error with details of which sync committee signatures have failed, and why.

func SubmitVoluntaryExit

func SubmitVoluntaryExit(ctx context.Context, cli eth2api.Client, exit *phase0.SignedVoluntaryExit) error

Submits SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network.

func SyncCommittees

func SyncCommittees(ctx context.Context, cli eth2api.Client, stateId eth2api.StateId,
	epoch *common.Epoch, dest *eth2api.SyncCommittees) (exists bool, err error)

Retrieves the sync committees for the given state. Optionally by epoch (defaults to epoch current to the state).

Types

This section is empty.

Jump to

Keyboard shortcuts

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