package kzg4844
import "github.com/ethereum/go-ethereum/crypto/kzg4844"
Package kzg4844 implements the KZG crypto for EIP-4844.
Index ¶
- Variables
- func CalcBlobHashV1(hasher hash.Hash, commit *Commitment) (vh [32]byte)
- func ComputeProof(blob *Blob, point Point) (Proof, Claim, error)
- func IsValidVersionedHash(h []byte) bool
- func UseCKZG(use bool) error
- func VerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error
- func VerifyCellProofs(blobs []Blob, commitments []Commitment, proofs []Proof) error
- func VerifyProof(commitment Commitment, point Point, claim Claim, proof Proof) error
- type Blob
- type Claim
- type Commitment
- func BlobToCommitment(blob *Blob) (Commitment, error)
- func (c Commitment) MarshalText() ([]byte, error)
- func (c *Commitment) UnmarshalJSON(input []byte) error
- type Point
- type Proof
Variables ¶
var (
CellProofsPerBlob = 128
)
Functions ¶
func CalcBlobHashV1 ¶
func CalcBlobHashV1(hasher hash.Hash, commit *Commitment) (vh [32]byte)
CalcBlobHashV1 calculates the 'versioned blob hash' of a commitment. The given hasher must be a sha256 hash instance, otherwise the result will be invalid!
func ComputeProof ¶
ComputeProof computes the KZG proof at the given point for the polynomial represented by the blob.
func IsValidVersionedHash ¶
IsValidVersionedHash checks that h is a structurally-valid versioned blob hash.
func UseCKZG ¶
UseCKZG can be called to switch the default Go implementation of KZG to the C library if for some reason the user wishes to do so (e.g. consensus bug in one or the other).
func VerifyBlobProof ¶
func VerifyBlobProof(blob *Blob, commitment Commitment, proof Proof) error
VerifyBlobProof verifies that the blob data corresponds to the provided commitment.
func VerifyCellProofs ¶
func VerifyCellProofs(blobs []Blob, commitments []Commitment, proofs []Proof) error
VerifyCellProofs verifies a batch of proofs corresponding to the blobs and commitments. Expects length of blobs and commitments to be equal. Expects length of proofs be 128 * length of blobs.
func VerifyProof ¶
func VerifyProof(commitment Commitment, point Point, claim Claim, proof Proof) error
VerifyProof verifies the KZG proof that the polynomial represented by the blob evaluated at the given point is the claimed value.
Types ¶
type Blob ¶
type Blob [131072]byte
Blob represents a 4844 data blob.
func (*Blob) MarshalText ¶
MarshalText returns the hex representation of b.
func (*Blob) UnmarshalJSON ¶
UnmarshalJSON parses a blob in hex syntax.
type Claim ¶
type Claim [32]byte
Claim is a claimed evaluation value in a specific point.
type Commitment ¶
type Commitment [48]byte
Commitment is a serialized commitment to a polynomial.
func BlobToCommitment ¶
func BlobToCommitment(blob *Blob) (Commitment, error)
BlobToCommitment creates a small commitment out of a data blob.
func (Commitment) MarshalText ¶
func (c Commitment) MarshalText() ([]byte, error)
MarshalText returns the hex representation of c.
func (*Commitment) UnmarshalJSON ¶
func (c *Commitment) UnmarshalJSON(input []byte) error
UnmarshalJSON parses a commitment in hex syntax.
type Point ¶
type Point [32]byte
Point is a BLS field element.
type Proof ¶
type Proof [48]byte
Proof is a serialized commitment to the quotient polynomial.
func ComputeBlobProof ¶
func ComputeBlobProof(blob *Blob, commitment Commitment) (Proof, error)
ComputeBlobProof returns the KZG proof that is used to verify the blob against the commitment.
This method does not verify that the commitment is correct with respect to blob.
func ComputeCellProofs ¶
ComputeCellProofs returns the KZG cell proofs that are used to verify the blob against the commitment.
This method does not verify that the commitment is correct with respect to blob.
func (Proof) MarshalText ¶
MarshalText returns the hex representation of p.
func (*Proof) UnmarshalJSON ¶
UnmarshalJSON parses a proof in hex syntax.
Source Files ¶
kzg4844.go kzg4844_ckzg_nocgo.go kzg4844_gokzg.go
- Version
- v1.16.2 (latest)
- Published
- Aug 4, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 2 days ago –
Tools for package owners.