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.

Balances, salaries and bids kept private on a public ledger, with Pedersen commitments, ElGamal encryption and confidential notes. These demos are new in ZeroJ 0.1.0-pre13 and all run in one app, pedersen-commitments, with a tab per use case.

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
Keep a number private on-chain, but check, add up or open it laterPedersen commitment + Groth16PedersenCommitment, ZkPedersen.commit, ZkPedersen.assertBalanced
Let the owner and an auditor read a hidden amount from the chainConfidential noteConfidentialNotes.seal, NoteScanner
Let an authority read a value, with no way for the sender to lieElGamal encryption + a proofElGamal.encryptWithOpening, ZkElGamal.encrypt
Reveal only a total, and only when a quorum agreesThreshold ElGamalDkgParticipant, ElGamal.decryptionShare, ElGamal.decrypt
Prove facts about large private state (millions of entries)Poseidon MPF / JMT (experimental)zeroj-mpf-poseidon, zeroj-jmt-poseidon

Not sure whether to reveal, prove, commit or encrypt? Choose how to disclose compares the options on one example. 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, reusable-kyc and pedersen (the confidential-values app: payroll, auction, points, credit gate and solvency tabs). 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. The pedersen-commitments demo’s credit gate does the committed-credential version; see Prove a rule.
  • 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.
  • Treasury grants within a budget. A DAO commits to each private grant, proves each one falls within an approved band, and proves the committed total stays under the treasury balance, with ZkPedersen.assertBalanced. Delivering each grant to its recipient and an auditor is the confidential payroll pattern.