Skip to main content

Wickra ZK — prove a backtest zero-knowledge: on-chain-verifiable performance without revealing the data or the strategy

Built on Wickra Status CI CodeQL codecov GitHub release crates.io PyPI npm NuGet Maven Central Go module R-universe License: MIT OR Apache-2.0 OpenSSF Scorecard OpenSSF Best Practices Build provenance Docs Verified across 10 languages Zero-knowledge

Prove a backtest in zero knowledge. The deterministic Wickra engine runs inside a RISC Zero zkVM guest, and the receipt proves the report's hash and headline metrics without revealing the candles or the strategy.

▶ Live demos: the backtester compiled to WebAssembly, an equity curve building bar by bar — backtest-live.wickra.org; one StrategySpec side by side in Python, Rust, JS and Go — playground.wickra.org; all 515 indicators of the core over a real Binance feed — live.wickra.org. Zero backend, all of them.

Part of the Wickra ecosystem: the same data-driven core also powers wickra-backtest, wickra-proof, wickra-verify and 20 more — see the full list.

wickra-zk runs a deterministic Wickra backtest as a guest program inside the risc0 zkVM and produces a succinct zero-knowledge proof over it. Anyone holding the proof -- a server, an auditor, a browser -- checks it against the pinned guest and can trust the reported performance metrics without ever seeing the price data or the strategy internals. The proof is a constant-size STARK receipt; wrapping it for an on-chain verifier is on the roadmap.

This works only because Wickra computes byte-deterministically: the report the guest proves is exactly the one wickra-backtest produces natively and wickra-proof canonicalizes and hashes.

use wickra_zk_host::{commit_dataset, prove, verify, ProveOptions, ZkSpec};

// The strategy and the candles are the private inputs; the proof is bound to
// the candles through their canonical hash, which the guest recomputes.
let spec = ZkSpec { strategy, dataset_commitment: commit_dataset(&candles)? };
let proof = prove(&spec, &candles, ProveOptions::default())?;

// Anyone verifies the receipt against the pinned guest and reads the journal
// from it -- the report hash, the commitment, sharpe, pnl, the trade count.
let journal = verify(&proof)?;
println!("report_hash: {}", journal.report_hash);

The same envelope -- prove, commit, verify, version as JSON -- is what the CLI and every binding speak: Python, Node.js, C, C++, C#, Go, Java and R prove and verify natively, and a WebAssembly build verifies in the browser.

Status

0.2.3 — the current release. Early development (0.1.0); See ROADMAP.md.

Documentation

What is proved

  • A public report_hash — the canonical hash of the full BacktestReport.
  • A small set of public metrics (e.g. sharpe, pnl, n_trades).
  • Bound to a specific GUEST_ID (the program that ran) so a verifier knows the honest engine produced the result.

What stays private: the OHLCV candles and the strategy internals — they are guest inputs, never revealed by the receipt.

Quickstart

cargo install wickra-zk
wickra-zk prove  --spec examples/specs/momentum.json --data examples/data/BTCUSDT.csv --out momentum.proof.json
wickra-zk verify --proof momentum.proof.json

The prover is in-process and the compiled guest ships inside the crate, so nothing else is installed. Add --dev (or RISC0_DEV_MODE=1) for a fast, unsound receipt while developing; a real proof takes minutes. One runnable example per language lives under examples/.

Use in any language

The same Prover handle — construct, drive with command(json) -> json, read version — is reachable from every binding, and prove / verify return the same bytes in each of them:

import json
import wickra_zk

prover = wickra_zk.Prover()
print(json.loads(prover.command(json.dumps({"cmd": "version"}))))
proof = json.loads(prover.command(json.dumps({"cmd": "prove", "spec": {"strategy": strategy}, "candles": candles})))
journal = json.loads(prover.command(json.dumps({"cmd": "verify", "proof": proof})))

prove blocks for as long as the zkVM runs — seconds with RISC0_DEV_MODE=1, minutes for a real receipt — in every binding alike; the command envelope is documented once, in docs/ZK.md. The C ABI hub (bindings/c) backs C, C++, C#, Go, Java and R; Rust, Python, Node.js and WASM are native (the WASM package verifies only: a browser checks a proof, it does not produce one). See each bindings/<lang>/README.md and the runnable examples/.

Project layout

crates/wickra-zk-host/     the host: prove, verify, the ZkSpec/PublicOutputs model
crates/wickra-zk-cli/      the `wickra-zk` command line
crates/wickra-zk-bench/    criterion benchmarks over the proving path
guest/methods/guest/       the guest program -- the code that runs inside the
                           zkVM and whose honest execution the receipt attests
guest/methods/             the compiled guest, committed: its ELF and image id
guest/builder/             compiles the guest through risc0-build and writes
                           the two files above; the only risc0 consumer
