Documentation
¶
Index ¶
- Variables
- func ComputeProof(ccs constraint.ConstraintSystem, provingKey native_groth16.ProvingKey, ...) (native_groth16.Proof, error)
- func CreateBaseCaseFullWitness(rawTxBytes []byte, currTxId []byte) (witness.Witness, error)
- func CreateBaseCaseLightWitness(currTxId []byte, innerField *big.Int) (witness.Witness, error)
- func CreateNormalFullWitness(innerWitness witness.Witness, innerProof native_groth16.Proof, ...) (witness.Witness, error)
- func CreateNormalLightWitness(txId []byte, outerField *big.Int) (witness.Witness, error)
- func SetupBaseCase(txSize int, innerField *big.Int) (constraint.ConstraintSystem, native_groth16.ProvingKey, ...)
- func SetupNormalCase(prefixSize int, postfixSize int, outerField *big.Int, ...) (constraint.ConstraintSystem, native_groth16.ProvingKey, ...)
- func SliceTx(rawTx []byte, inputIndex int) ([]byte, []byte, []byte, error)
- func UnmarshalProof(proof string, curveId ecc.ID) (native_groth16.Proof, error)
- func VerifyProof(pubWitness witness.Witness, genesisProof native_groth16.Proof, ...) bool
- type BaseProofInfo
- type G1Affine
- type G2Affine
- type GTEl
- type NormalProofInfo
- type ScalarField
- type Sha256Circuit
- type Sha256CircuitBaseCase
- type Sha256InnerCircuit
- type Sha256OuterCircuit
Constants ¶
This section is empty.
Variables ¶
View Source
var InnerCurve = ecc.BLS12_377
View Source
var OuterCurve = ecc.BW6_761
Functions ¶
func ComputeProof ¶
func ComputeProof(ccs constraint.ConstraintSystem, provingKey native_groth16.ProvingKey, outerWitness witness.Witness) (native_groth16.Proof, error)
func CreateBaseCaseFullWitness ¶ added in v0.1.4
func CreateBaseCaseLightWitness ¶ added in v0.1.4
func CreateNormalFullWitness ¶ added in v0.1.4
func CreateNormalFullWitness( innerWitness witness.Witness, innerProof native_groth16.Proof, innerVk native_groth16.VerifyingKey, prefixBytes []byte, prevTxnIdBytes []byte, postFixBytes []byte, currTxId []byte, field *big.Int) (witness.Witness, error)
* Full witness is used for generating a new proof
func CreateNormalLightWitness ¶ added in v0.1.4
* Light witness is used for verification of an existing proof. I.e. only public params are filled.
func SetupBaseCase ¶
func SetupBaseCase(txSize int, innerField *big.Int) (constraint.ConstraintSystem, native_groth16.ProvingKey, native_groth16.VerifyingKey, error)
func SetupNormalCase ¶
func SetupNormalCase(prefixSize int, postfixSize int, outerField *big.Int, parentCcs constraint.ConstraintSystem) (constraint.ConstraintSystem, native_groth16.ProvingKey, native_groth16.VerifyingKey, error)
func SliceTx ¶ added in v0.1.9
Split a Raw Transaction into it's component "prefix", "suffix" and "postfix" parts
inputIndex - the index of the input that
func UnmarshalProof ¶ added in v0.1.9
func VerifyProof ¶
func VerifyProof(pubWitness witness.Witness, genesisProof native_groth16.Proof, verifyingKey native_groth16.VerifyingKey) bool
Types ¶
type BaseProofInfo ¶ added in v0.1.4
type BaseProofInfo struct {
RawTx string `json:"raw_tx" binding:"required"`
}
type G1Affine ¶
type G1Affine = sw_bls12377.G1Affine
type G2Affine ¶
type G2Affine = sw_bls12377.G2Affine
type GTEl ¶
type GTEl = sw_bls12377.GT
type NormalProofInfo ¶ added in v0.1.4
type ScalarField ¶
type ScalarField = sw_bls12377.ScalarField
type Sha256Circuit ¶
type Sha256Circuit[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct { PreviousProof stdgroth16.Proof[G1El, G2El] PreviousVk stdgroth16.VerifyingKey[G1El, G2El, GtEl] PreviousWitness stdgroth16.Witness[FR] CurrTxPrefix []frontend.Variable //5 PrevTxId []frontend.Variable //32 CurrTxPost []frontend.Variable //188 //double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId CurrTxId []frontend.Variable `gnark:",public"` //probably needs to provide the reversed version to save circuit space }
* General case to continue with proofs
func CreateOuterAssignment ¶
func CreateOuterAssignment( circuitWitness groth16.Witness[sw_bls12377.ScalarField], circuitProof groth16.Proof[sw_bls12377.G1Affine, sw_bls12377.G2Affine], verifyingKey groth16.VerifyingKey[sw_bls12377.G1Affine, sw_bls12377.G2Affine, sw_bls12377.GT], prefixBytes []byte, prevTxnIdBytes []byte, postFixBytes []byte, currTxId []byte) Sha256Circuit[sw_bls12377.ScalarField, sw_bls12377.G1Affine, sw_bls12377.G2Affine, sw_bls12377.GT]
type Sha256CircuitBaseCase ¶
type Sha256CircuitBaseCase struct { RawTx []frontend.Variable //double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId CurrTxId []frontend.Variable `gnark:",public"` //probably needs to provide the reversed version to save circuit space }
* Base case to generate initial proof to get things started
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))
type Sha256OuterCircuit ¶
type Sha256OuterCircuit[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct { Proof stdplonk.Proof[FR, G1El, G2El] VerifyingKey stdplonk.VerifyingKey[FR, G1El, G2El] `gnark:"-"` // constant verification key InnerWitness stdplonk.Witness[FR] `gnark:",public"` /* The PrevTxId of the Outer Circuit must be matched and equal to the CurrTxId of the InnerProof. Because the InnerProof that we are verifying for the current Transaction was actually generated in/for the parent transaction (in who's context it was the ) Furthermore, both of the following must be public, because the verifying wallet will need to look at current Txn, extract these public values. And use them to validate the provided Outer PreviousProof. */ PrevTxId [32]uints.U8 `gnark:",public"` }
Click to show internal directories.
Click to hide internal directories.