Documentation ¶
Index ¶
- func ByteVal(u8 uints.U8) int
- func CreateBaseCaseProof(outerField, innerField *big.Int, fullTxBytes []byte, txnIdBytes [32]byte, ...) (witness.Witness, native_groth16.Proof, error)
- func CreateBaseCaseWitness(fullTxBytes []byte, innerField *big.Int) (witness.Witness, error)
- func CreateTxWitness(fullTxBytes []byte) (witness.Witness, error)
- func SetupBaseCase(innerField *big.Int) (constraint.ConstraintSystem, native_groth16.ProvingKey, ...)
- func SetupNormalCase(outerField *big.Int, parentCcs constraint.ConstraintSystem, ...) (constraint.ConstraintSystem, native_groth16.ProvingKey, ...)
- type G1Affine
- type G2Affine
- type GTEl
- type ScalarField
- type SigCircuit
- type SigCircuitBaseCase
- type TxCircuit
- type TxInput
- type TxOutput
- type VarInt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateBaseCaseProof ¶
func CreateBaseCaseProof(outerField, innerField *big.Int, fullTxBytes []byte, txnIdBytes [32]byte, innerCcs constraint.ConstraintSystem, provingKey native_groth16.ProvingKey) ( witness.Witness, native_groth16.Proof, error, )
func CreateBaseCaseWitness ¶
func CreateTxWitness ¶
func SetupTxLib(innerField *big.Int) (constraint.ConstraintSystem, native_plonk.ProvingKey, native_plonk.VerifyingKey, error) {
baseCcs, err := frontend.Compile(innerField, scs.NewBuilder, &SigCircuitBaseCase[sw_bls12377.ScalarField, sw_bls12377.G1Affine, sw_bls12377.G2Affine, sw_bls12377.GT]{}) if err != nil { return nil, nil, nil, err } srs, srsLagrange, err := unsafekzg.NewSRS(baseCcs) if err != nil { return nil, nil, nil, err } innerPK, innerVK, err := native_plonk.Setup(baseCcs, srs, srsLagrange) if err != nil { return nil, nil, nil, err } return baseCcs, innerPK, innerVK, nil }
func CreateTxProof(fullTxBytes []byte, innerCcs constraint.ConstraintSystem, provingKey native_plonk.ProvingKey) (
witness.Witness, native_plonk.Proof, error,
) {
innerField := ecc.BLS12_377.ScalarField() outerField := ecc.BW6_761.ScalarField() genesisWitness, err := CreateTxWitness(fullTxBytes) if err != nil { return nil, nil, err } proof, err := native_plonk.Prove(innerCcs, provingKey, genesisWitness, plonk.GetNativeProverOptions(outerField, innerField)) return genesisWitness, proof, err }
func SetupBaseCase ¶
func SetupBaseCase(innerField *big.Int) (constraint.ConstraintSystem, native_groth16.ProvingKey, native_groth16.VerifyingKey, error)
func SetupNormalCase ¶
func SetupNormalCase( outerField *big.Int, parentCcs constraint.ConstraintSystem, parentVk groth16.VerifyingKey[G1Affine, G2Affine, GTEl]) (constraint.ConstraintSystem, native_groth16.ProvingKey, native_groth16.VerifyingKey, error)
Types ¶
type G1Affine ¶
type G1Affine = sw_bls24315.G1Affine
type G2Affine ¶
type G2Affine = sw_bls24315.G2Affine
type GTEl ¶
type GTEl = sw_bls24315.GT
type ScalarField ¶
type ScalarField = sw_bls24315.ScalarField
type ScalarField = sw_bn254.ScalarField type G1Affine = sw_bn254.G1Affine type G2Affine = sw_bn254.G2Affine type GTEl = sw_bn254.GTEl
type SigCircuit ¶
type SigCircuit[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct { PreviousProof groth16.Proof[G1El, G2El] PreviousVk groth16.VerifyingKey[G1El, G2El, GtEl] `gnark:"-"` // constant verification key PreviousWitness groth16.Witness[FR] //private params TxPreImage [128]uints.U8 ImageHash [32]uints.U8 `gnark:",public"` //public input for proof verification }
[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT]
type SigCircuitBaseCase ¶
type SigCircuitBaseCase[FR emulated.FieldParams, G1El algebra.G1ElementT, G2El algebra.G2ElementT, GtEl algebra.GtElementT] struct { //private params TxPreImage [128]uints.U8 //public params //double-sha256 hash of the concatenation of above fields. Not reversed, so not quite a TxId ImageHash [32]uints.U8 `gnark:",public"` //shahash of the scriptPubkey. Preserve between IVC rounds. }
Click to show internal directories.
Click to hide internal directories.