Noir-CKB update: what I decided after the direction check, what you can try today, and where this is going

,

About a month ago I shared a direction check here for noir-ckb, asking for feedback on what I was building. I got really thoughtful replies, mostly around two questions:

Where should a proof live in a CKB transaction (Lock or Type?), and is Noir → Groth16 even the right backend, given its per-circuit trusted setup.

This post is the follow-up: what I decided, what exists now that you can actually run (including on testnet), and the longer-term picture of where I want this to go. It’s a long one, sorry in advance :sweat_smile:

Quick recap, if you’re new to this

noir-ckb lets you write a rule in Noir, prove it off-chain, and have a CKB script verify the proof. The sentence that has driven the whole project is:

> A proof that verifies is not the same as a proof that authorizes this Cell transition.

A Groth16 proof can be mathematically perfect and still be about the wrong thing: the wrong Cell, the wrong state change, the wrong network. So the interesting work isn’t only verifying proofs on CKB-VM, it’s binding each proof to the exact transaction it’s attached to, so that a valid proof can’t be reused anywhere else.

Decision 1: where the proof lives

In my reply in that thread I ended up with four possible patterns:

  1. Proof-only Lock for a stateless cell: having a valid proof is the permission to spend.

  2. Generic verifier Lock + binding Type: the Lock checks the proof, the Type checks the proof is about this exact transition. (My earlier Capsule prototype.)

  3. Normal ownership Lock + proof-verifying Type: a signature decides who can spend; the Type verifies the proof and binds it to the state change.

  4. Two proofs, one in the Lock and one in the Type, tied together by shared context.

Where they ended up:

Pattern 3 is now live on testnet, as a small owned counter. A normal secp256k1 Lock controls who may spend the Cell. The counter’s Type Script rebuilds the expected public statement from the actual transaction (network, the consumed Cell, old and new value, successor Lock and capacity) and only then verifies the Groth16 proof. A perfectly valid proof for a different Cell, a different change or a different network gets rejected. The local test suite throws 48 of those attacks at it in CKB-VM, plus three deliberately broken contracts that the tests have to catch.

I’ll be honest about the counter, though: its proof is redundant. Every input is public, so the Type could just check `new = old + 1` itself in a few instructions instead of about 111 million cycles. It proves the plumbing and the binding work. It doesn’t show why you’d want zero knowledge.

So the next example is a stateful version of pattern 1:
A private tally. The Cell holds a commitment to a hidden 64-bit number. Whoever knows a secret key can add a hidden amount (including zero, so an update doesn’t even reveal whether anything was added). There’s no signature: the proof is the permission, and the logic lives in a Type so the state survives each update.

That’s where binding stops being a nice-to-have and becomes the entire security model. With no signature, a proof copied out of the mempool is the only thing between an attacker and your tally, so it has to commit to one consumed Cell, one old and new commitment, one successor and one network. Then it’s useless anywhere else.

What it won’t hide, to be upfront: updates to one Cell are still linkable to each other, and the number of updates, their timing and who paid the fee are public. Fully unlinkable updates would need a shielded pool, which is a different design.

The design is written and accepted, not built yet. Before committing to it I checked the risky parts against the current backend: the hash library that works with my compiler version has a known bug for longer inputs, so every hash in the design takes three inputs or fewer, and a differential test (Noir’s own execution vs. the backend’s constraint system) agreed on all 19 cases I threw at it.

Patterns 2 and 4 are parked for now. I’d rather build them when a real application needs them.

Decision 2: staying with Noir → Groth16 (for now)

It was suggested that I look at the optimized SP1 verifier for CKB-VM, because SP1’s PLONK setup is universal, so no per-circuit ceremony. I took that seriously: I reproduced its verification on CKB-VM (about 66M cycles for the upstream fixture) and a set of rejection cases. It works.

The problem is one step earlier. SP1 proves programs compiled for its zkVM; it doesn’t take Noir circuits. Keeping Noir would mean building a Noir-to-SP1 bridge first (for example, running an ACIR interpreter inside SP1), which I couldn’t find and which would be a whole project on its own. Rewriting circuits in Rust would mean dropping the Noir workflow this project exists for.

So I’m staying with Noir → Groth16 and paying the setup cost properly, with a ceremony (more below). That’s a scoping decision, not a verdict that SP1 is worse. If a Noir path to SP1 appears, the binding layer is the part I’d expect to carry over.

What you can try today

Everything is in one guide: noir-ckb-verifier/docs/try-the-counter.md at main · wamimi/noir-ckb-verifier · GitHub

Part 1, locally, no wallet, no money. One command compiles the circuit, generates a fresh proof, starts a throwaway CKB chain on your computer, and sends real signed transactions that deploy the contract, create a counter and update it with the proof. It runs on Apple Silicon Macs and Ubuntu 24.04 (x86_64 and ARM64), natively or in a container. (Intel Macs and Windows aren’t supported yet.)

Part 2, your own counter on testnet. You don’t deploy anything: the contract and verification key are already on testnet and the proving files are published, so it costs about 262 testnet CKB from the faucet (200 stay locked in your counter, because this demo contract has no withdraw). Before you sign anything, the tool checks that the published files are exactly what’s deployed, that the code on testnet matches them byte for byte, and that your own machine compiles the circuit to the same thing. Then you review, sign and send each transaction yourself with your own `ckb-cli` account. The proof is generated on your machine.

I went through it from a brand new account:

