Documentation ¶
Index ¶
- Variables
- type Attestation
- type AttestationData
- type AttesterSlashing
- type BeaconBlockHeader
- type BlindedBeaconBlockBellatrix
- type BlindedBeaconBlockBodyBellatrix
- type BuilderBid
- type BuilderClient
- type Checkpoint
- type Client
- func (c *Client) GetHeader(ctx context.Context, slot types.Slot, parentHash [32]byte, pubkey [48]byte) (*ethpb.SignedBuilderBid, error)
- func (c *Client) NodeURL() string
- func (c *Client) RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error
- func (c *Client) Status(ctx context.Context) error
- func (c *Client) SubmitBlindedBlock(ctx context.Context, sb *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error)
- type ClientOpt
- type Deposit
- type DepositData
- type ErrorMessage
- type Eth1Data
- type ExecHeaderResponse
- type ExecPayloadResponse
- type ExecutionPayload
- type ExecutionPayloadHeader
- type IndexedAttestation
- type ProposerSlashing
- type SignedBeaconBlockHeader
- type SignedBlindedBeaconBlockBellatrix
- type SignedValidatorRegistration
- type SignedVoluntaryExit
- type SyncAggregate
- type Uint256
- type Uint64String
- type ValidatorRegistration
- type VoluntaryExit
Constants ¶
This section is empty.
Variables ¶
var ErrBadRequest = errors.Wrap(ErrNotOK, "recv 400 BadRequest response from API")
ErrBadRequest specifically means that a '400 - BAD REQUEST' response was received from the API.
var ErrNoContent = errors.New("recv 204 no content response from API, No header is available")
ErrNoContent specifically means that a '204 - No Content' response was received from the API. Typically, a 204 is a success but in this case for the Header API means No header is available
var ErrNotFound = errors.Wrap(ErrNotOK, "recv 404 NotFound response from API")
ErrNotFound specifically means that a '404 - NOT FOUND' response was received from the API.
var ErrNotOK = errors.New("did not receive 200 response from API")
ErrNotOK is used to indicate when an HTTP request to the Beacon Node API failed with any non-2xx response code. More specific errors may be returned, but an error in reaction to a non-2xx response will always wrap ErrNotOK.
Functions ¶
This section is empty.
Types ¶
type Attestation ¶
type Attestation struct {
*eth.Attestation
}
func (*Attestation) MarshalJSON ¶
func (a *Attestation) MarshalJSON() ([]byte, error)
type AttestationData ¶
type AttestationData struct {
*eth.AttestationData
}
func (*AttestationData) MarshalJSON ¶
func (a *AttestationData) MarshalJSON() ([]byte, error)
type AttesterSlashing ¶
type AttesterSlashing struct {
*eth.AttesterSlashing
}
func (*AttesterSlashing) MarshalJSON ¶
func (s *AttesterSlashing) MarshalJSON() ([]byte, error)
type BeaconBlockHeader ¶
type BeaconBlockHeader struct {
*eth.BeaconBlockHeader
}
func (*BeaconBlockHeader) MarshalJSON ¶
func (h *BeaconBlockHeader) MarshalJSON() ([]byte, error)
type BlindedBeaconBlockBellatrix ¶
type BlindedBeaconBlockBellatrix struct {
*eth.BlindedBeaconBlockBellatrix
}
func (*BlindedBeaconBlockBellatrix) MarshalJSON ¶
func (b *BlindedBeaconBlockBellatrix) MarshalJSON() ([]byte, error)
type BlindedBeaconBlockBodyBellatrix ¶
type BlindedBeaconBlockBodyBellatrix struct {
*eth.BlindedBeaconBlockBodyBellatrix
}
func (*BlindedBeaconBlockBodyBellatrix) MarshalJSON ¶
func (b *BlindedBeaconBlockBodyBellatrix) MarshalJSON() ([]byte, error)
type BuilderBid ¶
type BuilderBid struct { Header *ExecutionPayloadHeader `json:"header,omitempty"` Value Uint256 `json:"value,omitempty"` Pubkey hexutil.Bytes `json:"pubkey,omitempty"` }
func (*BuilderBid) ToProto ¶
func (bb *BuilderBid) ToProto() (*eth.BuilderBid, error)
type BuilderClient ¶ added in v3.1.2
type BuilderClient interface { NodeURL() string GetHeader(ctx context.Context, slot types.Slot, parentHash [32]byte, pubkey [48]byte) (*ethpb.SignedBuilderBid, error) RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error SubmitBlindedBlock(ctx context.Context, sb *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error) Status(ctx context.Context) error }
BuilderClient provides a collection of helper methods for calling Builder API endpoints.
type Checkpoint ¶
type Checkpoint struct {
*eth.Checkpoint
}
func (*Checkpoint) MarshalJSON ¶
func (c *Checkpoint) MarshalJSON() ([]byte, error)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides a collection of helper methods for calling Builder API endpoints.
func NewClient ¶
NewClient constructs a new client with the provided options (ex WithTimeout). `host` is the base host + port used to construct request urls. This value can be a URL string, or NewClient will assume an http endpoint if just `host:port` is used.
func (*Client) GetHeader ¶
func (c *Client) GetHeader(ctx context.Context, slot types.Slot, parentHash [32]byte, pubkey [48]byte) (*ethpb.SignedBuilderBid, error)
GetHeader is used by a proposing validator to request an ExecutionPayloadHeader from the Builder node.
func (*Client) NodeURL ¶
NodeURL returns a human-readable string representation of the beacon node base url.
func (*Client) RegisterValidator ¶
func (c *Client) RegisterValidator(ctx context.Context, svr []*ethpb.SignedValidatorRegistrationV1) error
RegisterValidator encodes the SignedValidatorRegistrationV1 message to json (including hex-encoding the byte fields with 0x prefixes) and posts to the builder validator registration endpoint.
func (*Client) Status ¶
Status asks the remote builder server for a health check. A response of 200 with an empty body is the success/healthy response, and an error response may have an error message. This method will return a nil value for error in the happy path, and an error with information about the server response body for a non-200 response.
func (*Client) SubmitBlindedBlock ¶
func (c *Client) SubmitBlindedBlock(ctx context.Context, sb *ethpb.SignedBlindedBeaconBlockBellatrix) (*v1.ExecutionPayload, error)
SubmitBlindedBlock calls the builder API endpoint that binds the validator to the builder and submits the block. The response is the full ExecutionPayload used to create the blinded block.
type ClientOpt ¶
type ClientOpt func(*Client)
ClientOpt is a functional option for the Client type (http.Client wrapper)
func WithObserver ¶
func WithObserver(m observer) ClientOpt
type Deposit ¶
func (*Deposit) MarshalJSON ¶
type DepositData ¶
type DepositData struct {
*eth.Deposit_Data
}
func (*DepositData) MarshalJSON ¶
func (d *DepositData) MarshalJSON() ([]byte, error)
type ErrorMessage ¶
type Eth1Data ¶
func (*Eth1Data) MarshalJSON ¶
type ExecHeaderResponse ¶
type ExecHeaderResponse struct { Version string `json:"version,omitempty"` Data struct { Signature hexutil.Bytes `json:"signature,omitempty"` Message *BuilderBid `json:"message,omitempty"` } `json:"data,omitempty"` }
func (*ExecHeaderResponse) ToProto ¶
func (ehr *ExecHeaderResponse) ToProto() (*eth.SignedBuilderBid, error)
type ExecPayloadResponse ¶
type ExecPayloadResponse struct { Version string `json:"version,omitempty"` Data ExecutionPayload `json:"data,omitempty"` }
func (*ExecPayloadResponse) ToProto ¶
func (r *ExecPayloadResponse) ToProto() (*v1.ExecutionPayload, error)
type ExecutionPayload ¶
type ExecutionPayload struct { ParentHash hexutil.Bytes `json:"parent_hash,omitempty"` FeeRecipient hexutil.Bytes `json:"fee_recipient,omitempty"` StateRoot hexutil.Bytes `json:"state_root,omitempty"` ReceiptsRoot hexutil.Bytes `json:"receipts_root,omitempty"` LogsBloom hexutil.Bytes `json:"logs_bloom,omitempty"` PrevRandao hexutil.Bytes `json:"prev_randao,omitempty"` BlockNumber Uint64String `json:"block_number,omitempty"` GasLimit Uint64String `json:"gas_limit,omitempty"` GasUsed Uint64String `json:"gas_used,omitempty"` Timestamp Uint64String `json:"timestamp,omitempty"` ExtraData hexutil.Bytes `json:"extra_data,omitempty"` BaseFeePerGas Uint256 `json:"base_fee_per_gas,omitempty"` BlockHash hexutil.Bytes `json:"block_hash,omitempty"` Transactions []hexutil.Bytes `json:"transactions,omitempty"` }
func (*ExecutionPayload) ToProto ¶
func (p *ExecutionPayload) ToProto() (*v1.ExecutionPayload, error)
type ExecutionPayloadHeader ¶
type ExecutionPayloadHeader struct { ParentHash hexutil.Bytes `json:"parent_hash,omitempty"` FeeRecipient hexutil.Bytes `json:"fee_recipient,omitempty"` StateRoot hexutil.Bytes `json:"state_root,omitempty"` ReceiptsRoot hexutil.Bytes `json:"receipts_root,omitempty"` LogsBloom hexutil.Bytes `json:"logs_bloom,omitempty"` PrevRandao hexutil.Bytes `json:"prev_randao,omitempty"` BlockNumber Uint64String `json:"block_number,omitempty"` GasLimit Uint64String `json:"gas_limit,omitempty"` GasUsed Uint64String `json:"gas_used,omitempty"` Timestamp Uint64String `json:"timestamp,omitempty"` ExtraData hexutil.Bytes `json:"extra_data,omitempty"` BaseFeePerGas Uint256 `json:"base_fee_per_gas,omitempty"` BlockHash hexutil.Bytes `json:"block_hash,omitempty"` TransactionsRoot hexutil.Bytes `json:"transactions_root,omitempty"` *v1.ExecutionPayloadHeader }
func (*ExecutionPayloadHeader) MarshalJSON ¶
func (h *ExecutionPayloadHeader) MarshalJSON() ([]byte, error)
func (*ExecutionPayloadHeader) ToProto ¶
func (h *ExecutionPayloadHeader) ToProto() (*v1.ExecutionPayloadHeader, error)
func (*ExecutionPayloadHeader) UnmarshalJSON ¶
func (h *ExecutionPayloadHeader) UnmarshalJSON(b []byte) error
type IndexedAttestation ¶
type IndexedAttestation struct {
*eth.IndexedAttestation
}
func (*IndexedAttestation) MarshalJSON ¶
func (a *IndexedAttestation) MarshalJSON() ([]byte, error)
type ProposerSlashing ¶
type ProposerSlashing struct {
*eth.ProposerSlashing
}
func (*ProposerSlashing) MarshalJSON ¶
func (s *ProposerSlashing) MarshalJSON() ([]byte, error)
type SignedBeaconBlockHeader ¶
type SignedBeaconBlockHeader struct {
*eth.SignedBeaconBlockHeader
}
func (*SignedBeaconBlockHeader) MarshalJSON ¶
func (h *SignedBeaconBlockHeader) MarshalJSON() ([]byte, error)
type SignedBlindedBeaconBlockBellatrix ¶
type SignedBlindedBeaconBlockBellatrix struct {
*eth.SignedBlindedBeaconBlockBellatrix
}
func (*SignedBlindedBeaconBlockBellatrix) MarshalJSON ¶
func (r *SignedBlindedBeaconBlockBellatrix) MarshalJSON() ([]byte, error)
type SignedValidatorRegistration ¶
type SignedValidatorRegistration struct {
*eth.SignedValidatorRegistrationV1
}
func (*SignedValidatorRegistration) MarshalJSON ¶
func (r *SignedValidatorRegistration) MarshalJSON() ([]byte, error)
func (*SignedValidatorRegistration) UnmarshalJSON ¶
func (r *SignedValidatorRegistration) UnmarshalJSON(b []byte) error
type SignedVoluntaryExit ¶
type SignedVoluntaryExit struct {
*eth.SignedVoluntaryExit
}
func (*SignedVoluntaryExit) MarshalJSON ¶
func (sve *SignedVoluntaryExit) MarshalJSON() ([]byte, error)
type SyncAggregate ¶
type SyncAggregate struct {
*eth.SyncAggregate
}
func (*SyncAggregate) MarshalJSON ¶
func (s *SyncAggregate) MarshalJSON() ([]byte, error)
type Uint256 ¶
func (Uint256) MarshalJSON ¶
func (Uint256) MarshalText ¶
func (Uint256) SSZBytes ¶
SSZBytes creates an ssz-style (little-endian byte slice) representation of the Uint256
func (*Uint256) UnmarshalJSON ¶
func (*Uint256) UnmarshalText ¶
type Uint64String ¶
type Uint64String uint64
func (Uint64String) MarshalText ¶
func (s Uint64String) MarshalText() ([]byte, error)
func (*Uint64String) UnmarshalText ¶
func (s *Uint64String) UnmarshalText(t []byte) error
type ValidatorRegistration ¶
type ValidatorRegistration struct {
*eth.ValidatorRegistrationV1
}
func (*ValidatorRegistration) MarshalJSON ¶
func (r *ValidatorRegistration) MarshalJSON() ([]byte, error)
func (*ValidatorRegistration) UnmarshalJSON ¶
func (r *ValidatorRegistration) UnmarshalJSON(b []byte) error
type VoluntaryExit ¶
type VoluntaryExit struct {
*eth.VoluntaryExit
}
func (*VoluntaryExit) MarshalJSON ¶
func (ve *VoluntaryExit) MarshalJSON() ([]byte, error)