| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
zk-Analytics is a distributed, end-to-end verifiable, privacy-preserving cloud analytics system. It augments an analytics pipeline with lightweight append-only log commitments and zero-knowledge proofs of correct aggregation and query execution, so an external verifier can check reported results without access to raw logs or the provider's infrastructure. Proofs are generated with the RISC Zero zkVM. This repository is the implementation described in the paper "Zero-Knowledge Cloud Analytics."
The pipeline has three logically separated stages (paper §4–5):
| Crate (package) | Path | Role |
|---|---|---|
| data_source | data_source/ | log generation + SHA-256 commitment; Kafka producer; Trillian checkpoints |
| aggregator | aggregator/host/ | epoch aggregation + RISC Zero proving; Kafka consumer; resharding tools |
| aggregator-core | aggregator/core/ | no_std aggregation logic shared by host + guests |
| aggr_samples / aggr_cm / aggr_histogram | aggregator/methods/guest* | RISC Zero aggregation guests: samples / Count-Min / histogram |
| querier | querier/server/ | HTTP query service + RISC Zero proving |
| querier-core (+ guests) | querier/{core,methods}/ | query logic + RISC Zero query guests |
| common | common/ | RocksDB / FoundationDB stores, epoch types, differential privacy |
| zkvm-common | zkvm-common/ | shared no_std zkVM types (Event, hash-chain) |
| query-checker | query_checker/ | query allow/block-list access control (§5.4) |
| cf_detector | cf_detector/ | control-flow / output leakage detector for query guests (§5.4) |
| native-baseline | native_baseline/ | non-ZK baseline running the same analytics natively (evaluation) |
# RocksDB bindings need clang/libclang:
sudo apt-get update
sudo apt-get install -y clang libclang-dev
# Optional features: Kafka (rdkafka, cmake-build) and Trillian (protoc):
sudo apt-get install -y cmake libssl-dev pkg-config protobuf-compiler
# RISC Zero toolchain (guest compiler + r0vm):
curl -L https://risczero.com/install | bash && rzup install
cargo build --release # host crates + RISC Zero guest ELFsProof generation uses AVX-512 for performance; proof verification does not. FoundationDB 7.1 is required only for the FDB-backed (--features fdb) path.
Each service is a Cargo binary. End-to-end, committed batches flow data_source → Kafka → aggregator → RocksDB/FoundationDB → querier.
# Aggregator: consume a Kafka topic into a local RocksDB buffer and prove epochs
# of type samples | histogram | cm (add --features fdb to store aggregates in FDB).
cargo run -p aggregator --release --features kafka -- --mode samples
# Data source: stream events as a Kafka producer (per-source SHA-256 hash chain).
cargo run -p data_source --bin kafka-producer --release --features kafka -- \
--events 100000 --batch-size 100
# Querier: HTTP query service (default HTTP_LISTEN=0.0.0.0:8082).
cargo run -p querier --releaseFor a full local run (Kafka + FoundationDB via Docker, orchestrated in tmux):
./scripts/setup/setup_local_e2e.sh --all # install deps, Kafka/FDB, RISC Zero toolchain
./scripts/eval/run_local_e2e.sh start # data_source -> Kafka -> aggregator -> FDB -> querier
./scripts/eval/run_local_e2e.sh statusAll services use the same data directory:
Reset RocksDB storage:
ROCKSDB_PATH=/mydata/rocksdb ./scripts/setup/reset_rocksdb.shIt polls epoch_frames, verifies each per-source RISC Zero proof (host-side), and:
cd zk-Analytics
ROCKSDB_PATH=/mydata/rocksdb INIT_DB=1 cargo run -p aggregatorRecovery semantics and online resharding internals are documented in docs/INTERNALS.md.
querier serves POST /query:
cd zk-Analytics
ROCKSDB_PATH=/mydata/rocksdb cargo run -p querierSamples sum:
curl -sS localhost:8082/query \
-H 'content-type: application/json' \
-d '{"type":"samples_sum","window":"1h"}'Histogram bucket:
curl -sS localhost:8082/query \
-H 'content-type: application/json' \
-d '{"type":"histogram_bucket","window":"1d","bucket":42}'CM top-k:
curl -sS localhost:8082/query \
-H 'content-type: application/json' \
-d '{"type":"cm_topk","window":"5m","limit":20}'Samples sum by key prefix/suffix (bitmask match):
# Example: suffix match on low 16 bits (mask = 0xffff)
curl -sS localhost:8082/query \
-H 'content-type: application/json' \
-d '{"type":"samples_sum_key","window":"1h","key":123,"mask":65535}'Benchmarking and the non-ZK native baseline are documented in docs/BENCHMARKS.md.
| Back | FazBrowse Home | New Git URL |