Runnable examples for building zero-knowledge applications on Cardano with
ZeroJ. The top-level projects are
end-to-end Spring Boot demos with UI, REST APIs, proof generation, and real
Yaci DevKit transactions. Smaller developer examples live under
examples/minimal-circuits.
Most end-to-end demos now use ZeroJ symbolic circuit annotations. The Digital
Product Passport demo is intentionally kept as the lower-level CircuitSpec
example. On-chain Groth16 and Plonk verification is delegated to ZeroJ's tested
on-chain verifier libraries:
Groth16BLS12381LibPlonkBLS12381Lib
For a first run, use a top-level Spring Boot demo. These exercise the complete flow: circuit, proof, Cardano transaction, and on-chain verification.
# 1. Start Yaci DevKit outside this repo
$ devkit start
yaci-cli> create-node -o --start
# 2. Run a full end-to-end demo through Docker
./demo.sh proof-of-reserves --runThen open the UI URL printed by demo.sh.
demo.sh starts only the selected demo app container. Yaci DevKit is expected
to be running externally on the host. The script waits for the
Blockfrost-compatible API, tops up the shared demo wallet through Yaci's admin
API, starts the app, opens the UI, and can run a happy-path curl flow with
--run.
./demo.sh proof-of-reserves --run
./demo.sh identity-kyc --run
./demo.sh nft-ownership --run
./demo.sh voting --run
./demo.sh airdrop --run
./demo.sh dpp --run
./demo.sh selective-disclosure --run
./demo.sh reusable-kyc --runStop a demo without stopping Yaci:
./demo.sh proof-of-reserves --stopzeroj-usecases/
proof-of-reserves/ Spring Boot E2E
identity-kyc/ Spring Boot E2E
nft-ownership/ Spring Boot E2E
private-voting/ Spring Boot E2E
personhood-airdrop/ Spring Boot E2E
digital-product-passport/ Spring Boot E2E, CircuitSpec reference
selective-disclosure/ Spring Boot E2E
reusable-kyc/ Spring Boot E2E, BBS selective disclosure
pedersen-commitments/ Spring Boot E2E, three Pedersen commitment demos
examples/
minimal-circuits/
batch-threshold-matrix/ lightweight symbolic circuit example
zk-mpf-private-registry/ witness-level Poseidon MPF circuit example
plonk/
proof-of-reserves/ Plonk proof + Yaci verifier transaction
compliance-credential/ Plonk proof + Yaci verifier transaction
| Demo | What it proves | Default demo.sh port |
Circuit style |
|---|---|---|---|
| proof-of-reserves | Reserves cover liabilities without exposing balances | 8089 | Symbolic annotations |
| identity-kyc | Age and country eligibility without revealing personal data | 8087 | Symbolic annotations |
| nft-ownership | NFT ownership without revealing wallet or token | 8085 | Symbolic annotations |
| private-voting | Eligible voter, one encrypted vote, no double-vote; only the total is ever decrypted | 8086 | Symbolic annotations |
| personhood-airdrop | One claim per person per epoch | 8083 | Symbolic annotations |
| digital-product-passport | Product compliance without exposing supply-chain data | 8088 | CircuitSpec |
| selective-disclosure | Multiple predicates from one signed credential | 8091 | Symbolic annotations |
| reusable-kyc | KYC once, reveal only the attributes each service needs — BBS proof verified natively on-chain | 8092 | BBS (no circuit) |
| pedersen-commitments | Confidential points that still add up; one committed credential, prove only a predicate; solvency with hidden liabilities | 8093 | Symbolic annotations |
Some apps have native Spring ports that overlap, such as 8085. The Docker demo
maps them to distinct host ports so multiple profiles can exist without port
collisions. For direct local Java runs, run one app at a time or update
server.port in that module.
For the Docker demo path:
- Docker with Compose v2
- Yaci DevKit running on the host
Docker demos build against the ZeroJ version in version.properties (zerojVersion), the
same one the Gradle builds use; set ZEROJ_VERSION to override it. A sibling ZeroJ checkout is
optional and only needed when you explicitly opt into publishing a local ZeroJ build during
Docker image builds.
For direct Java runs:
- Java 25, preferably GraalVM
- Yaci DevKit for any on-chain flow
- Node.js is optional; frontends are already built into the Spring JARs
Gradle dependency defaults for ZeroJ, Julc, and cardano-client-lib live in
gradle/usecase-versions.gradle and are used
by every independent use-case build. Override them with -PzerojVersion=...,
-PjulcVersion=..., or -PcclVersion=....
The demo mnemonic and address are local-devnet only. Do not use them on public or production networks.
Start Yaci DevKit first:
$ devkit start
yaci-cli> create-node -o --startRun a demo:
./demo.sh proof-of-reserves --runRun from a fresh trusted setup instead of committed presentation cache:
./demo.sh proof-of-reserves --clean-cache --run--clean-cache removes only the selected usecase's Docker volume and disables
demo-cache seeding for that run.
By default the containers reach host Yaci through:
BLOCKFROST_BASE_URL=http://host.docker.internal:8080/api/v1/
YACI_ADMIN_URL=http://host.docker.internal:10000
The script derives provider health from BLOCKFROST_BASE_URL as
<base>/epochs/latest. Override it only if your provider uses a different
health endpoint:
PROVIDER_HEALTH_URL=http://host.docker.internal:8080/api/v1/epochs/latest \
./demo.sh voting --runTo run against a public Blockfrost-compatible testnet endpoint, fund the configured mnemonic on that network and disable local Yaci top-up:
DEMO_TOPUP_ENABLED=false \
BLOCKFROST_BASE_URL=https://cardano-preprod.blockfrost.io/api/v0 \
BLOCKFROST_PROJECT_ID=<project-id> \
CARDANO_NETWORK=preprod \
./demo.sh dpp --runTo build Docker demos against a local ZeroJ checkout instead of the released artifact:
PUBLISH_LOCAL_ZEROJ=true \
ZEROJ_SOURCE_CONTEXT=../zeroj \
./demo.sh proof-of-reserves --runUse this when you want to develop a module locally:
cd proof-of-reserves
./gradlew clean bootJar
java --enable-native-access=ALL-UNNAMED \
-Dzeroj.allowInsecureTrustedSetup=true \
-jar build/libs/proof-of-reserves-*.jarThe same pattern works for every top-level Spring Boot module. Some modules take several minutes on first boot because they generate or validate development trusted setup artifacts. The system property explicitly permits the single-party development setup used by these demos; do not enable it for production setup material.
These examples are for developers who want to inspect a circuit in isolation. They do not replace the E2E demos.
cd examples/minimal-circuits/batch-threshold-matrix
./gradlew test
./gradlew run
cd ../zk-mpf-private-registry
./gradlew test
./gradlew runThe Plonk examples live under examples/minimal-circuits/plonk. They can run
locally with Java or through Docker Compose. They submit lock/unlock
transactions to Yaci when run with --yaci.
cd examples/minimal-circuits/plonk/proof-of-reserves
./gradlew test
./gradlew run --args='--yaci'
cd ../compliance-credential
./gradlew test
./gradlew run --args='--yaci'Docker Compose from the repo root:
docker compose --profile proof-of-reserves-plonk up --build --abort-on-container-exit
docker compose --profile compliance-credential-plonk up --build --abort-on-container-exit
docker compose --profile plonk up --build --abort-on-container-exitPlonk proving-key caches are stored in named Docker volumes:
docker volume rm zeroj-usecases_proof-of-reserves-plonk-cache
docker volume rm zeroj-usecases_compliance-credential-plonk-cacheFrom the repository root:
# Root aggregate tasks (each runs the module's own wrapper):
./gradlew buildAllUsecasesNoTests
./gradlew testAllUsecases
# Or use the repo script, which runs each module's wrapper:
./build-all.sh build -x testEach module is a standalone Gradle build, so the root wrapper can also run one module's tasks
with -p, for example the Pedersen demo UI:
./gradlew -p pedersen-commitments bootRun -PwithFrontend # http://localhost:8093zerojVersion in version.properties may name a ZeroJ commit snapshot
(<version>-<commit>-SNAPSHOT); builds resolve those from
https://repo.bloxbean.org/maven/snapshots (restricted to the org.zeroj group).
To test against a local ZeroJ build:
cd ../zeroj
./gradlew publishToMavenLocal
cd ../zeroj-usecases
./gradlew buildAllUsecasesNoTests -PzerojVersion=<local-zeroj-version><local-zeroj-version> is the version the ZeroJ build published (a -SNAPSHOT version is
published as <version>-<commit>-SNAPSHOT). Every build resolves mavenLocal() first, so a
local publish of a released version number shadows the Maven Central artifact until it is
removed from ~/.m2/repository/org/zeroj.
For Docker builds, use PUBLISH_LOCAL_ZEROJ=true and point
ZEROJ_SOURCE_CONTEXT at the local checkout as shown in the Docker section.
Usecase CI runs on pull requests, pushes to main, and manual
dispatch. It discovers every independent Gradle build from its tracked settings.gradle
(currently 14), including the account-ownership CLI and desktop UI, and runs build with
Java 25. Svelte frontends are rebuilt from their npm lockfiles, with frontend tests where
the module provides them.
Projects with *YaciE2ETest or *DevKitE2ETest tests get a fresh, isolated devnet using the
npm package @bloxbean/yaci-devkit@0.12.0-beta5. CI waits for indexed blocks and Plutus V3
protocol parameters, enables ZEROJ_YACI_E2E=true and -Dkyc.e2e=true, and fails if any of
those tests are skipped or missing. Test reports and DevKit startup logs are uploaded even
when a build fails. All usecases passed is the aggregate status for branch protection.
Account ownership's large -Daor.e2e=true setup/proving test and circuit measurement remain
opt-in; its normal CLI and headless JavaFX tests run in CI. Native installers and binaries
remain covered by the existing release workflows.
demo-cache/ contains development setup artifacts used to make Docker demos
start quickly during presentations. They are generated with insecure
single-party development setup and are not production ceremony artifacts.
Use --clean-cache when you want to demonstrate or test first-run setup
generation.
| Symptom | Fix |
|---|---|
| Yaci health check fails | Start Yaci DevKit with yaci-cli devkit start; verify http://localhost:8080/api/v1/epochs/latest. |
| Top-up fails | Verify Yaci admin API is reachable at http://localhost:10000. |
| Container cannot reach host Yaci | Docker uses host.docker.internal; Compose also maps it through host-gateway for Linux. |
| BLST native access warning or failure | Use Java 25 and run JVM apps with --enable-native-access=ALL-UNNAMED. |
| First boot is slow | Expected for large circuits. Use committed demo cache for presentation runs or --clean-cache for fresh setup generation. |
| ZeroJ dependency resolution fails | Verify ZEROJ_VERSION is a published artifact. For unreleased local builds, set PUBLISH_LOCAL_ZEROJ=true and ZEROJ_SOURCE_CONTEXT=/path/to/zeroj. |