Documentation
¶
Overview ¶
Package deposit provides Ethereum-specific functionality for deposit key management
Index ¶
- Constants
- func ComputeDepositRoot(pubkey []byte, withdrawalCredentials [32]byte, amount uint64, signature []byte) ([]byte, error)
- func DecodeForkVersion(forkVersionBytes []byte) ([4]byte, error)
- func GenerateDepositData(keys *DerivedKeys, signer Signer, keystoreCreator KeystoreCreator, ...) (*Deposit, *ValidatorKeystore, error)
- func GenerateWithdrawalCredential(pubkey []byte, withdrawalType WithdrawalType, withdrawalAddr Address) ([32]byte, error)
- func GetBuiltinNetworks() []string
- func IsBuiltinNetwork(name string) bool
- func LoadNetworkConfig(chain string, chainConfigPath string) (*params.BeaconChainConfig, error)
- func SignDepositData(privateKey *e2types.BLSPrivateKey, pubkey []byte, ...) ([]byte, []byte, error)
- type Address
- type Deposit
- type DerivedKeys
- type KeystoreCreator
- type KeystoreInfo
- type Signer
- type ValidatorKeystore
- type WithdrawalType
Constants ¶
const ( // WithdrawalKeyPath is the derivation path for ETH2.0 validator withdrawal keys WithdrawalKeyPath = "m/12381/3600/%d/0" // SigningKeyPath is the derivation path for ETH2.0 validator signing keys SigningKeyPath = "m/12381/3600/%d/0/0" )
const ( // AddressLength is the length of a valid Ethereum address // Format: "0x" + 40 hex characters AddressLength = 42 )
Variables ¶
This section is empty.
Functions ¶
func ComputeDepositRoot ¶
func ComputeDepositRoot(pubkey []byte, withdrawalCredentials [32]byte, amount uint64, signature []byte) ([]byte, error)
ComputeDepositRoot computes the deposit data root
func DecodeForkVersion ¶
DecodeForkVersion converts a byte slice fork version to bytes array
func GenerateDepositData ¶
func GenerateDepositData( keys *DerivedKeys, signer Signer, keystoreCreator KeystoreCreator, withdrawalCredential [32]byte, password string, config *params.BeaconChainConfig, depositAmount uint64, ) (*Deposit, *ValidatorKeystore, error)
GenerateDepositData creates deposit data and keystore using provided dependencies
func GenerateWithdrawalCredential ¶
func GenerateWithdrawalCredential(pubkey []byte, withdrawalType WithdrawalType, withdrawalAddr Address) ([32]byte, error)
GenerateWithdrawalCredential is the default implementation for generating withdrawal credentials
func GetBuiltinNetworks ¶
func GetBuiltinNetworks() []string
GetBuiltinNetworks returns the list of built-in network names
func IsBuiltinNetwork ¶
IsBuiltinNetwork checks if a network name is built-in
func LoadNetworkConfig ¶
func LoadNetworkConfig(chain string, chainConfigPath string) (*params.BeaconChainConfig, error)
LoadNetworkConfig loads network configuration either from a built-in preset or custom file
Types ¶
type Address ¶
type Address [20]byte
Address represents an Ethereum address
func MustAddress ¶
MustAddress parses a string to an Address and panics on error
type Deposit ¶
type Deposit struct {
PublicKey string `json:"pubkey"`
WithdrawalCredentials string `json:"withdrawal_credentials"`
Amount uint64 `json:"amount"`
Signature string `json:"signature"`
DepositMessageRoot string `json:"deposit_message_root"`
DepositDataRoot string `json:"deposit_data_root"`
ForkVersion string `json:"fork_version"`
NetworkName string `json:"network_name"`
DepositCLIVersion string `json:"deposit_cli_version"`
}
Deposit represents the Ethereum 2.0 deposit data structure for JSON output
type DerivedKeys ¶
type DerivedKeys struct {
WithdrawalPrivateKey *e2types.BLSPrivateKey
SigningPrivateKey *e2types.BLSPrivateKey
WithdrawalPublicKey []byte
SigningPublicKey []byte
Index int
}
DerivedKeys contains validator signing and withdrawal keys
func DeriveKeysFromMnemonic ¶
func DeriveKeysFromMnemonic(mnemonic string, index int) (*DerivedKeys, error)
DeriveKeysFromMnemonic generates keys from a mnemonic using Ethereum 2.0 key derivation
type KeystoreCreator ¶
type KeystoreCreator func( keys *DerivedKeys, password string, ) (*ValidatorKeystore, error)
KeystoreCreator creates an encrypted keystore with the given password
type KeystoreInfo ¶
type KeystoreInfo struct {
Path string `json:"path"`
PublicKey string `json:"pubkey"`
WithdrawalPK string `json:"withdrawal_pk,omitempty"`
DepositDataPath string `json:"deposit_data_path,omitempty"`
CreationTimestamp time.Time `json:"creation_timestamp"`
}
KeystoreInfo represents information about a generated keystore
type Signer ¶
type Signer func( signingPrivateKey *e2types.BLSPrivateKey, signingPublicKey []byte, withdrawalCredentials [32]byte, depositAmount uint64, forkVersion [4]byte, ) ([]byte, []byte, error)
Signer signs deposit data with the given parameters
type ValidatorKeystore ¶
type ValidatorKeystore struct {
Keystore string `json:"keystore"`
KeystoreInfo KeystoreInfo `json:"keystore_info"`
}
ValidatorKeystore contains keystore information
func CreateKeystore ¶
func CreateKeystore(keys *DerivedKeys, password string) (*ValidatorKeystore, error)
CreateKeystore is the default KeystoreCreator implementation
type WithdrawalType ¶
type WithdrawalType uint8
WithdrawalType represents the type of withdrawal credential
const ( // WithdrawTypeBLS (0x00) - BLS withdrawal credentials WithdrawTypeBLS WithdrawalType = iota // WithdrawTypeETH1 (0x01) - Regular validator withdrawal credentials with an ETH1 address WithdrawTypeETH1 // WithdrawTypeCompounding (0x02) - Compounding validator withdrawal credentials with an ETH1 address WithdrawTypeCompounding )
func ParseWithdrawalType ¶
func ParseWithdrawalType(value uint8) (WithdrawalType, error)
ParseWithdrawalType parses a uint8 to a valid WithdrawalType
func (*WithdrawalType) Set ¶
func (w *WithdrawalType) Set(s string) error
Set implements pflag.Value.
func (WithdrawalType) String ¶
func (w WithdrawalType) String() string
String implements pflag.Value.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
deposit
command
Package main implements the deposit-cli command line tool for managing Ethereum validator deposits
|
Package main implements the deposit-cli command line tool for managing Ethereum validator deposits |
|
internal
|
|
|
test
Package test defines shared fixtures for internal testing.
|
Package test defines shared fixtures for internal testing. |
