-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add circuit dependencies to codebase
- Loading branch information
1 parent
693d588
commit d1b8d71
Showing
27 changed files
with
1,974 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ | |
# dependencies | ||
node_modules/ | ||
|
||
# build artifacts | ||
src/circuits/*_js/ | ||
|
||
# Expo | ||
.expo/ | ||
dist/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Empty file.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
// https://github.com/cursive-team/babyjubjub-ecdsa/blob/main/packages/circuits/baby-jubjub-ecdsa/baby_jubjub_ecdsa.circom | ||
pragma circom 2.1.2; | ||
|
||
include "../../node_modules/circomlib/circuits/babyjub.circom"; | ||
include "../../node_modules/circomlib/circuits/bitify.circom"; | ||
include "../../node_modules/circomlib/circuits/escalarmulany.circom"; | ||
|
||
/** | ||
* BabyJubJubECDSA | ||
* ==================== | ||
* | ||
* Converts inputted efficient ECDSA signature to an public key. There is no | ||
* public key validation included. Takes in points in Twisted Edwards form | ||
* and uses Edwards addition and scalar multiplication. Returns computed | ||
* public key in Edwards form. | ||
*/ | ||
template BabyJubJubECDSA() { | ||
var bits = 256; | ||
signal input s; | ||
signal input Tx; // T = r^-1 * R | ||
signal input Ty; // T is represented in Twisted Edwards form | ||
signal input Ux; // U = -(m * r^-1 * G) | ||
signal input Uy; // U is represented in Twisted Edwards form | ||
|
||
signal output pubKeyX; // Represented in Twisted Edwards form | ||
signal output pubKeyY; | ||
|
||
// bitify s | ||
component sBits = Num2Bits(bits); | ||
sBits.in <== s; | ||
|
||
// check T, U are on curve | ||
component checkT = BabyCheck(); | ||
checkT.x <== Tx; | ||
checkT.y <== Ty; | ||
component checkU = BabyCheck(); | ||
checkU.x <== Ux; | ||
checkU.y <== Uy; | ||
|
||
// sMultT = s * T | ||
component sMultT = EscalarMulAny(bits); | ||
var i; | ||
for (i=0; i<bits; i++) { | ||
sMultT.e[i] <== sBits.out[i]; | ||
} | ||
sMultT.p[0] <== Tx; | ||
sMultT.p[1] <== Ty; | ||
|
||
// pubKey = sMultT + U | ||
component pubKey = BabyAdd(); | ||
pubKey.x1 <== sMultT.out[0]; | ||
pubKey.y1 <== sMultT.out[1]; | ||
pubKey.x2 <== Ux; | ||
pubKey.y2 <== Uy; | ||
|
||
pubKeyX <== pubKey.xout; | ||
pubKeyY <== pubKey.yout; | ||
} |
Oops, something went wrong.