Skip to content

Instantly share code, notes, and snippets.

@tycoi2005
Created April 1, 2023 06:46
Show Gist options
  • Save tycoi2005/66d6be8c202226bc1e16c0ff5931e8ad to your computer and use it in GitHub Desktop.
Save tycoi2005/66d6be8c202226bc1e16c0ff5931e8ad to your computer and use it in GitHub Desktop.
1 st zk
pragma circom 2.1.4;
include "circomlib/poseidon.circom";
// x1, x2, x3, x4
// y = x1
template Example () {
signal input x1;
signal input x2;
signal input x3;
signal input x4;
signal input y1;
signal input y2;
signal input OUT;
y1 === x1 + x2;
y2 === y1 * x3;
y2 === OUT + x4;
}
component main { public [ OUT ] } = Example();
/* INPUT = {
"x1": "2",
"x2": "4",
"x3": "8",
"x4": "5",
"y1": "6",
"y2": "48",
"OUT": "43"
} */
@tycoi2005
Copy link
Author

tycoi2005 commented Apr 1, 2023

proof :

{"pi_a":["15118685524946307241730711740330354422613096532091566349080144743316933468311","20398595363775083907874196493835007713466230717099776769714717648449047472143","1"],"pi_b":[["16935115793899476777481331940210917899777516699911683666008016406645107806194","10366790998766853723255786386261391298386590827171339589036646312444749619383"],["18851657016053933019749886544509319357853959758574819911019230626263942618525","10927489262501439722274813405902958012920044258973022544767058159202205826815"],["1","0"]],"pi_c":["12518192238999260218700710957501592893591689410239120374276201253935248749277","17243739972215172045573056963295435716526036894786660532022682968979958093646","1"],"protocol":"groth16","curve":"bn128"} => [43]

@tycoi2005
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment