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 BLSToExecutionChangesPoolResponse
- type BlockRoot
- type BlockRootResponse
- type FinalityCheckpoints
- type Genesis
- type GetAttesterSlashingsResponse
- type GetBlockAttestationsResponse
- type GetBlockHeaderResponse
- type GetBlockHeadersResponse
- type GetBlockResponse
- type GetBlockV2Response
- type GetCommitteesResponse
- type GetFinalityCheckpointsResponse
- type GetGenesisResponse
- type GetProposerSlashingsResponse
- type GetRandaoResponse
- type GetStateForkResponse
- type GetStateRootResponse
- type GetSyncCommitteeResponse
- type GetValidatorBalancesResponse
- type GetValidatorResponse
- type GetValidatorsRequest
- type GetValidatorsResponse
- type ListAttestationsResponse
- type ListVoluntaryExitsResponse
- type Randao
- type Server
- func (s *Server) GetAttesterSlashings(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlindedBlock(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlock(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetBlockAttestations(w http.ResponseWriter, r *http.Request)
- 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 (s *Server) GetBlockV2(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetCommittees(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetFinalityCheckpoints(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetGenesis(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetProposerSlashings(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetRandao(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetStateFork(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetStateRoot(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetSyncCommittees(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetValidator(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetValidatorBalances(w http.ResponseWriter, r *http.Request)
- func (s *Server) GetValidators(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListAttestations(w http.ResponseWriter, r *http.Request)
- func (s *Server) ListBLSToExecutionChanges(w http.ResponseWriter, r *http.Request)
- 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 (s *Server) SubmitAttesterSlashing(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitBLSToExecutionChanges(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitProposerSlashing(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitSyncCommitteeSignatures(w http.ResponseWriter, r *http.Request)
- func (s *Server) SubmitVoluntaryExit(w http.ResponseWriter, r *http.Request)
- type SignedBlock
- type StateRoot
- type SubmitAttestationsRequest
- type SubmitSyncCommitteeSignaturesRequest
- type SyncCommitteeValidators
- type Validator
- type ValidatorBalance
- type ValidatorContainer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BLSToExecutionChangesPoolResponse ¶ added in v4.2.0
type BLSToExecutionChangesPoolResponse struct {
Data []*shared.SignedBLSToExecutionChange `json:"data"`
}
type BlockRootResponse ¶ added in v4.1.0
type FinalityCheckpoints ¶ added in v4.1.0
type FinalityCheckpoints struct { PreviousJustified *shared.Checkpoint `json:"previous_justified"` CurrentJustified *shared.Checkpoint `json:"current_justified"` Finalized *shared.Checkpoint `json:"finalized"` }
type GetAttesterSlashingsResponse ¶ added in v4.2.0
type GetAttesterSlashingsResponse struct {
Data []*shared.AttesterSlashing `json:"data"`
}
type GetBlockAttestationsResponse ¶ added in v4.2.0
type GetBlockAttestationsResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data []*shared.Attestation `json:"data"` }
type GetBlockHeaderResponse ¶ added in v4.1.0
type GetBlockHeaderResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *shared.SignedBeaconBlockHeaderContainer `json:"data"` }
type GetBlockHeadersResponse ¶ added in v4.1.0
type GetBlockHeadersResponse struct { Data []*shared.SignedBeaconBlockHeaderContainer `json:"data"` ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` }
type GetBlockResponse ¶ added in v4.2.0
type GetBlockResponse struct {
Data *SignedBlock `json:"data"`
}
type GetBlockV2Response ¶ added in v4.2.0
type GetBlockV2Response struct { Version string `json:"version"` ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *SignedBlock `json:"data"` }
type GetCommitteesResponse ¶ added in v4.1.0
type GetFinalityCheckpointsResponse ¶ added in v4.1.0
type GetFinalityCheckpointsResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *FinalityCheckpoints `json:"data"` }
type GetGenesisResponse ¶ added in v4.1.0
type GetGenesisResponse struct {
Data *Genesis `json:"data"`
}
type GetProposerSlashingsResponse ¶ added in v4.2.0
type GetProposerSlashingsResponse struct {
Data []*shared.ProposerSlashing `json:"data"`
}
type GetRandaoResponse ¶ added in v4.2.0
type GetStateForkResponse ¶ added in v4.1.0
type GetStateRootResponse ¶ added in v4.2.0
type GetSyncCommitteeResponse ¶ added in v4.2.0
type GetSyncCommitteeResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *SyncCommitteeValidators `json:"data"` }
type GetValidatorBalancesResponse ¶ added in v4.1.0
type GetValidatorBalancesResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data []*ValidatorBalance `json:"data"` }
type GetValidatorResponse ¶ added in v4.1.0
type GetValidatorResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data *ValidatorContainer `json:"data"` }
type GetValidatorsRequest ¶ added in v4.2.0
type GetValidatorsResponse ¶ added in v4.1.0
type GetValidatorsResponse struct { ExecutionOptimistic bool `json:"execution_optimistic"` Finalized bool `json:"finalized"` Data []*ValidatorContainer `json:"data"` }
type ListAttestationsResponse ¶ added in v4.1.0
type ListAttestationsResponse struct {
Data []*shared.Attestation `json:"data"`
}
type ListVoluntaryExitsResponse ¶ added in v4.1.0
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.PayloadReconstructor 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) GetAttesterSlashings ¶ added in v4.2.0
func (s *Server) GetAttesterSlashings(w http.ResponseWriter, r *http.Request)
GetAttesterSlashings retrieves attester slashings known by the node but not necessarily incorporated into any block.
func (*Server) GetBlindedBlock ¶
func (s *Server) GetBlindedBlock(w http.ResponseWriter, r *http.Request)
GetBlindedBlock retrieves blinded block for given block id.
func (*Server) GetBlock ¶
func (s *Server) GetBlock(w http.ResponseWriter, r *http.Request)
GetBlock retrieves block details for given block ID.
DEPRECATED: please use GetBlockV2 instead
func (*Server) GetBlockAttestations ¶ added in v4.2.0
func (s *Server) GetBlockAttestations(w http.ResponseWriter, r *http.Request)
GetBlockAttestations retrieves attestation included in requested block.
func (*Server) GetBlockHeader ¶
func (s *Server) GetBlockHeader(w http.ResponseWriter, r *http.Request)
GetBlockHeader retrieves block header for given block id.
func (*Server) GetBlockHeaders ¶ added in v4.1.0
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) GetBlockV2 ¶
func (s *Server) GetBlockV2(w http.ResponseWriter, r *http.Request)
GetBlockV2 retrieves block details for given block ID.
func (*Server) GetCommittees ¶ added in v4.1.0
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) 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) 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) GetProposerSlashings ¶ added in v4.2.0
func (s *Server) GetProposerSlashings(w http.ResponseWriter, r *http.Request)
GetProposerSlashings retrieves proposer slashings known by the node but not necessarily incorporated into any block.
func (*Server) GetRandao ¶
func (s *Server) GetRandao(w http.ResponseWriter, r *http.Request)
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) GetStateFork ¶
func (s *Server) GetStateFork(w http.ResponseWriter, r *http.Request)
GetStateFork returns Fork object for state with given 'stateId'.
func (*Server) GetStateRoot ¶
func (s *Server) GetStateRoot(w http.ResponseWriter, r *http.Request)
GetStateRoot calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned.
func (*Server) GetSyncCommittees ¶ added in v4.2.0
func (s *Server) GetSyncCommittees(w http.ResponseWriter, r *http.Request)
GetSyncCommittees 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) 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 ¶ added in v4.1.0
func (s *Server) GetValidatorBalances(w http.ResponseWriter, r *http.Request)
GetValidatorBalances returns a filterable list of validator balances.
func (*Server) GetValidators ¶ added in v4.1.0
func (s *Server) GetValidators(w http.ResponseWriter, r *http.Request)
GetValidators returns filterable list of validators with their balance, status and index.
func (*Server) ListAttestations ¶ added in v4.1.0
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 (s *Server) ListBLSToExecutionChanges(w http.ResponseWriter, r *http.Request)
ListBLSToExecutionChanges retrieves BLS to execution changes known by the node but not necessarily incorporated into any block
func (*Server) ListVoluntaryExits ¶ added in v4.1.0
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 ¶ added in v4.1.0
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 ¶ added in v4.0.6
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 ¶ added in v4.1.0
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 ¶ added in v4.0.6
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 (s *Server) SubmitAttesterSlashing(w http.ResponseWriter, r *http.Request)
SubmitAttesterSlashing submits an attester slashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitBLSToExecutionChanges ¶ added in v4.2.0
func (s *Server) SubmitBLSToExecutionChanges(w http.ResponseWriter, r *http.Request)
SubmitBLSToExecutionChanges submits said object to the node's pool if it passes validation the node must broadcast it to the network.
func (*Server) SubmitProposerSlashing ¶
func (s *Server) SubmitProposerSlashing(w http.ResponseWriter, r *http.Request)
SubmitProposerSlashing submits a proposer slashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitSyncCommitteeSignatures ¶ added in v4.1.0
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 SignedBlock ¶ added in v4.2.0
type SignedBlock struct { Message json.RawMessage `json:"message"` // represents the block values based on the version Signature string `json:"signature"` }
type SubmitAttestationsRequest ¶ added in v4.1.0
type SubmitAttestationsRequest struct {
Data []*shared.Attestation `json:"data"`
}
type SubmitSyncCommitteeSignaturesRequest ¶ added in v4.1.0
type SubmitSyncCommitteeSignaturesRequest struct {
Data []*shared.SyncCommitteeMessage `json:"data"`
}
type SyncCommitteeValidators ¶ added in v4.2.0
type Validator ¶ added in v4.1.0
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"` }