This commit is contained in:
Dmitriy Ryajov 2025-03-10 12:21:10 -06:00
parent f3042c4e00
commit 907ae6ed72
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4
3 changed files with 14 additions and 10 deletions

View File

@ -4,15 +4,15 @@ import groth16/files/export_json
#-------------------------------------------------------------------------------
proc exampleProveAndVerify() =
proc exampleProveAndVerify() =
let zkey_fname : string = "./build/product.zkey"
let wtns_fname : string = "./build/product.wtns"
let proof = testProveAndVerify( zkey_fname, wtns_fname)
let (_, proof) = testProveAndVerify( zkey_fname, wtns_fname)
exportPublicIO( "./build/nim_public.json" , proof )
exportProof( "./build/nim_proof.json" , proof )
#-------------------------------------------------------------------------------
when isMainModule:
exampleProveAndVerify()
exampleProveAndVerify()

View File

@ -30,7 +30,7 @@ template Main(n) {
component prod = Product(n);
inp ==> prod.inp;
out <== prod.out + plus;
log("out =",out);
// log("out =",out);
out === 2023;
}

View File

@ -3,19 +3,23 @@
# export proof and public input in `circom`-compatible JSON files
#
import pkg/constantine/math/arithmetic except Fp, Fr
#import constantine/math/io/io_fields except Fp, Fr
import pkg/constantine/math/arithmetic
import pkg/constantine/math/io/io_fields
# import pkg/constantine/math/config/curves
import pkg/constantine/named/properties_fields
import pkg/constantine/math/extension_fields/towers
import groth16/bn128
from groth16/prover import Proof
#-------------------------------------------------------------------------------
func toQuotedDecimalFp(x: Fp): string =
func toQuotedDecimalFp(x: Fp[BN254Snarks]): string =
let s : string = toDecimalFp(x)
return ("\"" & s & "\"")
func toQuotedDecimalFr(x: Fr): string =
func toQuotedDecimalFr(x: Fr[BN254Snarks]): string =
let s : string = toDecimalFr(x)
return ("\"" & s & "\"")
@ -24,7 +28,7 @@ func toQuotedDecimalFr(x: Fr): string =
# exports the public input/output into as a JSON file
proc exportPublicIO*( fpath: string, prf: Proof ) =
# debugPrintFrSeq("public IO",prf.publicIO)
debugPrintFrSeq("public IO",prf.publicIO)
let n : int = prf.publicIO.len
assert( n > 0 )