Repository navigation
fflonk 4/5: An fflonk verifier, with a Keccak or a SHA-256 transcript - #19
Merged
Merged
Conversation
mjthatch
force-pushed
the
research/fflonk
branch
2 times, most recently
from
October 23, 2026 14:13
aa83fce to
3dd6b2b
Compare
groth/fflonk.py compiles a snarkjs 0.7.6 fflonk verification key into a Simplicity program that checks what fflonkVerify checks. fflonk's setup is universal: a circuit needs a powers-of-tau file and no ceremony. - Transcript modes: keccak checks proofs from snarkjs as it is; sha256 checks proofs from tools/snarkjs_sha256.mjs, snarkjs with the transcript's hash swapped for SHA-256. - fflonk_ref.py: a line-by-line Python port of fflonkVerify, whose loaders refuse points off the curves, X_2 outside the subgroup, and infinity. - frprog.py: F_r arithmetic as straight-line code, recorded from the prover's run and laid out level by level. The opening needs 22 inverse hints plus one per public input. - The MSM of PR 3 and pairing.py's check: B is the generator, delta is [x]_2, e(-C0, [1]_2) is the constant. - Binding: the first two public inputs are the sighash limbs, compared with sig_all_hash. - Padding: groups of 1 to 256 zero blocks behind cases on a witness word, so a spend can raise its budget to cover the cost; pad_for counts the budget low, as Groth16.budget_ok does. - Each witness node is read once in the tree unfolding. Cost on circuits/multiplier_fflonk.circom (3 public inputs), before padding: 123.2 M mWU with SHA-256, 172.0 M with Keccak (49.1 M of it the transcript). tests/test_fflonk.py runs both modes on the proofs in examples/fflonk: the honest witness at the predicted cost, padded so the budget covers it, and tampered evaluations, challenges, inputs, hints, slots and a proof for another sighash, each rejected by a failed jet. docs/fflonk.md explains the design. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
mjthatch
force-pushed
the
research/fflonk
branch
from
October 23, 2026 14:26
3dd6b2b to
5373bfa
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fourth of five stacked PRs for the fflonk verifier. The base is PR 3, the MSM.
groth/fflonk.pycompiles a snarkjs 0.7.6 fflonk verification key into a Simplicity program that checks what snarkjs'sfflonkVerifychecks. fflonk's setup is universal: a circuit needs a powers-of-tau file and no ceremony of its own.docs/fflonk.mdexplains the design.Two transcript modes
tools/snarkjs_sha256.mjs, which is snarkjs with the transcript's hash swapped for SHA-256 (a copy of its sources, patched at run time; it refuses a snarkjs other than 0.7.6). Such proofs do not verify with snarkjs's own verifier.Cost
On the toy circuit
circuits/multiplier_fflonk.circom(3 public inputs), inhand. The generator predicts each cost exactly.Groth16 costs 48.6 M for comparison. A spend pads its witness to raise the budget (below).
What is in it
fflonk_ref.py. A line-by-line Python port offflonkVerify. The tests compare the program with it on every intermediate value. Its loaders refuse points off the curves, X_2 outside the order-r subgroup, and points at infinity.frprog.py). F_r arithmetic as straight-line code: the prover runs it on integers, and the generator records it and lays it out level by level. The formulas are simplified to need 22 inverse hints plus one per public input:pairing.py's polynomial identity, unchanged:sig_all_hash. fflonk pays little per input, so there is no Merkle root.Fflonk.pad_forcounts the budget low, asGroth16.budget_okdoes.Tests
make test-fflonk_keccakandmake test-fflonk_sha256(tests/test_fflonk.py), on the proofs inexamples/fflonk:harness.expect_rejected):The fixtures were made with the demo of PR 5.
🤖 Generated with Claude Code