depositutil

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package depositutil contains useful functions for dealing with Ethereum deposit inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DepositInput

func DepositInput(depositKey, withdrawalKey bls.SecretKey, amountInGwei uint64) (*ethpb.Deposit_Data, [32]byte, error)

DepositInput for a given key. This input data can be used to when making a validator deposit. The input data includes a proof of possession field signed by the deposit key.

Spec details about general deposit workflow:

To submit a deposit:

- Pack the validator's initialization parameters into deposit_data, a Deposit_Data SSZ object.
- Let amount be the amount in Gwei to be deposited by the validator where MIN_DEPOSIT_AMOUNT <= amount <= MAX_EFFECTIVE_BALANCE.
- Set deposit_data.amount = amount.
- Let signature be the result of bls_sign of the signing_root(deposit_data) with domain=compute_domain(DOMAIN_DEPOSIT). (Deposits are valid regardless of fork version, compute_domain will default to zeroes there).
- Send a transaction on the Ethereum 1.0 chain to DEPOSIT_CONTRACT_ADDRESS executing `deposit(pubkey: bytes[48], withdrawal_credentials: bytes[32], signature: bytes[96])` along with a deposit of amount Gwei.

See: https://github.com/ethereum/eth2.0-specs/blob/master/specs/validator/0_beacon-chain-validator.md#submit-deposit

func VerifyDepositSignature

func VerifyDepositSignature(dd *ethpb.Deposit_Data, domain []byte) error

VerifyDepositSignature verifies the correctness of Eth1 deposit BLS signature

func WithdrawalCredentialsHash

func WithdrawalCredentialsHash(withdrawalKey bls.SecretKey) []byte

WithdrawalCredentialsHash forms a 32 byte hash of the withdrawal public address.

The specification is as follows:

withdrawal_credentials[:1] == BLS_WITHDRAWAL_PREFIX_BYTE
withdrawal_credentials[1:] == hash(withdrawal_pubkey)[1:]

where withdrawal_credentials is of type bytes32.

Types

This section is empty.

Jump to

Keyboard shortcuts

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