Documentation
¶
Index ¶
- Variables
- func BlockHeader(blockNum uint64) *types.Header
- func ConstructBlocksByNumber(currentBlockNum uint64, blockTime time.Duration) map[uint64]*types.Header
- func DepositCount(deposits []*DepositData) [8]byte
- func DepositEventLogs(deposits []*DepositData) ([]types.Log, error)
- func DepositLogsID() string
- func DepositMethodID() string
- func DepositRoot(deposits []*DepositData) ([32]byte, error)
- func PackDepositCount(count []byte) ([]byte, error)
- type DepositData
- type ForkData
- type SigningRoot
Constants ¶
This section is empty.
Variables ¶
var ( // MaxEffectiveBalance of an active eth2 validator. MaxEffectiveBalance = uint64(32 * 1e9) )
Functions ¶
func BlockHeader ¶
BlockHeader returns a block header with time.Now and a blockNum.
func ConstructBlocksByNumber ¶
func ConstructBlocksByNumber(currentBlockNum uint64, blockTime time.Duration) map[uint64]*types.Header
ConstructBlocksByNumber builds a list of historical blocks down to block 0 from some current block number, used to simulate a real eth1 chain which can be queried for all of its blocks by their respective number.
func DepositCount ¶
func DepositCount(deposits []*DepositData) [8]byte
DepositCount returns an encoded number of deposits.
func DepositEventLogs ¶
func DepositEventLogs(deposits []*DepositData) ([]types.Log, error)
DepositEventLogs returns a list of eth1 logs that have occurred at a deposit contract address. This uses an internal list of deposit data to return instead of relying on a real network and parsing a real deposit contract for this information.
func DepositLogsID ¶
func DepositLogsID() string
DepositLogsID returns the event hash from the ABI corresponding to fetching the deposit logs event.
func DepositMethodID ¶
func DepositMethodID() string
DepositMethodID returns the ABI encoded method value as a hex string.
func DepositRoot ¶
func DepositRoot(deposits []*DepositData) ([32]byte, error)
DepositRoot produces a hash tree root of a list of deposits to match the output of the deposit contract on the eth1 chain.
func PackDepositCount ¶
Types ¶
type DepositData ¶
type DepositData struct { Pubkey []byte `json:"pubkey,omitempty" ssz-size:"48"` WithdrawalCredentials []byte `json:"withdrawal_credentials,omitempty" ssz-size:"32"` Amount uint64 `json:"amount,omitempty"` Signature []byte `json:"signature,omitempty" ssz-size:"96"` }
DepositData defines an Ethereum 2.0 data structure used as part of the core protocol state transition - onboarding new active validators into the chain accordingly.
func CreateDepositData ¶
func CreateDepositData(validatorKey []byte, withdrawalKey []byte, amountInGwei uint64) (*DepositData, error)
CreateDepositData takes in raw private key bytes and a deposit amount and generates the proper DepositData Eth2 struct type. This involves BLS signing the deposit, generating hashed withdrawal credentials, and including the public key from the validator's private key into the deposit struct.