Skip to content

Instantly share code, notes, and snippets.

@NOOMA-42
Last active July 27, 2024 00:28
Show Gist options
  • Save NOOMA-42/1a9040d49a0a828075971cb50acc4adb to your computer and use it in GitHub Desktop.
Save NOOMA-42/1a9040d49a0a828075971cb50acc4adb to your computer and use it in GitHub Desktop.

Open this in zkREPL →

This file can be included into other zkREPLs with include "gist:1a9040d49a0a828075971cb50acc4adb";

// Code modified from circomlib test
pragma circom 2.1.6;
include "circomlib/circuits/babyjub.circom";
template AddNumOnEllipticCurve() {
signal input x1;
signal input y1;
signal input x2;
signal input y2;
// To check xout yout
signal input xout;
signal input yout;
component babyAdd = BabyAdd();
babyAdd.x1 <== x1;
babyAdd.y1 <== y1;
babyAdd.x2 <== x2;
babyAdd.y2 <== y2;
xout === babyAdd.xout;
yout === babyAdd.yout;
}
component main = AddNumOnEllipticCurve();
/* INPUT = {
"x1": "17777552123799933955779906779655732241715742912184938656739573121738514868268",
"y1": "2626589144620713026669568689430873010625803728049924121243784502389097019475",
"x2": "17777552123799933955779906779655732241715742912184938656739573121738514868268",
"y2": "2626589144620713026669568689430873010625803728049924121243784502389097019475",
"xout": "6890855772600357754907169075114257697580319025794532037257385534741338397365",
"yout": "4338620300185947561074059802482547481416142213883829469920100239455078257889"
} */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment