bulletproofs

package
v5.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const CommitmentBits = 64

CommitmentBits The amount of bits a value within a commitment may use.

View Source
const MaxCommitments = 16

MaxCommitments The maximum amount of commitments provable for within a single Bulletproof(+).

Variables

View Source
var Generator = initGenerators[curve25519.VarTimeOperations]("bulletproof")
View Source
var GeneratorPlus = initGenerators[curve25519.VarTimeOperations]("bulletproof_plus")
View Source
var LogCommitmentBits = bits.Len(CommitmentBits)

Functions

func CalculateClawback

func CalculateClawback(plus bool, outputs int) (clawback, LRLen int)

CalculateClawback Calculate the weight penalty for the Bulletproof(+).

Bulletproofs(+) are logarithmically sized yet linearly timed. Evaluating by their size alone accordingly doesn't properly represent the burden of the proof. Monero 'claws back' some of the weight lost by using a proof smaller than it is fast to compensate for this.

If the amount of outputs specified exceeds the maximum amount of outputs, the result for the maximum amount of outputs will be returned. https://github.com/monero-project/monero/blob/94e67bf96bbc010241f29ada6abc89f49a81759c/src/cryptonote_basic/cryptonote_format_utils.cpp#L106-L124

func ChallengeProducts

func ChallengeProducts(challenges [][2]curve25519.Scalar) []curve25519.Scalar

ChallengeProducts This has room for optimization worth investigating further. It currently takes an iterative approach. It can be optimized further via divide and conquer.

Assume there are 4 challenges.

Iterative approach (current):

  1. Do the optimal multiplications across challenge column 0 and 1.
  2. Do the optimal multiplications across that result and column 2.
  3. Do the optimal multiplications across that result and column 3.

Divide and conquer (worth investigating further):

  1. Do the optimal multiplications across challenge column 0 and 1.
  2. Do the optimal multiplications across challenge column 2 and 3.
  3. Multiply both results together.

When there are 4 challenges (n=16), the iterative approach does 28 multiplications versus divide and conquer's 24.

func PaddedPowerOfTwo

func PaddedPowerOfTwo[T int | uint64](i T) T

Types

type Generators

type Generators struct {
	G []*curve25519.Point
	H []*curve25519.Point
}

type InternalBatchVerifier

type InternalBatchVerifier[T curve25519.PointOperations] struct {
	G     curve25519.Scalar
	H     curve25519.Scalar
	GBold []curve25519.Scalar
	HBold []curve25519.Scalar
	Other []ScalarPointPair[T]
}

func (*InternalBatchVerifier[T]) Verify

func (ibv *InternalBatchVerifier[T]) Verify(G, H *curve25519.PublicKey[T], gen Generators) bool

type PointVector

type PointVector[T curve25519.PointOperations] []curve25519.PublicKey[T]

func (PointVector[T]) Copy added in v5.0.3

func (v PointVector[T]) Copy(out PointVector[T]) PointVector[T]

func (PointVector[T]) MultiplyScalars

func (v PointVector[T]) MultiplyScalars(dst *curve25519.PublicKey[T], scalars ScalarVector[T]) *curve25519.PublicKey[T]

func (PointVector[T]) MultiplyVec

func (v PointVector[T]) MultiplyVec(o ScalarVector[T]) PointVector[T]

func (PointVector[T]) Split

func (v PointVector[T]) Split() (a, b PointVector[T])

type ScalarPointPair

type ScalarPointPair[T curve25519.PointOperations] struct {
	S curve25519.Scalar
	P curve25519.PublicKey[T]
}

type ScalarVector

type ScalarVector[T curve25519.PointOperations] []curve25519.Scalar

func AppendScalarVectorPowers added in v5.0.3

func AppendScalarVectorPowers[T curve25519.PointOperations](out ScalarVector[T], x *curve25519.Scalar, size int) ScalarVector[T]

func Decompose

func Decompose[T curve25519.PointOperations](amount uint64) (out ScalarVector[T])

func TwoScalarVectorPowers added in v5.0.3

func TwoScalarVectorPowers[T curve25519.PointOperations]() ScalarVector[T]

func (ScalarVector[T]) Add

func (v ScalarVector[T]) Add(s *curve25519.Scalar) ScalarVector[T]

func (ScalarVector[T]) AddVec

func (v ScalarVector[T]) AddVec(o ScalarVector[T]) ScalarVector[T]

func (ScalarVector[T]) AddVecMultiply added in v5.0.3

func (v ScalarVector[T]) AddVecMultiply(o ScalarVector[T], s *curve25519.Scalar) ScalarVector[T]

func (ScalarVector[T]) Copy added in v5.0.3

func (v ScalarVector[T]) Copy(out ScalarVector[T]) ScalarVector[T]

func (ScalarVector[T]) InnerProduct

func (v ScalarVector[T]) InnerProduct(o ScalarVector[T]) (out curve25519.Scalar)

InnerProduct Returns sum(v * o)

func (ScalarVector[T]) Multiply

func (v ScalarVector[T]) Multiply(s *curve25519.Scalar) ScalarVector[T]

func (ScalarVector[T]) MultiplyPoints

func (v ScalarVector[T]) MultiplyPoints(dst *curve25519.PublicKey[T], points []*curve25519.Point) *curve25519.PublicKey[T]

func (ScalarVector[T]) MultiplyPublicKeys

func (v ScalarVector[T]) MultiplyPublicKeys(dst *curve25519.PublicKey[T], points []*curve25519.PublicKey[T]) *curve25519.PublicKey[T]

func (ScalarVector[T]) MultiplyVec

func (v ScalarVector[T]) MultiplyVec(o ScalarVector[T]) ScalarVector[T]

func (ScalarVector[T]) Split

func (v ScalarVector[T]) Split() (a, b ScalarVector[T])

func (ScalarVector[T]) Subtract

func (v ScalarVector[T]) Subtract(s *curve25519.Scalar) ScalarVector[T]

func (ScalarVector[T]) SubtractVec

func (v ScalarVector[T]) SubtractVec(o ScalarVector[T]) ScalarVector[T]

func (ScalarVector[T]) Sum

func (v ScalarVector[T]) Sum() (out curve25519.Scalar)

func (ScalarVector[T]) WeightedInnerProduct

func (v ScalarVector[T]) WeightedInnerProduct(x, y ScalarVector[T]) (out curve25519.Scalar)

WeightedInnerProduct Returns sum(v * x * y * o)

func (ScalarVector[T]) WeightedWeightedInnerProduct added in v5.0.3

func (v ScalarVector[T]) WeightedWeightedInnerProduct(x *curve25519.Scalar, y, z ScalarVector[T]) (out curve25519.Scalar)

WeightedWeightedInnerProduct Returns sum(v * [x] * y * z * o)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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