Documentation ¶
Overview ¶
Package beacon defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/. This package includes the beacon and config endpoints.
Index ¶
- type BlockRootResponse
- type DepositContractResponse
- type FinalityCheckpoints
- type Genesis
- type GetBlockHeaderResponse
- type GetBlockHeadersResponse
- type GetCommitteesResponse
- type GetFinalityCheckpointsResponse
- type GetGenesisResponse
- type GetStateForkResponse
- type GetValidatorBalancesResponse
- type GetValidatorResponse
- type GetValidatorsResponse
- type ListAttestationsResponse
- type ListVoluntaryExitsResponse
- type Server
- func (bs *Server) GetBlindedBlock(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv2.BlindedBlockResponse, error)
- func (bs *Server) GetBlindedBlockSSZ(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv2.SSZContainer, error)
- func (bs *Server) GetBlock(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockResponse, error)
- func (s *Server) GetBlockHeader(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlockHeaders(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlockRoot(w http.ResponseWriter, r *http.Request)
- func (bs *Server) GetBlockSSZ(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockSSZResponse, error)
- func (bs *Server) GetBlockSSZV2(ctx context.Context, req *ethpbv2.BlockRequestV2) (*ethpbv2.SSZContainer, error)
- func (bs *Server) GetBlockV2(ctx context.Context, req *ethpbv2.BlockRequestV2) (*ethpbv2.BlockResponseV2, error)
- func (s *Server) GetCommittees(w http.ResponseWriter, r *http.Request)
- func (*Server) GetDepositContract(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetFinalityCheckpoints(w http.ResponseWriter, r *http.Request)
- func (_ *Server) GetForkSchedule(ctx context.Context, _ *emptypb.Empty) (*ethpb.ForkScheduleResponse, error)
- func (s *Server) GetGenesis(w http.ResponseWriter, r *http.Request)
- func (bs *Server) GetRandao(ctx context.Context, req *eth2.RandaoRequest) (*eth2.RandaoResponse, error)
- func (_ *Server) GetSpec(ctx context.Context, _ *emptypb.Empty) (*ethpb.SpecResponse, error)
- func (s *Server) GetStateFork(w http.ResponseWriter, r *http.Request)
- func (bs *Server) GetStateRoot(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateRootResponse, error)
- func (s *Server) GetValidator(w http.ResponseWriter, r *http.Request)
- func (bs *Server) GetValidatorBalances(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetValidators(w http.ResponseWriter, r *http.Request)
- func (bs *Server) GetWeakSubjectivity(ctx context.Context, _ *empty.Empty) (*ethpbv1.WeakSubjectivityResponse, error)
- func (s *Server) ListAttestations(w http.ResponseWriter, r *http.Request)
- func (bs *Server) ListBLSToExecutionChanges(ctx context.Context, _ *emptypb.Empty) (*ethpbv2.BLSToExecutionChangesPoolResponse, error)
- func (bs *Server) ListBlockAttestations(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockAttestationsResponse, error)
- func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, _ *emptypb.Empty) (*ethpbv1.AttesterSlashingsPoolResponse, error)
- func (bs *Server) ListPoolProposerSlashings(ctx context.Context, _ *emptypb.Empty) (*ethpbv1.ProposerSlashingPoolResponse, error)
- func (bs *Server) ListSyncCommittees(ctx context.Context, req *ethpbv2.StateSyncCommitteesRequest) (*ethpbv2.StateSyncCommitteesResponse, error)
- func (s *Server) ListVoluntaryExits(w http.ResponseWriter, r *http.Request)
- func (s *Server) PublishBlindedBlock(w http.ResponseWriter, r *http.Request)
- func (s *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request)
- func (s *Server) PublishBlock(w http.ResponseWriter, r *http.Request)
- func (s *Server) PublishBlockV2(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitAttestations(w http.ResponseWriter, r *http.Request)
- func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpbv1.AttesterSlashing) (*emptypb.Empty, error)
- func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpbv1.ProposerSlashing) (*emptypb.Empty, error)
- func (bs *Server) SubmitSignedBLSToExecutionChanges(ctx context.Context, req *ethpbv2.SubmitBLSToExecutionChangesRequest) (*emptypb.Empty, error)
- func (s *Server) SubmitSyncCommitteeSignatures(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitVoluntaryExit(w http.ResponseWriter, r *http.Request)
- type SubmitAttestationsRequest
- type SubmitSyncCommitteeSignaturesRequest
- type Validator
- type ValidatorBalance
- type ValidatorContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockRootResponse ¶
type DepositContractResponse ¶
type FinalityCheckpoints ¶
type FinalityCheckpoints struct { PreviousJustified *shared.Checkpoint `json:"previous_justified"` CurrentJustified *shared.Checkpoint `json:"current_justified"` Finalized *shared.Checkpoint `json:"finalized"` }
type GetBlockHeaderResponse ¶
type GetBlockHeaderResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *shared.SignedBeaconBlockHeaderContainer `json:"data"` }
type GetBlockHeadersResponse ¶
type GetBlockHeadersResponse struct { Data []*shared.SignedBeaconBlockHeaderContainer `json:"data"` ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` }
type GetCommitteesResponse ¶
type GetFinalityCheckpointsResponse ¶
type GetFinalityCheckpointsResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *FinalityCheckpoints `json:"data"` }
type GetGenesisResponse ¶
type GetGenesisResponse struct {
Data *Genesis `json:"data"`
}
type GetStateForkResponse ¶
type GetValidatorBalancesResponse ¶
type GetValidatorBalancesResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data []*ValidatorBalance `json:"data"` }
type GetValidatorResponse ¶
type GetValidatorResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *ValidatorContainer `json:"data"` }
type GetValidatorsResponse ¶
type GetValidatorsResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data []*ValidatorContainer `json:"data"` }
type ListAttestationsResponse ¶
type ListAttestationsResponse struct {
Data []*shared.Attestation `json:"data"`
}
type ListVoluntaryExitsResponse ¶
type ListVoluntaryExitsResponse struct {
Data []*shared.SignedVoluntaryExit `json:"data"`
}
type Server ¶
type Server struct { BeaconDB db.ReadOnlyDatabase ChainInfoFetcher blockchain.ChainInfoFetcher GenesisTimeFetcher blockchain.TimeFetcher BlockReceiver blockchain.BlockReceiver BlockNotifier blockfeed.Notifier OperationNotifier operation.Notifier Broadcaster p2p.Broadcaster AttestationsPool attestations.Pool SlashingsPool slashings.PoolManager VoluntaryExitsPool voluntaryexits.PoolManager StateGenService stategen.StateManager Stater lookup.Stater Blocker lookup.Blocker HeadFetcher blockchain.HeadFetcher TimeFetcher blockchain.TimeFetcher OptimisticModeFetcher blockchain.OptimisticModeFetcher V1Alpha1ValidatorServer eth.BeaconNodeValidatorServer SyncChecker sync.Checker CanonicalHistory *stategen.CanonicalHistory ExecutionPayloadReconstructor execution.ExecutionPayloadReconstructor FinalizationFetcher blockchain.FinalizationFetcher BLSChangesPool blstoexec.PoolManager ForkchoiceFetcher blockchain.ForkchoiceFetcher CoreService *core.Service }
Server defines a server implementation of the gRPC Beacon Chain service, providing RPC endpoints to access data relevant to the Ethereum Beacon Chain.
func (*Server) GetBlindedBlock ¶
func (bs *Server) GetBlindedBlock(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv2.BlindedBlockResponse, error)
GetBlindedBlock retrieves blinded block for given block id.
func (*Server) GetBlindedBlockSSZ ¶
func (bs *Server) GetBlindedBlockSSZ(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv2.SSZContainer, error)
GetBlindedBlockSSZ returns the SSZ-serialized version of the blinded beacon block for given block id.
func (*Server) GetBlock ¶
func (bs *Server) GetBlock(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockResponse, error)
GetBlock retrieves block details for given block ID. DEPRECATED: please use GetBlockV2 instead
func (*Server) GetBlockHeader ¶
func (s *Server) GetBlockHeader(w http.ResponseWriter, r *http.Request)
GetBlockHeader retrieves block header for given block id.
func (*Server) GetBlockHeaders ¶
func (s *Server) GetBlockHeaders(w http.ResponseWriter, r *http.Request)
GetBlockHeaders retrieves block headers matching given query. By default it will fetch current head slot blocks.
func (*Server) GetBlockRoot ¶
func (s *Server) GetBlockRoot(w http.ResponseWriter, r *http.Request)
GetBlockRoot retrieves the root of a block.
func (*Server) GetBlockSSZ ¶
func (bs *Server) GetBlockSSZ(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockSSZResponse, error)
GetBlockSSZ returns the SSZ-serialized version of the becaon block for given block ID. DEPRECATED: please use GetBlockV2SSZ instead
func (*Server) GetBlockSSZV2 ¶
func (bs *Server) GetBlockSSZV2(ctx context.Context, req *ethpbv2.BlockRequestV2) (*ethpbv2.SSZContainer, error)
GetBlockSSZV2 returns the SSZ-serialized version of the beacon block for given block ID.
func (*Server) GetBlockV2 ¶
func (bs *Server) GetBlockV2(ctx context.Context, req *ethpbv2.BlockRequestV2) (*ethpbv2.BlockResponseV2, error)
GetBlockV2 retrieves block details for given block ID.
func (*Server) GetCommittees ¶
func (s *Server) GetCommittees(w http.ResponseWriter, r *http.Request)
GetCommittees retrieves the committees for the given state at the given epoch. If the requested slot and index are defined, only those committees are returned.
func (*Server) GetDepositContract ¶
func (*Server) GetDepositContract(w http.ResponseWriter, r *http.Request)
GetDepositContract retrieves deposit contract address and genesis fork version.
func (*Server) GetFinalityCheckpoints ¶
func (s *Server) GetFinalityCheckpoints(w http.ResponseWriter, r *http.Request)
GetFinalityCheckpoints 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 (*Server) GetForkSchedule ¶
func (_ *Server) GetForkSchedule(ctx context.Context, _ *emptypb.Empty) (*ethpb.ForkScheduleResponse, error)
GetForkSchedule retrieve all scheduled upcoming forks this node is aware of.
func (*Server) GetGenesis ¶
func (s *Server) GetGenesis(w http.ResponseWriter, r *http.Request)
GetGenesis retrieves details of the chain's genesis which can be used to identify chain.
func (*Server) GetRandao ¶
func (bs *Server) GetRandao(ctx context.Context, req *eth2.RandaoRequest) (*eth2.RandaoResponse, error)
GetRandao fetches the RANDAO mix for the requested epoch from the state identified by state_id. If an epoch is not specified then the RANDAO mix for the state's current epoch will be returned. By adjusting the state_id parameter you can query for any historic value of the RANDAO mix. Ordinarily states from the same epoch will mutate the RANDAO mix for that epoch as blocks are applied.
func (*Server) GetSpec ¶
GetSpec retrieves specification configuration (without Phase 1 params) used on this node. Specification params list Values are returned with following format: - any value starting with 0x in the spec is returned as a hex string. - all other values are returned as number.
func (*Server) GetStateFork ¶
func (s *Server) GetStateFork(w http.ResponseWriter, r *http.Request)
GetStateFork returns Fork object for state with given 'stateId'.
func (*Server) GetStateRoot ¶
func (bs *Server) GetStateRoot(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateRootResponse, error)
GetStateRoot calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned.
func (*Server) GetValidator ¶
func (s *Server) GetValidator(w http.ResponseWriter, r *http.Request)
GetValidator returns a validator specified by state and id or public key along with status and balance.
func (*Server) GetValidatorBalances ¶
func (bs *Server) GetValidatorBalances(w http.ResponseWriter, r *http.Request)
GetValidatorBalances returns a filterable list of validator balances.
func (*Server) GetValidators ¶
func (s *Server) GetValidators(w http.ResponseWriter, r *http.Request)
GetValidators returns filterable list of validators with their balance, status and index.
func (*Server) GetWeakSubjectivity ¶
func (bs *Server) GetWeakSubjectivity(ctx context.Context, _ *empty.Empty) (*ethpbv1.WeakSubjectivityResponse, error)
GetWeakSubjectivity computes the starting epoch of the current weak subjectivity period, and then also determines the best block root and state root to use for a Checkpoint Sync starting from that point. DEPRECATED: GetWeakSubjectivity endpoint will no longer be supported
func (*Server) ListAttestations ¶
func (s *Server) ListAttestations(w http.ResponseWriter, r *http.Request)
ListAttestations retrieves attestations known by the node but not necessarily incorporated into any block. Allows filtering by committee index or slot.
func (*Server) ListBLSToExecutionChanges ¶
func (bs *Server) ListBLSToExecutionChanges(ctx context.Context, _ *emptypb.Empty) (*ethpbv2.BLSToExecutionChangesPoolResponse, error)
ListBLSToExecutionChanges retrieves BLS to execution changes known by the node but not necessarily incorporated into any block
func (*Server) ListBlockAttestations ¶
func (bs *Server) ListBlockAttestations(ctx context.Context, req *ethpbv1.BlockRequest) (*ethpbv1.BlockAttestationsResponse, error)
ListBlockAttestations retrieves attestation included in requested block.
func (*Server) ListPoolAttesterSlashings ¶
func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, _ *emptypb.Empty) (*ethpbv1.AttesterSlashingsPoolResponse, error)
ListPoolAttesterSlashings retrieves attester slashings known by the node but not necessarily incorporated into any block.
func (*Server) ListPoolProposerSlashings ¶
func (bs *Server) ListPoolProposerSlashings(ctx context.Context, _ *emptypb.Empty) (*ethpbv1.ProposerSlashingPoolResponse, error)
ListPoolProposerSlashings retrieves proposer slashings known by the node but not necessarily incorporated into any block.
func (*Server) ListSyncCommittees ¶
func (bs *Server) ListSyncCommittees(ctx context.Context, req *ethpbv2.StateSyncCommitteesRequest) (*ethpbv2.StateSyncCommitteesResponse, error)
ListSyncCommittees retrieves the sync committees for the given epoch. If the epoch is not passed in, then the sync committees for the epoch of the state will be obtained.
func (*Server) ListVoluntaryExits ¶
func (s *Server) ListVoluntaryExits(w http.ResponseWriter, r *http.Request)
ListVoluntaryExits retrieves voluntary exits known by the node but not necessarily incorporated into any block.
func (*Server) PublishBlindedBlock ¶
func (s *Server) PublishBlindedBlock(w http.ResponseWriter, r *http.Request)
PublishBlindedBlock instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a SignedBeaconBlock by swapping out the transactions_root for the corresponding full list of `transactions`. The beacon node should broadcast a newly constructed SignedBeaconBlock 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) 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). Pre-Bellatrix, this endpoint will accept a SignedBeaconBlock. After Deneb, this additionally instructs the beacon node to broadcast all given signed blobs.
func (*Server) PublishBlindedBlockV2 ¶
func (s *Server) PublishBlindedBlockV2(w http.ResponseWriter, r *http.Request)
PublishBlindedBlockV2 instructs the beacon node to use the components of the `SignedBlindedBeaconBlock` to construct and publish a `SignedBeaconBlock` by swapping out the `transactions_root` for the corresponding full list of `transactions`. The beacon node should broadcast a newly constructed `SignedBeaconBlock` 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) 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). Pre-Bellatrix, this endpoint will accept a `SignedBeaconBlock`. After Deneb, this additionally instructs the beacon node to broadcast all given signed blobs. The broadcast behaviour may be adjusted via the `broadcast_validation` query parameter.
func (*Server) PublishBlock ¶
func (s *Server) PublishBlock(w http.ResponseWriter, r *http.Request)
PublishBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be included in the beacon chain. A success response (20x) indicates that the block passed gossip validation and was successfully broadcast onto the network. The beacon node is also expected to integrate the block into state, but may broadcast it before doing so, so as to aid timely delivery of the block. Should the block fail full validation, a separate success response code (202) is used to indicate that the block was successfully broadcast but failed integration. After Deneb, this additionally instructs the beacon node to broadcast all given signed blobs.
func (*Server) PublishBlockV2 ¶
func (s *Server) PublishBlockV2(w http.ResponseWriter, r *http.Request)
PublishBlockV2 instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be included in the beacon chain. A success response (20x) indicates that the block passed gossip validation and was successfully broadcast onto the network. The beacon node is also expected to integrate the block into the state, but may broadcast it before doing so, so as to aid timely delivery of the block. Should the block fail full validation, a separate success response code (202) is used to indicate that the block was successfully broadcast but failed integration. After Deneb, this additionally instructs the beacon node to broadcast all given signed blobs. The broadcast behaviour may be adjusted via the `broadcast_validation` query parameter.
func (*Server) SubmitAttestations ¶
func (s *Server) SubmitAttestations(w http.ResponseWriter, r *http.Request)
SubmitAttestations submits an attestation object to node. If the attestation passes all validation constraints, node MUST publish the attestation on an appropriate subnet.
func (*Server) SubmitAttesterSlashing ¶
func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpbv1.AttesterSlashing) (*emptypb.Empty, error)
SubmitAttesterSlashing submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitProposerSlashing ¶
func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpbv1.ProposerSlashing) (*emptypb.Empty, error)
SubmitProposerSlashing submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitSignedBLSToExecutionChanges ¶
func (bs *Server) SubmitSignedBLSToExecutionChanges(ctx context.Context, req *ethpbv2.SubmitBLSToExecutionChangesRequest) (*emptypb.Empty, error)
SubmitSignedBLSToExecutionChanges submits said object to the node's pool if it passes validation the node must broadcast it to the network.
func (*Server) SubmitSyncCommitteeSignatures ¶
func (s *Server) SubmitSyncCommitteeSignatures(w http.ResponseWriter, r *http.Request)
SubmitSyncCommitteeSignatures submits sync committee signature objects to the node.
func (*Server) SubmitVoluntaryExit ¶
func (s *Server) SubmitVoluntaryExit(w http.ResponseWriter, r *http.Request)
SubmitVoluntaryExit submits a SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network.
type SubmitAttestationsRequest ¶
type SubmitAttestationsRequest struct {
Data []*shared.Attestation `json:"data"`
}
type SubmitSyncCommitteeSignaturesRequest ¶
type SubmitSyncCommitteeSignaturesRequest struct {
Data []*shared.SyncCommitteeMessage `json:"data"`
}
type Validator ¶
type Validator struct { Pubkey string `json:"pubkey"` WithdrawalCredentials string `json:"withdrawal_credentials"` EffectiveBalance string `json:"effective_balance"` Slashed bool `json:"slashed"` ActivationEligibilityEpoch string `json:"activation_eligibility_epoch"` ActivationEpoch string `json:"activation_epoch"` ExitEpoch string `json:"exit_epoch"` WithdrawableEpoch string `json:"withdrawable_epoch"` }