Skip to content

Use cases

View Markdown

A zero-knowledge proof lets you prove a fact without revealing the data behind it. “I’m over 18” without a birth date. “I’m on the voter list” without saying which voter. “Our reserves cover every deposit” without publishing a single balance. A Cardano validator can check that kind of proof in one transaction. The secret inputs never leave the prover’s machine.

This section walks through what that makes possible. Each page explains the real-world problem, the statement being proven, what stays private, how the proof reaches the chain, and the security questions you still have to answer. Most pages also link a runnable demo.

Almost every use case is built from a small set of patterns. Start from what you need to prove:

You need to…ApproachZeroJ building blocks
Prove a predicate over a hidden value (age ≥ 18, carbon ≤ 50 kg, reserves ≥ liabilities)Groth16 circuitZkUInt with @UInt(bits = …) and gte / lte comparisons
Reveal some issuer-signed attributes and hide the restBBS selective disclosure (no circuit, no trusted setup)BbsService in zeroj-bbs; BbsProofVerify for on-chain checks
Prove you’re in a set without saying which memberMerkle tree + PoseidonZkMerkle.verifyProofPoseidon with PoseidonParamsBLS12_381T3.INSTANCE
Allow one action per person, credential or NFTNullifierZkPoseidon.hash(zk, PoseidonParamsBLS12_381T3.INSTANCE, secret, contextId), stored on-chain (sorted list, spent UTxO)
Rely on a fact someone else attestedIssuer signature checked inside the circuitZkEdDSAJubjub.verifyWithRegisteredKey
Stop a copied proof from paying someone elseBind the recipient or the spent UTxO into the public inputsrecipient public input; a spend reference computed from ScriptContext in your validator
Prove facts about large private state (millions of entries)Poseidon MPF / JMT (experimental)zeroj-mpf-poseidon, zeroj-jmt-poseidon

Groth16 on BLS12-381 is the default proof system for everything above. Circuits use Poseidon with explicit BLS12-381 parameters. For the concepts behind these patterns, read Circuits, constraints & witnesses and ZK on Cardano.

The zeroj-usecases repository has complete Spring Boot apps for most pages here. Each one covers the circuit, proof generation, a Cardano transaction and on-chain verification, with a small web UI.

You need Docker (with Compose v2) and a Yaci DevKit devnet running on your machine:

Terminal window
# 1. Start a local Cardano devnet (outside the demos repo)
devkit start
# then, at the yaci-cli prompt:
# create-node -o --start
# 2. Run a demo end to end
git clone https://github.com/bloxbean/zeroj-usecases
cd zeroj-usecases
./demo.sh proof-of-reserves --run
# 3. Stop it (Yaci keeps running)
./demo.sh proof-of-reserves --stop

demo.sh tops up a devnet-only demo wallet, starts the app, opens its UI and, with --run, runs the happy path. The demo names are proof-of-reserves, identity-kyc, nft-ownership, voting, airdrop, dpp, selective-disclosure and reusable-kyc. The account-ownership demo ships separately as a desktop app and CLI; see its page.

The demos use a single-party development trusted setup (they run with -Dzeroj.allowInsecureTrustedSetup=true, and cached setup files are generated the same way). Real deployments need keys from a multi-party ceremony; see Trusted setup, explained.

These ideas are not implemented as demos. They show how the same building blocks carry over to new problems.

  • Private credit score for lending. A borrower proves “score ≥ 700” from a credit bureau’s signed credential. That needs an in-circuit issuer signature (ZkEdDSAJubjub), a ZkUInt.gte range check and a public input bound to the loan UTxO. BBS is an option if revealing a score band is acceptable.
  • Sealed-bid auctions. Bidders publish Poseidon(bid, salt) during bidding, then prove their bid clears the reserve price without revealing it. ZeroJ’s integration tests include sealed-bid example circuits: an annotation-style AnnotatedSealedBid and a DSL version with a Yaci DevKit on-chain test. That’s a starting point, not a full auction protocol.
  • Anonymous feedback and whistleblowing. An employee proves membership in a Merkle tree of staff keys and publishes one nullifier per topic. The report’s hash is bound as a public input, so every report is from a real member and nobody can flood a topic. The shape is the private voting circuit.
  • Payroll or treasury solvency. A DAO proves that a batch of private salaries or grants sums to no more than the treasury balance, and that each payment falls within an approved band. That uses ZkUInt sums and comparisons plus a Poseidon commitment to the batch, as in proof of reserves.