Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7bc6642
feat: add Keccak256CompressedTranscript for Cardano/Plutus compatibility
perturbing Jun 6, 2026
54cf7a6
feat: add transcript option to PLONK prover and verifier
perturbing Jun 6, 2026
9c10964
feat: add transcript option to FFLONK prover and verifier
perturbing Jun 6, 2026
0075266
feat: wire --transcript option to CLI and export transcript classes
perturbing Jun 6, 2026
dbf365c
test: add Cardano transcript tests for PLONK and FFLONK
perturbing Jun 6, 2026
c71157c
feat: add Cardano/Plutus proof and verification key export commands
perturbing Jun 7, 2026
14c7c6c
fix: compute FFLONK cubic root of unity curve-agnostically
perturbing Jun 7, 2026
ef06a6e
build: rebuild bundles with Keccak256CompressedTranscript
perturbing Jun 7, 2026
ac9b4a6
fix: restore bn128 FFLONK w3 computation, add bls12381 branch
perturbing Jul 21, 2026
b02dce2
refactor: drop shadowing Fr parameter from getOmegaCubicRoot
perturbing Jul 21, 2026
0bc098a
refactor: extract shared ZCash point compression helpers
perturbing Jul 21, 2026
d76a31f
fix: reject non-bls12381 curves in Cardano export commands
perturbing Jul 21, 2026
3db7366
fix: reject unknown transcript option values
perturbing Jul 21, 2026
a8ee709
refactor: collapse duplicate export-cardano-proof CLI handlers
perturbing Jul 21, 2026
e36bd30
build: rebuild bundles
perturbing Jul 21, 2026
e0425ea
fix: accept absent --transcript option from the CLI
perturbing Aug 5, 2026
cbf7e7a
test: pin ZCash point compression to IETF generator vectors
perturbing Aug 5, 2026
b066503
fix: reject non-bls12381 curves in the compressed transcript
perturbing Aug 5, 2026
85a52d8
refactor: derive compression sign flag from a half-field comparison
perturbing Aug 5, 2026
9243c16
refactor: share transcript implementation between variants
perturbing Aug 5, 2026
0aae369
fix: reject unknown curves in FFLONK w3 computation
perturbing Aug 5, 2026
d0d4197
fix: assert getOmegaCubicRoot cubes to the domain root
perturbing Aug 5, 2026
75df902
feat: include protocol and curve in Cardano proof export
perturbing Aug 5, 2026
8045204
chore: tidy Cardano export helpers and new-file headers
perturbing Aug 5, 2026
901c320
docs: document --transcript option and Cardano export commands
perturbing Aug 5, 2026
3d5e2fe
build: rebuild bundles
perturbing Aug 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@ We create the proof. This command generates the files `proof.json` and `public.j
- `proof.json` contains the actual proof.
- `public.json` contains the values of the public inputs and output.

For PLONK and FFLONK, an optional `--transcript` flag selects the Fiat-Shamir transcript used to generate the challenges:
- `keccak256` (the default): hashes uncompressed G1 points. This is what the Solidity verifiers expect.
- `keccak256-compressed`: hashes ZCash-compressed points instead, as required by Cardano/Plutus on-chain verifiers (see section 27). Only supported on the `bls12381` curve; any other curve is rejected.

A proof generated with one transcript will not verify under the other, so the prover and the verifier must use the same flag.

### 23a. Calculate the witness and generate the proof in one step

Note that it's also possible to create the proof and calculate the witness in the same command by running:
Expand Down Expand Up @@ -507,6 +513,8 @@ We use this command to verify the proof, passing in the `verification_key` we ex

If all is well, you should see that `OK` has been outputted to your console. This signifies the proof is valid.

For PLONK and FFLONK, `verify` accepts the same `--transcript` flag as `prove` (see section 23); it must match the transcript the proof was generated with.


### 25. Turn the verifier into a smart contract
```sh
Expand All @@ -522,6 +530,22 @@ snarkjs zkey export soliditycalldata public.json proof.json

We use `soliditycalldata` to simulate a verification call and cut-and-paste the result directly into the verifyProof field in the deployed smart contract in the remix environment.

### 27. Export the proof and verification key for Cardano

Instead of an EVM chain, proofs can be verified on Cardano, whose Plutus builtins (CIP-0381) operate on BLS12-381 points in the ZCash compressed encoding. The Cardano export commands convert a verification key and a proof into JSON where every G1 point is a 48-byte and every G2 point a 96-byte compressed hex string:

```sh
snarkjs zkey export cardano-verificationkey circuit_final.zkey cardano_vk.json

snarkjs groth16 export-cardano-proof proof.json cardano_proof.json
snarkjs plonk export-cardano-proof proof.json cardano_proof.json
snarkjs fflonk export-cardano-proof proof.json cardano_proof.json
```

For PLONK and FFLONK, generate the proof with `--transcript=keccak256-compressed` (see section 23) so that the challenges match what an on-chain verifier recomputes over compressed points; Groth16 has no transcript and needs no flag.

All of this targets the `bls12381` curve only, and every command above rejects any other curve. There is deliberately no compressed form for `bn128`: its on-chain consumers take uncompressed points (the EVM precompiles of [EIP-196](https://eips.ethereum.org/EIPS/eip-196) specify 64-byte `(x, y)` encodings), so no standard compressed encoding exists to target. Default behavior on `bn128` is completely unchanged.

And voila! That's all there is to it :)


Expand Down
Loading