Skip to content

Instantly share code, notes, and snippets.

@straightupjac
Last active June 2, 2023 19:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save straightupjac/4da9258b43fd3d2002567a6039eec68f to your computer and use it in GitHub Desktop.
Save straightupjac/4da9258b43fd3d2002567a6039eec68f to your computer and use it in GitHub Desktop.

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:4da9258b43fd3d2002567a6039eec68f";

pragma circom 2.0.3;
template Main() {
signal input a;
signal input b;
signal output c;
c <-- a + b;
// Constraints
c === a + b;
}
component main { public [ x2 ] } = Main();
/* INPUT = {
"x1": "5",
"x2": "4",
"x3": "2",
"x4": "7"
} */
pragma circom 2.1.2;
include "circomlib/poseidon.circom";
// include "https://github.com/0xPARC/circom-secp256k1/blob/master/circuits/bigint.circom";
template Example () {
signal input a;
signal input b;
signal output c;
var unused = 4;
c <== a * b;
assert(a > 2);
component hash = Poseidon(2);
hash.inputs[0] <== a;
hash.inputs[1] <== b;
log("hash", hash.out);
}
component main { public [ a ] } = Example();
/* INPUT = {
"a": "5",
"b": "77"
} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment