eth2util

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package eth2util contains packages and logic relating to eth2 functionality. Note these packages may not import other business logic packages like dkg, core, cluster.

Index

Constants

View Source
const Prater = "prater"

Variables

View Source
var (
	Mainnet = Network{
		ChainID:        1,
		Name:           "mainnet",
		ForkVersionHex: "0x00000000",
	}
	Goerli = Network{
		ChainID:        5,
		Name:           "goerli",
		ForkVersionHex: "0x00001020",
	}
	Gnosis = Network{
		ChainID:        100,
		Name:           "gnosis",
		ForkVersionHex: "0x00000064",
	}
	Sepolia = Network{
		ChainID:        11155111,
		Name:           "sepolia",
		ForkVersionHex: "0x90000069",
	}
	Ropsten = Network{
		ChainID:        3,
		Name:           "ropsten",
		ForkVersionHex: "0x80000069",
	}
)

Functions

func ForkVersionToChainID added in v0.11.0

func ForkVersionToChainID(forkVersion []byte) (int64, error)

ForkVersionToChainID returns the chainID corresponding to the provided fork version.

func ForkVersionToNetwork added in v0.11.0

func ForkVersionToNetwork(forkVersion []byte) (string, error)

ForkVersionToNetwork returns the network name corresponding to the provided fork version.

func NetworkToForkVersion added in v0.11.0

func NetworkToForkVersion(name string) (string, error)

NetworkToForkVersion returns the fork version in hex (0x prefixed) corresponding to the network name.

func NetworkToForkVersionBytes added in v0.11.0

func NetworkToForkVersionBytes(name string) ([]byte, error)

NetworkToForkVersionBytes returns the fork version bytes corresponding to the network name.

func SlotHashRoot added in v0.10.1

func SlotHashRoot(slot eth2p0.Slot) ([32]byte, error)

SlotHashRoot returns the ssz hash root of the slot.

func ValidNetwork added in v0.11.0

func ValidNetwork(name string) bool

ValidNetwork returns true if the provided network name is a valid one.

Types

type Network added in v0.11.0

type Network struct {
	// ChainID represents chainID of the network.
	ChainID int64
	// Name represents name of the network.
	Name string
	// ForkVersionHex represents fork version of the network in hex.
	ForkVersionHex string
}

Network contains information about an Ethereum network.

type SignedEpoch added in v0.10.0

type SignedEpoch struct {
	Epoch     eth2p0.Epoch
	Signature eth2p0.BLSSignature
}

SignedEpoch represents signature of corresponding epoch.

func (SignedEpoch) GetTree added in v0.10.0

func (s SignedEpoch) GetTree() (*ssz.Node, error)

GetTree ssz hashes the SignedEpoch object.

func (SignedEpoch) HashTreeRoot added in v0.10.0

func (s SignedEpoch) HashTreeRoot() ([32]byte, error)

HashTreeRoot ssz hashes the SignedEpoch object.

func (SignedEpoch) HashTreeRootWith added in v0.10.0

func (s SignedEpoch) HashTreeRootWith(hh ssz.HashWalker) error

HashTreeRootWith ssz hashes the epoch from SignedEpoch.

func (SignedEpoch) MarshalJSON added in v0.10.0

func (s SignedEpoch) MarshalJSON() ([]byte, error)

func (*SignedEpoch) UnmarshalJSON added in v0.10.0

func (s *SignedEpoch) UnmarshalJSON(b []byte) error

Directories

Path Synopsis
Package deposit provides functions to create deposit data files.
Package deposit provides functions to create deposit data files.
Package keystore provides functions to store and load private keys to/from EIP 2335 (https://eips.ethereum.org/EIPS/eip-2335) compatible keystore files.
Package keystore provides functions to store and load private keys to/from EIP 2335 (https://eips.ethereum.org/EIPS/eip-2335) compatible keystore files.

Jump to

Keyboard shortcuts

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