ipa

package
v0.0.4-rc.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package ipa provides an IPA (Inner Product Argument) commitment backend.

Index

Constants

View Source
const (
	// MaxValues is the maximum number of values per commitment.
	MaxValues = 256
	// ProofSize is the size of a primitive IPA index proof in bytes.
	// For 256 elements: numRounds=8, size=4 + 8*32(L) + 8*32(R) + 32(A_scalar) + 4(index) = 552
	ProofSize = 552
	// MaxCacheEntries is the maximum number of cached commitments.
	// When exceeded, the oldest entries are evicted.
	MaxCacheEntries = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheme

type Scheme struct {
	// contains filtered or unexported fields
}

Scheme implements an IPA-based index commitment backend.

func NewScheme

func NewScheme() (*Scheme, error)

NewScheme creates a new IPA commitment scheme.

func (*Scheme) BatchProve

func (s *Scheme) BatchProve(values []commitment.Cell, indices []uint64) (cid.Cid, []commitment.Cell, []byte, error)

BatchProve proves multiple stable indices with one batch proof payload.

func (*Scheme) BatchVerify

func (s *Scheme) BatchVerify(comm cid.Cid, indices []uint64, values []commitment.Cell, proof []byte) (bool, error)

BatchVerify verifies a batch proof for an ordered index list.

func (*Scheme) Commit

func (s *Scheme) Commit(values []commitment.Cell) (cid.Cid, error)

Commit commits a stable indexed cell vector.

func (*Scheme) MaxValues

func (s *Scheme) MaxValues() int

MaxValues returns the maximum number of authenticated slots.

func (*Scheme) Prove

func (s *Scheme) Prove(values []commitment.Cell, index uint64) (cid.Cid, commitment.Cell, []byte, error)

Prove proves the value at a stable index.

func (*Scheme) Replace

func (s *Scheme) Replace(values []commitment.Cell, index uint64, oldValue, newValue commitment.Cell) (cid.Cid, error)

Replace performs an index-stable replacement.

func (*Scheme) VerifyIndex

func (s *Scheme) VerifyIndex(comm cid.Cid, index uint64, value commitment.Cell, proof []byte) (bool, error)

VerifyIndex verifies a proof for a stable index without requiring cache state.

func (*Scheme) VerifyProof

func (s *Scheme) VerifyProof(comm cid.Cid, value commitment.Cell, proof []byte) (bool, error)

VerifyProof verifies a proof carrying its own index metadata.

Jump to

Keyboard shortcuts

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