bindings/                  c, python, node, wasm (verify only), go, csharp,
                           java, r -- one JSON envelope over the host
examples/                  one runnable prove/verify per language
golden/                    frozen (spec, data) -> expected journals, one real
                           receipt, the case-to-dataset map
fuzz/                      libfuzzer targets over the JSON boundary

Building everything from source

git clone https://github.com/wickra-lib/wickra-zk && cd wickra-zk
cargo build --release                     # host, CLI, C ABI, Python and Node crates
RISC0_DEV_MODE=1 cargo test --workspace   # dev-mode receipts: seconds, unsound

The compiled guest is committed, so this needs no risc0 toolchain. Changing the guest does -- see CONTRIBUTING.md for the builder and the reproducible rebuild CI holds it to.

Testing

Run the suites with the commands in Building everything from source.

  • wickra-zk-host — the determinism chain, end to end: the native path's report hash, the dev-mode guest's journal, and the blessed fixtures must all agree. That equality is the product; if the guest and the native engine ever disagree, the proof attests to something other than what the engine computes.
  • The guest is rebuilt for riscv32im-risc0-zkvm-elf in risc0's build container on every change and compared byte for byte with the committed ELF and image id, and linted for that target separately, because a guest that builds on the host proves nothing about the one that runs in the circuit.
  • Every binding proves the golden cases through the envelope in dev-mode and holds the journal to the blessed report hash and metrics; the WebAssembly verifier and the host verify a committed real receipt, so the sound path is exercised on every push without a prover.
  • fuzz/ — libfuzzer targets over the spec and journal parsers, run as a time-boxed smoke in CI.
  • Nightly — prove.yml runs the real proving path rather than dev mode. Dev mode produces an unsound receipt quickly, which is right for CI and wrong as the only thing ever exercised.

Requirements

  • Linux or macOS. risc0 has no Windows host, so neither the crates nor any binding build there; on Windows use WSL.
  • Rust 1.90+. The prover is in-process and the compiled guest is committed, so building, proving and verifying need no risc0 toolchain; changing the guest does (see CONTRIBUTING.md).
  • On macOS, Xcode's Metal toolchain: risc0 compiles its Metal kernels whenever the prover is built there. xcodebuild -downloadComponent MetalToolchain once; the crate reports cannot execute tool 'metal' until then.
  • Per binding: Python 3.9+, Node.js 20+, a C toolchain and CMake, .NET 8 SDK, JDK 22+, Go 1.23+, R 4.1+ -- the floors the manifests declare.
  • See CONTRIBUTING.md for the full verify workflow.

Benchmarks

crates/wickra-zk-bench measures the proving path with criterion, and CodSpeed reports instruction counts on every pull request. Absolute proving times depend on the machine and on whether the receipt is real or dev-mode; the numbers worth watching are relative, which is what CodSpeed reports.

cargo bench -p wickra-zk-bench

Ecosystem

