sszutils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0, MIT Imports: 1 Imported by: 0

Documentation

Overview

Methods for operations relating to SSZ, a serialization method used in the Ethereum consensus layer, for out of circuit data. To learn more, refer to https://ethereum.org/en/developers/docs/data-structures-and-encoding/ssz/.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data []byte) [32]byte

Hashes a byte slice using sha256.

func HashTreeRoot

func HashTreeRoot(leaves [][32]byte) [32]byte

Computes the root of a SSZ tree given a list of leaves.

func NewBytes32FromBytesLeftPad

func NewBytes32FromBytesLeftPad(data []byte) [32]byte

Converts a byte slice to 32 byte array with left padding.

func NewBytes32FromBytesRightPad

func NewBytes32FromBytesRightPad(data []byte) [32]byte

Converts a byte slice to 32 byte array with right padding.

func NewBytes32FromU64LE

func NewBytes32FromU64LE(v uint64) [32]byte

Converts a u64 to a 32 byte array in little endian.

func RestoreMerkleRoot

func RestoreMerkleRoot(leaf [32]byte, proof [][32]byte, gindex int) [32]byte

Computes the expected root of a SSZ proof given a leaf, proof, and gindex.

func VerifyProof

func VerifyProof(root [32]byte, leaf [32]byte, proof [][32]byte, gindex int)

Verifies a SSZ proof.

Types

This section is empty.

Jump to

Keyboard shortcuts

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