mirror of
https://github.com/logos-storage/nim-groth16.git
synced 2026-01-05 15:13:13 +00:00
wip
This commit is contained in:
parent
f3042c4e00
commit
907ae6ed72
@ -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()
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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 )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user