Skip to content
leanEthereumPublic

About

Minimal zkVM for Ethereum.

Resources

Contributing

Stars

205 stars

Watchers

8 watching

Forks

Repository files navigation

leanVM

leanVM

minimal hash-based zkVM, for post-quantum Ethereum

Documentation

leanXMSS aggregation 3400/s
leanSPHINCS aggregation 690/s
leanDA commitment 7,1 MiB/s
2-to-1 recursion 118 ms
proving KECCAK 870K/s
cheap cycles 8,2M/s

security

leanVM is designed for security:

  • 125-bit ROM (62-bit QROM) soundness
  • no proximity gap conjecture
  • end-to-end formal verification
  • a traditional hash function (Keccak-256)

work in progress

  • leanVM is not yet stable
  • Formal statements are still under review
  • The Lean statements only describe the spec. Proving the Rust implem is faithful to the spec is still WIP.

leanVM is not (yet) production ready.

two provers

In the short term, we provide two Rust implementations of the prover, stable (for readability and safety) and experimental (includes the latest optimizations). There will eventually be a single prover in this repo.

bindings

Python, Node.js, Java, Go, Zig and Nim bindings for leanXMSS, leanSPHINCS and their aggregation, released together as bindings-vX.Y.Z (releases):

language package
Python py-lean-pq on PyPI
Node.js @kevaundray/lean-pq on npm
Java io.github.crate-crypto:lean-pq on Maven Central
Go leanvm.org/go
Zig lean-pq-zig-X.Y.Z.tar.gz attached to each bindings-vX.Y.Z release
Nim bindings/nim at tag bindings-vX.Y.Z

Install commands and supported platforms are in bindings/README.md. Rust code uses lean_vm directly.

benchmarks

machine: M4 Max MacBook Pro (12 performance cores, 4 efficiency cores, 48GB RAM, CPU only, i.e. no metal GPU)

leanXMSS aggregation

The leanXMSS parameters are specified in leanXMSS.pdf, with a security proof in Lean 4. This is not the definitive parameter set.

cargo leanvm-bench --prover experimental aggregate --xmss 1300 --log-inv-rate 2 --repeat 3
aggregation, 1,300 leanXMSS signatures
  cycles (VM steps)           : 693,836 = 2^19.404
    details                   : SET 2^17.436 (25.6%)  XOR 2^17.192 (21.6%)  KECCAK 2^16.995 (18.8%)  DEREF 2^16.656 (14.9%)  MUL 2^16.597 (14.3%)  JUMP 2^15.041 (4.9%)  MEMORY 2^20.122  BYTECODE 2^18.372  TOTAL_COMMITTED 2^24.768
  proof size                  : 205.2 KiB
  proving time                : 0.382 s ± 0.9%      peak memory 2.715 GiB
  per signature               : 3,399.74 signatures/s
  verifying                   : 5.163 ms

leanSPHINCS aggregation

The leanSPHINCS parameters are specified in leanSPHINCS.pdf, with a security proof in Lean 4. This is not the definitive parameter set.

cargo leanvm-bench --prover experimental aggregate --sphincs 500 --log-inv-rate 1 --repeat 3
aggregation, 500 leanSPHINCS signatures
  cycles (VM steps)           : 2,749,442 = 2^21.391
    details                   : XOR 2^19.752 (32.1%)  MUL 2^19.42 (25.5%)  SET 2^19.385 (24.9%)  KECCAK 2^17.976 (9.4%)  DEREF 2^17.233 (5.6%)  JUMP 2^16.058 (2.5%)  MEMORY 2^21.801  BYTECODE 2^18.372  TOTAL_COMMITTED 2^26.205
  proof size                  : 284.6 KiB
  proving time                : 0.723 s ± 2.1%      peak memory 5.437 GiB
  per signature               : 691.462 signatures/s
  verifying                   : 6.173 ms

data availability

cargo leanvm-bench --prover experimental aggregate --blobs 32 --log-inv-rate 1 --repeat 3
aggregation, 32 blobs
  cycles (VM steps)           : 2,567,671 = 2^21.292
    details                   : XOR 2^20.063 (42.7%)  DEREF 2^19.321 (25.5%)  MUL 2^19.248 (24.2%)  SET 2^16.719 (4.2%)  KECCAK 2^16.088 (2.7%)  JUMP 2^14.096 (0.7%)  MEMORY 2^21.867  BYTECODE 2^18.372  TOTAL_COMMITTED 2^26.291
  proof size                  : 290.1 KiB
  proving time                : 0.56 s ± 4.4%      peak memory 4.229 GiB
  blob throughput             : 57.137 blobs/s, 7.142 MiB/s
  verifying                   : 6.03 ms

recursion

cargo leanvm-bench --prover experimental recursion --n 2 --xmss-per-leaf 1300 --leaf-log-inv-rate 2 --log-inv-rate 1 --repeat 3
recursion 2→1, over leaves of 1,300 leanXMSS signatures, leaf rate = 1/4, recursion rate = 1/2
  cycles (VM steps)           : 390,394 = 2^18.575
    details                   : MUL 2^16.92 (31.8%)  XOR 2^16.676 (26.8%)  DEREF 2^16.606 (25.5%)  SET 2^15.131 (9.2%)  KECCAK 2^13.685 (3.4%)  JUMP 2^13.659 (3.3%)  MEMORY 2^18.995  BYTECODE 2^18.372  TOTAL_COMMITTED 2^23.185
  proof size                  : 247.9 KiB
  proving time                : 0.118 s ± 0.6%      peak memory 0.685 GiB
  verifying                   : 7.913 ms

Proving KECCAK

KECCAK_N_LOG=20 BENCH_REPEAT=3 cargo bench -p experimental_keccak_gkr --bench hash_batch
Keccak GKR batch proving, 1,048,576 permutations, a state committed every 12 rounds
  witness                         :     61.2 ms ± 41.5%    5.2%
  commit                          :    125.8 ms ± 17.8%   10.7%
  output claim                    :     12.7 ms ± 4.3%    1.1%
  layers and openings             :    870.6 ms ± 2.6%   74.0%
  pcs opening                     :    106.9 ms ± 2.2%    9.1%
  ------------------------------------------
  prove TOTAL (witness included)  :   1177.2 ms ± 3.2%
  verify                          :      2.7 ms
  throughput                      :        890,745 permutations/s ± 3.2%
  proof size                      :       281.4 KiB  (1722 scalars, 254.5 KiB of Merkle openings)

Fibonacci

cargo leanvm-bench --prover experimental fibonacci --n 2000000 --log-inv-rate 1 --repeat 3
Fibonacci (in the exponent, i.e. modulo 2^64 - 1), N = 2,000,000
  cycles (VM steps)           : 2,036,016
    details                   : MUL 2^20.937 (98.6%)  DEREF 2^13.774 (0.7%)  SET 2^13.288 (0.5%)  JUMP 2^10.968 (0.1%)  XOR 2^10.966 (0.1%)  MEMORY 2^20.956  BYTECODE 2^10.014  TOTAL_COMMITTED 2^25.019
  proof size                  : 262.5 KiB
  proving                     : 0.247 s ± 1.4%   8,228,677 cycles/s      peak memory 1.749 GiB
  verifying                   : 3.287 ms

SNARK machinery

FV Credits:

About

Minimal zkVM for Ethereum.

Resources

Contributing

Stars

205 stars

Watchers

8 watching

Forks

Releases

Packages

Contributors

Languages