Part of the Wickra family — each one a data-driven core with a CLI and the same binding surface:

  • wickra — main library (Rust core + Python / Node.js / WASM bindings + a C ABI for C / C++ / C# / Go / Java / R)
  • wickra-playground — a polyglot strategy playground: one StrategySpec live side by side in Python, Rust, JS and Go, entirely in the browser
  • wickra-exchange — unified market-data + execution across ten crypto exchanges
  • wickra-backtest — event-driven backtester over the Wickra core
  • wickra-terminal — the trading terminal: a TUI and a browser renderer over the stack
  • wickra-screener — parallel multi-symbol screening over 495 streaming indicators
  • wickra-radar — perp-universe alert radar: OI delta, funding flip, book imbalance, liquidation clusters, OI/price divergence
  • wickra-copilot — local market copilot grounded in real order-book, liquidation and funding microstructure
  • wickra-shazam — match an asset's current microstructure fingerprint against its entire history
  • wickra-benchmark — reproducible, golden-verified benchmark suite — recompute any (strategy, dataset, report) in ten languages and confirm it byte-for-byte
  • wickra-strategy-ci — Jest for trading strategies: golden-pin the report, catch regressions in CI, property-test against fuzzed data
  • wickra-verify — confirm or refute a claimed backtest report against its strategy and data, in ten languages
  • wickra-proof — Proof-of-Backtest: deterministic (spec, data) → report + blake3 hash, recomputable byte-for-byte in ten languages
  • wickra-zk — this repository: prove a backtest zero-knowledge, verifiable anywhere without the data or the strategy
  • wickra-impact — the backtester that knows you would have moved the market: agent-based fills on the real historical L2 order book
  • wickra-darwin — evolutionary strategy search at millions of backtests per second, mutating and crossing JSON specs across the 495-indicator space
  • wickra-gym — a Gymnasium-compatible, microstructure-aware backtest environment with O(1) steps for deterministic RL rollouts
  • wickra-feature-store — OHLCV and microstructure streams into ML-ready feature matrices over 495 O(1) streaming indicators

Contributing

Pull requests welcome — see CONTRIBUTING.md. By participating you agree to the Code of Conduct.

Security

Report vulnerabilities privately — see SECURITY.md.

License

Licensed under either of

at your option. Use it, fork it, modify it, redistribute it — commercially or not — file issues, send pull requests; all welcome.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Disclaimer

This software is provided for research and educational purposes. It is not financial advice. A zero-knowledge proof attests only to the honest execution of the pinned guest program over the prover's inputs; it makes no claim about the quality, provenance, or future performance of a trading strategy.


GitHub stars GitHub forks GitHub issues

Built on Wickra. If it saved you time, the cheapest way to say thanks is to ⭐ the repo.

wickra-zk star history

Metadata

Release files for wickra-zk 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wickra-zk 0.2.3
File Size Uploaded Provenance Actions
wickra_zk-0.2.3.tar.gz 812.0 kB Without provenance Details for wickra_zk-0.2.3.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for wickra-zk 0.2.3
File Actions
wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl
wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl CPython 3.9 abi3 Linux musl 1.2+ ARM64 Details for wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl
wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_x86_64.whl
wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_aarch64.whl
wickra_zk-0.2.3-cp39-abi3-macosx_11_0_x86_64.whl CPython 3.9 abi3 macOS 11.0+ x86-64 Details for wickra_zk-0.2.3-cp39-abi3-macosx_11_0_x86_64.whl
wickra_zk-0.2.3-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for wickra_zk-0.2.3-cp39-abi3-macosx_11_0_arm64.whl

Total release size: 293.4 MB

Release files / wickra_zk-0.2.3.tar.gz

Download URL wickra_zk-0.2.3.tar.gz
Size 812.0 kB
Tags Source
SHA-256 checksum
How to use checksums
22a09ac560cbb3670e1f56c8cc525842d316b93f7377b802afc46c9db48c7bd5
BLAKE2b-256 checksum
How to use checksums
eaf5283b168d6185fc5531145c9e02b8b8c76248ef7589ac66c6b9f27f0a8177
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_x86_64.whl
Size 53.3 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
033ade789ac16eb9050ebb11dc1c43ee22e7c35bed3ef52b6b63fb6acb12e716
BLAKE2b-256 checksum
How to use checksums
b293781560ef3ebe8bf531676324740fb29e3edbdf9ac502ff8aca9bb243c333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-musllinux_1_2_aarch64.whl
Size 53.8 MB
Tags CPython 3.9 Linux musl 1.2+ ARM64 abi3
SHA-256 checksum
How to use checksums
e991fdaf6a6eb9e9a45750cfad23b380e0d7d5a93349deaa138b6885631281b5
BLAKE2b-256 checksum
How to use checksums
da024ae3f325f6a6f658f5564b5f3f8c7300a416c8601626b940b3ab33c78d42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_x86_64.whl
Size 46.6 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
d2bd34058b40cedae17aa010538c7948deb689c2bf7cefaf67036be5b468c491
BLAKE2b-256 checksum
How to use checksums
f4eff9079cef4ea8b3d5d0ce4c6f50ec3a7b93d3512682b9a78124581f348c5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-manylinux_2_28_aarch64.whl
Size 47.4 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b6b022d1a14c956e49b64c06a2041ec82a8840802a97fc6366ceaf56710d5f09
BLAKE2b-256 checksum
How to use checksums
01fd7401faaefaefbf43e27f1678d2d668c5b89c3b0d82d43859a225ea74c14b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-macosx_11_0_x86_64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-macosx_11_0_x86_64.whl
Size 45.6 MB
Tags CPython 3.9 abi3 macOS 11.0+ x86-64
SHA-256 checksum
How to use checksums
216a68b59648e74a38c243ed20e979c006d2a62321e7f6f2066ca37460304a27
BLAKE2b-256 checksum
How to use checksums
ab36eacaffe692dde401d1d5799395b13770d2045bc3c7fb43d011c60d23f0ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / wickra_zk-0.2.3-cp39-abi3-macosx_11_0_arm64.whl

Download URL wickra_zk-0.2.3-cp39-abi3-macosx_11_0_arm64.whl
Size 45.8 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
c857e13bf3f708e01d20b34ae32221d9cd998affcf78816d6842404f65dcf17c
BLAKE2b-256 checksum
How to use checksums
f3698e484c216faf3a694999eceb36cfb6bc9e4aa7f463ec9f3d99bd3b442132
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for wickra-zk 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page