credential

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveDepositDataToFile

func SaveDepositDataToFile(data []*DepositData, path string) error

func SaveSigningKeystoreToFile

func SaveSigningKeystoreToFile(data *Keystore, path string) error

Types

type Credential

type Credential struct {
	SigningSk             *bls.PrivateKey
	WithdrawalSk          *bls.PrivateKey
	Amount                *big.Int
	Chain                 constants.Chain
	Eth1WithdrawalAddress common.Address
	SigningKeyPath        string
}

func NewCredential

func NewCredential(seed []byte, index int, amount *big.Int, chain constants.Chain, eth1WithdrawalAddress common.Address) (*Credential, error)

NewCredential

Set path as EIP-2334 format https://eips.ethereum.org/EIPS/eip-2334

func (*Credential) DepositMessage

func (c *Credential) DepositMessage() (*consensus.DepositMessage, error)

func (*Credential) IsEmptyEth1WithdrawalAddress

func (c *Credential) IsEmptyEth1WithdrawalAddress() bool

func (*Credential) SignedDeposit

func (c *Credential) SignedDeposit() (*consensus.DepositData, error)

func (*Credential) SigningDepositData

func (c *Credential) SigningDepositData() (*DepositData, error)

func (*Credential) SigningKeystore

func (c *Credential) SigningKeystore(password string) (*Keystore, error)

func (*Credential) SigningPK

func (c *Credential) SigningPK() *bls.PublicKey

func (*Credential) VerifyDepositData

func (c *Credential) VerifyDepositData(data *DepositData) error

func (*Credential) VerifyKeystore

func (c *Credential) VerifyKeystore(cryptoFields map[string]interface{}, password string) error

func (*Credential) WithdrawalCredentials

func (c *Credential) WithdrawalCredentials() ([]byte, error)

func (*Credential) WithdrawalPK

func (c *Credential) WithdrawalPK() *bls.PublicKey

func (*Credential) WithdrawalPrefix

func (c *Credential) WithdrawalPrefix() []byte

func (*Credential) WithdrawalType

func (c *Credential) WithdrawalType() WithdrawalType

type DepositData

type DepositData 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"`
}

func LoadFileToDepositData

func LoadFileToDepositData(path string) ([]*DepositData, error)

type Keystore

type Keystore struct {
	Description string                 `json:"description"`
	Version     uint                   `json:"version"`
	UUID        string                 `json:"uuid"`
	Path        string                 `json:"path"`
	Pubkey      string                 `json:"pubkey"`
	Crypto      map[string]interface{} `json:"crypto"`
}

Keystore

Implement an EIP 2335-compliant keystore. A keystore is a JSON file that
stores an encrypted version of a private key under a user-supplied password.

Ref: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2335.md

func LoadFileToKeystore

func LoadFileToKeystore(path string) (*Keystore, error)

type WithdrawalType

type WithdrawalType int
const (
	BlsWithdrawal WithdrawalType = iota
	Eth1AddressWithdrawal
)

Jump to

Keyboard shortcuts

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