Documentation ¶
Overview ¶
Package beaconv1 defines a gRPC beacon service implementation, following the official API standards https://ethereum.github.io/eth2.0-APIs/#/. This package includes the beacon and config endpoints.
Index ¶
- type Server
- func (bs *Server) GetBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockResponse, error)
- func (bs *Server) GetBlockHeader(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockHeaderResponse, error)
- func (bs *Server) GetBlockRoot(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockRootResponse, error)
- func (bs *Server) GetDepositContract(ctx context.Context, _ *ptypes.Empty) (*ethpb.DepositContractResponse, error)
- func (bs *Server) GetFinalityCheckpoints(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateFinalityCheckpointResponse, error)
- func (bs *Server) GetForkSchedule(ctx context.Context, _ *ptypes.Empty) (*ethpb.ForkScheduleResponse, error)
- func (bs *Server) GetGenesis(ctx context.Context, _ *ptypes.Empty) (*ethpb.GenesisResponse, error)
- func (bs *Server) GetSpec(ctx context.Context, _ *ptypes.Empty) (*ethpb.SpecResponse, error)
- func (bs *Server) GetStateFork(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateForkResponse, error)
- func (bs *Server) GetStateRoot(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateRootResponse, error)
- func (bs *Server) GetValidator(ctx context.Context, req *ethpb.StateValidatorRequest) (*ethpb.StateValidatorResponse, error)
- func (bs *Server) ListBlockAttestations(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockAttestationsResponse, error)
- func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersRequest) (*ethpb.BlockHeadersResponse, error)
- func (bs *Server) ListCommittees(ctx context.Context, req *ethpb.StateCommitteesRequest) (*ethpb.StateCommitteesResponse, error)
- func (bs *Server) ListPoolAttestations(ctx context.Context, req *ethpb.AttestationsPoolRequest) (*ethpb.AttestationsPoolResponse, error)
- func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, req *ptypes.Empty) (*ethpb.AttesterSlashingsPoolResponse, error)
- func (bs *Server) ListPoolProposerSlashings(ctx context.Context, req *ptypes.Empty) (*ethpb.ProposerSlashingPoolResponse, error)
- func (bs *Server) ListPoolVoluntaryExits(ctx context.Context, req *ptypes.Empty) (*ethpb.VoluntaryExitsPoolResponse, error)
- func (bs *Server) ListValidatorBalances(ctx context.Context, req *ethpb.ValidatorBalancesRequest) (*ethpb.ValidatorBalancesResponse, error)
- func (bs *Server) ListValidators(ctx context.Context, req *ethpb.StateValidatorsRequest) (*ethpb.StateValidatorsResponse, error)
- func (bs *Server) SubmitAttestation(ctx context.Context, req *ethpb.Attestation) (*ptypes.Empty, error)
- func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.AttesterSlashing) (*ptypes.Empty, error)
- func (bs *Server) SubmitBlock(ctx context.Context, req *ethpb.BeaconBlockContainer) (*ptypes.Empty, error)
- func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpb.ProposerSlashing) (*ptypes.Empty, error)
- func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*ptypes.Empty, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct { BeaconDB db.ReadOnlyDatabase Ctx context.Context ChainStartFetcher powchain.ChainStartFetcher ChainInfoFetcher blockchain.ChainInfoFetcher DepositFetcher depositcache.DepositFetcher BlockFetcher powchain.POWBlockFetcher GenesisTimeFetcher blockchain.TimeFetcher BlockReceiver blockchain.BlockReceiver StateNotifier statefeed.Notifier BlockNotifier blockfeed.Notifier AttestationNotifier operation.Notifier Broadcaster p2p.Broadcaster AttestationsPool attestations.Pool SlashingsPool slashings.PoolManager VoluntaryExitsPool voluntaryexits.PoolManager CanonicalStateChan chan *pbp2p.BeaconState ChainStartChan chan time.Time StateGenService stategen.StateManager SyncChecker sync.Checker }
Server defines a server implementation of the gRPC Beacon Chain service, providing RPC endpoints to access data relevant to the Ethereum 2.0 phase 0 beacon chain.
func (*Server) GetBlock ¶
func (bs *Server) GetBlock(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockResponse, error)
GetBlock retrieves block details for given block id.
func (*Server) GetBlockHeader ¶
func (bs *Server) GetBlockHeader(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockHeaderResponse, error)
GetBlockHeader retrieves block header for given block id.
func (*Server) GetBlockRoot ¶
func (bs *Server) GetBlockRoot(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockRootResponse, error)
GetBlockRoot retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader.
func (*Server) GetDepositContract ¶
func (bs *Server) GetDepositContract(ctx context.Context, _ *ptypes.Empty) (*ethpb.DepositContractResponse, error)
GetDepositContract retrieves deposit contract address and genesis fork version.
func (*Server) GetFinalityCheckpoints ¶
func (bs *Server) GetFinalityCheckpoints(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateFinalityCheckpointResponse, error)
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 (bs *Server) GetForkSchedule(ctx context.Context, _ *ptypes.Empty) (*ethpb.ForkScheduleResponse, error)
GetForkSchedule retrieve all scheduled upcoming forks this node is aware of.
func (*Server) GetGenesis ¶
GetGenesis retrieves details of the chain's genesis which can be used to identify chain.
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 (bs *Server) GetStateFork(ctx context.Context, req *ethpb.StateRequest) (*ethpb.StateForkResponse, error)
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 (bs *Server) GetValidator(ctx context.Context, req *ethpb.StateValidatorRequest) (*ethpb.StateValidatorResponse, error)
GetValidator returns a validator specified by state and id or public key along with status and balance.
func (*Server) ListBlockAttestations ¶
func (bs *Server) ListBlockAttestations(ctx context.Context, req *ethpb.BlockRequest) (*ethpb.BlockAttestationsResponse, error)
ListBlockAttestations retrieves attestation included in requested block.
func (*Server) ListBlockHeaders ¶
func (bs *Server) ListBlockHeaders(ctx context.Context, req *ethpb.BlockHeadersRequest) (*ethpb.BlockHeadersResponse, error)
ListBlockHeaders retrieves block headers matching given query. By default it will fetch current head slot blocks.
func (*Server) ListCommittees ¶
func (bs *Server) ListCommittees(ctx context.Context, req *ethpb.StateCommitteesRequest) (*ethpb.StateCommitteesResponse, error)
ListCommittees retrieves the committees for the given state at the given epoch.
func (*Server) ListPoolAttestations ¶
func (bs *Server) ListPoolAttestations(ctx context.Context, req *ethpb.AttestationsPoolRequest) (*ethpb.AttestationsPoolResponse, error)
ListPoolAttestations retrieves attestations known by the node but not necessarily incorporated into any block.
func (*Server) ListPoolAttesterSlashings ¶
func (bs *Server) ListPoolAttesterSlashings(ctx context.Context, req *ptypes.Empty) (*ethpb.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, req *ptypes.Empty) (*ethpb.ProposerSlashingPoolResponse, error)
ListPoolProposerSlashings retrieves proposer slashings known by the node but not necessarily incorporated into any block.
func (*Server) ListPoolVoluntaryExits ¶
func (bs *Server) ListPoolVoluntaryExits(ctx context.Context, req *ptypes.Empty) (*ethpb.VoluntaryExitsPoolResponse, error)
ListPoolVoluntaryExits retrieves voluntary exits known by the node but not necessarily incorporated into any block.
func (*Server) ListValidatorBalances ¶
func (bs *Server) ListValidatorBalances(ctx context.Context, req *ethpb.ValidatorBalancesRequest) (*ethpb.ValidatorBalancesResponse, error)
ListValidatorBalances returns a filterable list of validator balances.
func (*Server) ListValidators ¶
func (bs *Server) ListValidators(ctx context.Context, req *ethpb.StateValidatorsRequest) (*ethpb.StateValidatorsResponse, error)
ListValidators returns filterable list of validators with their balance, status and index.
func (*Server) SubmitAttestation ¶
func (bs *Server) SubmitAttestation(ctx context.Context, req *ethpb.Attestation) (*ptypes.Empty, error)
SubmitAttestation submits Attestation object to node. If attestation passes all validation constraints, node MUST publish attestation on appropriate subnet.
func (*Server) SubmitAttesterSlashing ¶
func (bs *Server) SubmitAttesterSlashing(ctx context.Context, req *ethpb.AttesterSlashing) (*ptypes.Empty, error)
SubmitAttesterSlashing submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitBlock ¶
func (bs *Server) SubmitBlock(ctx context.Context, req *ethpb.BeaconBlockContainer) (*ptypes.Empty, error)
SubmitBlock 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) 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).
func (*Server) SubmitProposerSlashing ¶
func (bs *Server) SubmitProposerSlashing(ctx context.Context, req *ethpb.ProposerSlashing) (*ptypes.Empty, error)
SubmitProposerSlashing submits AttesterSlashing object to node's pool and if passes validation node MUST broadcast it to network.
func (*Server) SubmitVoluntaryExit ¶
func (bs *Server) SubmitVoluntaryExit(ctx context.Context, req *ethpb.SignedVoluntaryExit) (*ptypes.Empty, error)
SubmitVoluntaryExit submits SignedVoluntaryExit object to node's pool and if passes validation node MUST broadcast it to network.