Skip to content

feat(Groth16): add working examples of Groth16 verification#1964

Draft
delovoyhomie wants to merge 1 commit intomainfrom
Groth16-examples
Draft

feat(Groth16): add working examples of Groth16 verification#1964
delovoyhomie wants to merge 1 commit intomainfrom
Groth16-examples

Conversation

@delovoyhomie
Copy link
Contributor

Closes #1840

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates to contract-dev/privacy-zk and the docs navigation; I’ve left several suggestions to align the frontmatter, safety guidance, snippet labeling, and sidebar text—please apply the inline suggestions.

Comment on lines +1 to +6
---
title: "Verify Groth16 examples on TON"
sidebarTitle: "Groth16 examples"
description: "Run Groth16 verifier examples on TON with Circom, Noname, Gnark, and Arkworks."
doc_type: "How-to guide"
---
Copy link
Contributor

@github-actions github-actions bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Unsupported doc_type frontmatter key

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Comment on lines +1 to +4
---
title: "Verify Groth16 examples on TON"
sidebarTitle: "Groth16 examples"
description: "Run Groth16 verifier examples on TON with Circom, Noname, Gnark, and Arkworks."
Copy link
Contributor

@github-actions github-actions bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] How‑to page title does not follow “How to X” pattern

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Comment on lines +54 to +67
```bash
cd circuits/Multiplier
circom Multiplier.circom --r1cs --wasm --sym --prime bls12381
snarkjs powersoftau new bls12-381 10 pot10_0000.ptau -v
snarkjs powersoftau contribute pot10_0000.ptau pot10_0001.ptau --name="First contribution" -v -e="some random text"
snarkjs powersoftau prepare phase2 pot10_0001.ptau pot10_final.ptau -v
snarkjs groth16 setup Multiplier.r1cs pot10_final.ptau Multiplier_0000.zkey
snarkjs zkey contribute Multiplier_0000.zkey Multiplier_final.zkey --name="1st Contributor" -v -e="some random text"
snarkjs zkey export verificationkey Multiplier_final.zkey verification_key.json
cd ../..
npx export-ton-verifier ./circuits/Multiplier/Multiplier_final.zkey ./contracts/verifier_multiplier.tact --tact
npx blueprint build --all
npx blueprint test Verifier_multiplier_tact
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Unsafe mainnet‑adjacent commands lack explicit safety callout

Suggested change
```bash
cd circuits/Multiplier
circom Multiplier.circom --r1cs --wasm --sym --prime bls12381
snarkjs powersoftau new bls12-381 10 pot10_0000.ptau -v
snarkjs powersoftau contribute pot10_0000.ptau pot10_0001.ptau --name="First contribution" -v -e="some random text"
snarkjs powersoftau prepare phase2 pot10_0001.ptau pot10_final.ptau -v
snarkjs groth16 setup Multiplier.r1cs pot10_final.ptau Multiplier_0000.zkey
snarkjs zkey contribute Multiplier_0000.zkey Multiplier_final.zkey --name="1st Contributor" -v -e="some random text"
snarkjs zkey export verificationkey Multiplier_final.zkey verification_key.json
cd ../..
npx export-ton-verifier ./circuits/Multiplier/Multiplier_final.zkey ./contracts/verifier_multiplier.tact --tact
npx blueprint build --all
npx blueprint test Verifier_multiplier_tact
```

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Comment on lines +156 to +180
## Verify

Run-time verification succeeds when all of the following are true:

- `snarkjs.groth16.verify(...)` returns `true`
- The contract `getVerify` method returns `true`
- `npx blueprint test ...` exits with code `0`

Partial snippet from the upstream Tact tests. Not runnable:

```ts
const okLocal = await snarkjs.groth16.verify(verificationKey, publicSignals, proof);
expect(okLocal).toBe(true);

const { pi_a, pi_b, pi_c, pubInputs } = await groth16CompressProof(proof, publicSignals);

expect(
await verifier.getVerify(
beginCell().storeBuffer(pi_a).endCell().asSlice(),
beginCell().storeBuffer(pi_b).endCell().asSlice(),
beginCell().storeBuffer(pi_c).endCell().asSlice(),
dictFromInputList(pubInputs),
),
).toBe(true);
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Missing “Not runnable” label on partial snippet

Suggested change
## Verify
Run-time verification succeeds when all of the following are true:
- `snarkjs.groth16.verify(...)` returns `true`
- The contract `getVerify` method returns `true`
- `npx blueprint test ...` exits with code `0`
Partial snippet from the upstream Tact tests. Not runnable:
```ts
const okLocal = await snarkjs.groth16.verify(verificationKey, publicSignals, proof);
expect(okLocal).toBe(true);
const { pi_a, pi_b, pi_c, pubInputs } = await groth16CompressProof(proof, publicSignals);
expect(
await verifier.getVerify(
beginCell().storeBuffer(pi_a).endCell().asSlice(),
beginCell().storeBuffer(pi_b).endCell().asSlice(),
beginCell().storeBuffer(pi_c).endCell().asSlice(),
dictFromInputList(pubInputs),
),
).toBe(true);
```

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Comment on lines +468 to +473
{
"group": "Privacy & ZK",
"pages": [
"contract-dev/zero-knowledge",
"contract-dev/privacy-zk/groth16-examples"
]
Copy link
Contributor

@github-actions github-actions bot Mar 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[HIGH] Sidebar group label uses nonstandard casing and ampersand

Please leave a reaction 👍/👎 to this suggestion to improve future reviews for everyone!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd just replace "Privacy & ZK" with "ZK-proofs" or somesuch


| Example | Stack | Circuit | What the proof exposes publicly | Tact test |
| ------------- | -------- | ----------------------------------------------------------------------------------------------------------------------- | ------------------------------- | --------------------------------------------- |
| `Multiplier` | Circom | [`circuits/Multiplier`](https://github.com/zk-examples/zk-ton-examples/tree/main/circuits/Multiplier) | `c = a * b` | `npx blueprint test Verifier_multiplier_tact` |
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tact

Here and below, let's only use and reference Tolk examples.

@novusnota novusnota marked this pull request as draft March 18, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Contract dev > ZK] Add working examples of Groth16 verification.

2 participants