Skip to content

Commit cf37110

Browse files
committed
feat: Smart contract & circuit adjustments, using Groth16
1 parent a368ef7 commit cf37110

File tree

9 files changed

+1185
-135
lines changed

9 files changed

+1185
-135
lines changed

.gitignore

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ circuits/build
4545
*.wasm
4646
*.zkey
4747
*.ptau
48-
*.zkey
49-
verification_key.json
50-
Verifier.sol
48+
*.wtns
49+
circuits/proof.json
50+
circuits/public.json
51+
circuits/verification_key.json
52+
src/Verifier.sol

circuits/TaskProof.circom

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ include "../node_modules/circomlib/circuits/poseidon.circom";
1010
1111
Private inputs:
1212
solution
13-
14-
NOTE: component main {public [...]} ensures these inputs are exported as
15-
public inputs (and in that order) for snarkjs / verifier.sol.
1613
*/
1714

1815
template TaskProof() {

circuits/inputs/computeCommit.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { buildPoseidon } from "circomlibjs";
2+
3+
async function main() {
4+
const poseidon = await buildPoseidon();
5+
const F = poseidon.F;
6+
7+
const solution = 42n;
8+
const taskId = 7n;
9+
const taskSalt = 123456n;
10+
11+
const commit = poseidon([solution, taskId, taskSalt]);
12+
console.log("Commit:", F.toString(commit));
13+
}
14+
15+
main();

circuits/inputs/input.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"solution": "42",
3+
"taskId": "7",
4+
"taskSalt": "123456",
5+
"recipient": "987654321",
6+
"commit": "11500528584593830379883139624647731070623497308416655972613955003754148633922"
7+
}

0 commit comments

Comments
 (0)