- created at 0: [0x0b6efcd7…888798c](https://testnet.explorer.nervos.org/transaction/0x0b6efcd70f111afd1c885557c84f7b93ef4ee8401dd9fe258b9fb677c888798c)

- updated 0 → 1 with a proof made on my laptop: [0xe6589170…0089126f](https://testnet.explorer.nervos.org/transaction/0xe6589170381a02a249c37be8ab279e6229e2feb8f177f3d572bc63f30089126f)

Doing it as a “stranger” found a couple of rough edges that I fixed straight away. I’m sure you’ll find more, and I’d love to hear about them.

The trust part, plainly

The counter’s keys came from a single-party development setup, made by me. In principle that means I could forge counter proofs. For the counter it’s tolerable, because every update also needs your signature, so nobody can change your counter without your key.

For the private tally it’s not tolerable, since the proof is the only authority. So before the tally goes to testnet I’ll run a small public setup ceremony. It’s a relay where each person downloads the latest file, runs one `snarkjs` command on their laptop (around ten minutes), and posts the hash it prints. If even one contributor throws away their randomness, nobody can forge proofs. A future CKB block hash gets mixed in at the end so nobody can steer the result, and anyone can verify the whole transcript afterwards.

I’m looking for around five contributors(or more) If you’d like to be one, reply here or DM me and I’ll send instructions once the circuit is frozen. (It’s for a testnet developer preview, not an audited production ceremony.)

## Where I want this to go

This is the part I’m most excited about. The developer experience I’m working toward:

> You start a project, bring a supported Noir circuit, declare how its public values map to your Cells, and the tool builds the artifacts, the Type Script and an adversarial test suite for you. You test it locally, deploy to testnet, and connect it to your frontend, where your users generate proofs in their own browser and authorize updates with their own wallet.

Almost none of that exists yet beyond the counter, so here is how I’m thinking about getting there, step by step:

1. A real developer toolkit, natively. Turn today’s reference workflow into an installable CLI that works outside this repository, with clear diagnostics and an explicit list of what’s supported. Then support a project within one well-defined pattern (one owner-controlled Cell transitioning to one successor): a config file for how your public values map to Cell state, early and clear errors when a circuit uses something the backend doesn’t support, and artifact manifests so you can always tell which circuit, key, contract and toolchain belong together. A second small example should build from its own folder without touching toolkit code; that’s the real test of reuse.

2. Proving in the browser, with a wallet. This is where it gets fun, and also where I want to be careful. NoirJS can execute a circuit in the browser and produce a witness, but my route also needs the witness converted to the backend’s layout and a Groth16 proof from snarkjs. Barretenberg’s browser prover (UltraHonk) is a different proof system, so it can’t just be plugged into the existing CKB verifier. So the first milestone is narrow: a proof generated in a browser for the fixed counter must pass the existing on-chain verifier, and altered statements must still be rejected. Phone performance has to be measured as well. If that works, the acceptance app is a little visitor-owned counter: connect a wallet, create your counter, click increment, prove in the browser, sign, see it confirmed.

3. Applications that push the toolkit. Battleship is the one I keep coming back to (and it’s why pattern 3 matters: the player’s Lock authorizes the move, the Type proves the hit/miss answer is consistent with the committed board). But a proof of one move doesn’t make a fair game by itself: turns, timeouts, repeated shots and endings all need their own design. So it’ll be its own project once the architecture holds up.

4. Grow from real demand. More circuit operations, structured inputs, other wallet locks, multi-Cell patterns: added when an actual application needs them, each with its own compatibility statement and attack tests. Production readiness (a real setup strategy, independent review, upgrade policy) is a separate undertaking from a testnet release, and I won’t blur the two.

## What would help most

Try it and tell me where you got stuck and on which OS: Sign in to GitHub · GitHub (never share wallet folders or passwords, just the error and the manifest file).

If you’re building on CKB: what would you want to prove inside a transaction? Which public values would have to match your Cells? Which of the four patterns fits?

Ceremony: reply if you’d like to contribute.

Browser proving: if you’ve tried NoirJS, snarkjs or wallet signing in a CKB frontend, I’d really like to hear what hurt.

Honestly, this has become one of my favourite things to work on. Each week I understand CKB a little better, and every time something breaks on someone else’s machine, the project gets more real. Thank you to everyone who replied to the direction check: it changed what I built. I’m excited to see where this goes, and I’d love for some of you to come along :folded_hands:

5 Likes

Update: the setup ceremony for the private tally is open.

The circuit is frozen at tag private-tally-v2-circuit-freeze and the first contribution is in (mine, as Xiaomao). The beacon will be the hash of CKB mainnet block 20,870,000, so contributions need to land before then, roughly by 30 October.

Why it matters: the private tally won’t go to testnet with a single-party key. With a ceremony, the key is safe as long as one contributor throws away their randomness.

How to contribute:

  • You need a laptop with Node.js 18+.
  • It’s a relay, one person at a time, because each key builds on the previous one. Reply here or open a “Turn request: ” issue on the repo, and I’ll tag you when it’s your turn.

Guide: noir-ckb-verifier/docs/setup-ceremony.md at main · wamimi/noir-ckb-verifier · GitHub
Transcript so far: noir-ckb-verifier/ceremony/private-tally-v2 at main · wamimi/noir-ckb-verifier · GitHub

4 Likes

The noir-ckb private tally setup ceremony is complete!

Thank you to everyone who contributed: @menxui @alienate08 and @ceciliamulandi The key was sealed with the hash of CKB mainnet block 20,870,000, and every contribution was verified.

You can find your contribution hash in the final verification log:

Next up: deploying the private tally on testnet with this key, so anyone can create and update their own hidden tally.The noir-ckb private tally setup ceremony is complete!

4 Likes