events

package
v4.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 23 Imported by: 4

Documentation

Overview

Package events defines a gRPC events service implementation, following the official API standards https://ethereum.github.io/beacon-apis/#/. This package includes the events endpoint.

Index

Constants

View Source
const (
	// HeadTopic represents a new chain head event topic.
	HeadTopic = "head"
	// BlockTopic represents a new produced block event topic.
	BlockTopic = "block"
	// AttestationTopic represents a new submitted attestation event topic.
	AttestationTopic = "attestation"
	// VoluntaryExitTopic represents a new performed voluntary exit event topic.
	VoluntaryExitTopic = "voluntary_exit"
	// FinalizedCheckpointTopic represents a new finalized checkpoint event topic.
	FinalizedCheckpointTopic = "finalized_checkpoint"
	// ChainReorgTopic represents a chain reorganization event topic.
	ChainReorgTopic = "chain_reorg"
	// SyncCommitteeContributionTopic represents a new sync committee contribution event topic.
	SyncCommitteeContributionTopic = "contribution_and_proof"
	// BLSToExecutionChangeTopic represents a new received BLS to execution change event topic.
	BLSToExecutionChangeTopic = "bls_to_execution_change"
	// PayloadAttributesTopic represents a new payload attributes for execution payload building event topic.
	PayloadAttributesTopic = "payload_attributes"
	// BlobSidecarTopic represents a new blob sidecar event topic
	BlobSidecarTopic = "blob_sidecar"
	// ProposerSlashingTopic represents a new proposer slashing event topic
	ProposerSlashingTopic = "proposer_slashing"
	// AttesterSlashingTopic represents a new attester slashing event topic
	AttesterSlashingTopic = "attester_slashing"
	// LightClientFinalityUpdateTopic represents a new light client finality update event topic.
	LightClientFinalityUpdateTopic = "light_client_finality_update"
	// LightClientOptimisticUpdateTopic represents a new light client optimistic update event topic.
	LightClientOptimisticUpdateTopic = "light_client_optimistic_update"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedAttEventSource added in v4.2.0

type AggregatedAttEventSource struct {
	Aggregate *shared.Attestation `json:"aggregate"`
}

type BlobSidecarEvent added in v4.2.0

type BlobSidecarEvent struct {
	BlockRoot     string `json:"block_root"`
	Index         string `json:"index"`
	Slot          string `json:"slot"`
	KzgCommitment string `json:"kzg_commitment"`
	VersionedHash string `json:"versioned_hash"`
}

type BlockEvent added in v4.2.0

type BlockEvent struct {
	Slot                string `json:"slot"`
	Block               string `json:"block"`
	ExecutionOptimistic bool   `json:"execution_optimistic"`
}

type ChainReorgEvent added in v4.2.0

type ChainReorgEvent struct {
	Slot                string `json:"slot"`
	Depth               string `json:"depth"`
	OldHeadBlock        string `json:"old_head_block"`
	NewHeadBlock        string `json:"old_head_state"`
	OldHeadState        string `json:"new_head_block"`
	NewHeadState        string `json:"new_head_state"`
	Epoch               string `json:"epoch"`
	ExecutionOptimistic bool   `json:"execution_optimistic"`
}

type FinalizedCheckpointEvent added in v4.2.0

type FinalizedCheckpointEvent struct {
	Block               string `json:"block"`
	State               string `json:"state"`
	Epoch               string `json:"epoch"`
	ExecutionOptimistic bool   `json:"execution_optimistic"`
}

type HeadEvent added in v4.2.0

type HeadEvent struct {
	Slot                      string `json:"slot"`
	Block                     string `json:"block"`
	State                     string `json:"state"`
	EpochTransition           bool   `json:"epoch_transition"`
	ExecutionOptimistic       bool   `json:"execution_optimistic"`
	PreviousDutyDependentRoot string `json:"previous_duty_dependent_root"`
	CurrentDutyDependentRoot  string `json:"current_duty_dependent_root"`
}

type LightClientFinalityUpdate added in v4.2.1

type LightClientFinalityUpdate struct {
	AttestedHeader  *shared.BeaconBlockHeader `json:"attested_header"`
	FinalizedHeader *shared.BeaconBlockHeader `json:"finalized_header"`
	FinalityBranch  []string                  `json:"finality_branch"`
	SyncAggregate   *shared.SyncAggregate     `json:"sync_aggregate"`
	SignatureSlot   string                    `json:"signature_slot"`
}

type LightClientFinalityUpdateEvent added in v4.2.1

type LightClientFinalityUpdateEvent struct {
	Version string                     `json:"version"`
	Data    *LightClientFinalityUpdate `json:"data"`
}

type LightClientOptimisticUpdate added in v4.2.1

type LightClientOptimisticUpdate struct {
	AttestedHeader *shared.BeaconBlockHeader `json:"attested_header"`
	SyncAggregate  *shared.SyncAggregate     `json:"sync_aggregate"`
	SignatureSlot  string                    `json:"signature_slot"`
}

type LightClientOptimisticUpdateEvent added in v4.2.1

type LightClientOptimisticUpdateEvent struct {
	Version string                       `json:"version"`
	Data    *LightClientOptimisticUpdate `json:"data"`
}

type PayloadAttributesEvent added in v4.2.0

type PayloadAttributesEvent struct {
	Version string          `json:"version"`
	Data    json.RawMessage `json:"data"`
}

type PayloadAttributesEventData added in v4.2.0

type PayloadAttributesEventData struct {
	ProposerIndex     string          `json:"proposer_index"`
	ProposalSlot      string          `json:"proposal_slot"`
	ParentBlockNumber string          `json:"parent_block_number"`
	ParentBlockRoot   string          `json:"parent_block_root"`
	ParentBlockHash   string          `json:"parent_block_hash"`
	PayloadAttributes json.RawMessage `json:"payload_attributes"`
}

type PayloadAttributesV1 added in v4.2.0

type PayloadAttributesV1 struct {
	Timestamp             string `json:"timestamp"`
	PrevRandao            string `json:"prev_randao"`
	SuggestedFeeRecipient string `json:"suggested_fee_recipient"`
}

type PayloadAttributesV2 added in v4.2.0

type PayloadAttributesV2 struct {
	Timestamp             string               `json:"timestamp"`
	PrevRandao            string               `json:"prev_randao"`
	SuggestedFeeRecipient string               `json:"suggested_fee_recipient"`
	Withdrawals           []*shared.Withdrawal `json:"withdrawals"`
}

type PayloadAttributesV3 added in v4.2.0

type PayloadAttributesV3 struct {
	Timestamp             string               `json:"timestamp"`
	PrevRandao            string               `json:"prev_randao"`
	SuggestedFeeRecipient string               `json:"suggested_fee_recipient"`
	Withdrawals           []*shared.Withdrawal `json:"withdrawals"`
	ParentBeaconBlockRoot string               `json:"parent_beacon_block_root"`
}

type Server

type Server struct {
	StateNotifier     statefeed.Notifier
	OperationNotifier opfeed.Notifier
	HeadFetcher       blockchain.HeadFetcher
	ChainInfoFetcher  blockchain.ChainInfoFetcher
}

Server defines a server implementation of the gRPC events service, providing RPC endpoints to subscribe to events from the beacon node.

func (*Server) StreamEvents

func (s *Server) StreamEvents(w http.ResponseWriter, r *http.Request)

StreamEvents provides an endpoint to subscribe to the beacon node Server-Sent-Events stream. Consumers should use the eventsource implementation to listen for those events. Servers may send SSE comments beginning with ':' for any purpose, including to keep the event stream connection alive in the presence of proxy servers.

type UnaggregatedAttEventSource added in v4.2.0

type UnaggregatedAttEventSource struct {
	AggregationBits string                  `json:"aggregation_bits"`
	Data            *shared.AttestationData `json:"data"`
	Signature       string                  `json:"signature"`
}

Jump to

Keyboard shortcuts

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