txivc

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBaseCaseProof

func CreateBaseCaseProof(fullTxBytes []byte, innerCcs constraint.ConstraintSystem, provingKey native_plonk.ProvingKey) (
	witness.Witness,
	native_plonk.Proof,
	error,
)

func CreateBaseCaseWitness

func CreateBaseCaseWitness(
	rawTx []byte,
	currTxId [32]byte,
) (witness.Witness, error)

Types

type Sha256Circuit

type Sha256Circuit[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct {
	PreviousProof   stdplonk.Proof[FR, G1El, G2El]
	PreviousVk      stdplonk.VerifyingKey[FR, G1El, G2El] `gnark:"-"` // constant verification key
	PreviousWitness stdplonk.Witness[FR]

	CurrTxPrefix [5]uints.U8 //5
	PrevTxId     [32]uints.U8
	CurrTxPost   [188]uints.U8 //81

	//double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId
	//TokenId  [32]uints.U8 `gnark:",public"` //probably needs to provide the reversed version to save circuit space
	CurrTxId [32]uints.U8 `gnark:",public"` //probably needs to provide the reversed version to save circuit space

}

* General case to continue with proofs

func (*Sha256Circuit[FR, G1El, G2El, GtEl]) Define

func (circuit *Sha256Circuit[FR, G1El, G2El, GtEl]) Define(api frontend.API) error

type Sha256CircuitBaseCase

type Sha256CircuitBaseCase[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct {
	//CurrTxPrefix [5]uints.U8 //5
	//PrevTxId     [32]uints.U8
	//CurrTxPost   [154]uints.U8 //81
	RawTx []uints.U8 `gnark:",public"`

	//double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId
	CurrTxId [32]uints.U8 `gnark:",public"` //probably needs to provide the reversed version to save circuit space

}

* Base case to generate initial proof to get things started

func (*Sha256CircuitBaseCase[FR, G1El, G2El, GtEl]) Define

func (circuit *Sha256CircuitBaseCase[FR, G1El, G2El, GtEl]) Define(api frontend.API) error

* Base case implementation

type Sha256InnerCircuit

type Sha256InnerCircuit struct {
	CurrTxPrefix [5]uints.U8 //5
	PrevTxId     [32]uints.U8
	CurrTxPost   [154]uints.U8 //81

	//double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId
	CurrTxId [32]uints.U8 `gnark:",public"` //probably needs to provide the reversed version to save circuit space
}

circuit that proves in zero knowledge that there exists a Transaction with Id == CurrTxId which is composed of sha256(sha256(CurrTxPrefix || PrevTxId || CurrTxPost))

func (*Sha256InnerCircuit) Define

func (circuit *Sha256InnerCircuit) Define(api frontend.API) error

Jump to

Keyboard shortcuts

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