Skip to content
leanEthereumPublic

About

Minimal zkVM for Ethereum.

Resources

Stars

187 stars

Watchers

7 watching

Forks

Repository files navigation

leanVM

leanVM

minimal hash-based zkVM, for post-quantum Ethereum

Documentation

leanXMSS aggregation 1600/s
leanSPHINCS aggregation 500/s
leanDA commitment 3,2 MiB/s
2-to-1 recursion 140 ms
proving KECCAK 800K/s
cheap cycles 7,6M/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.

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 --prover experimental aggregate --xmss 1400 --log-inv-rate 2 --repeat 3
aggregation, 1,400 leanXMSS signatures
  cycles (VM steps)           : 1,147,761 = 2^20.13
    details                   : XOR 2^17.999 (22.8%)  KECCAK 2^17.994 (22.7%)  MUL 2^17.855 (20.7%)  SET 2^17.365 (14.7%)  DEREF 2^17.3 (14.1%)  JUMP 2^15.81 (5.0%)  MEMORY 2^21.081  BYTECODE 2^18.812  TOTAL_COMMITTED 2^25.589
  proof size                  : 209.4 KiB
  proving time                : 0.885 s ± 0.8%      peak memory 4.995 GiB
  per signature               : 1,581.591 signatures/s
  verifying                   : 4.522 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 --prover experimental aggregate --sphincs 500 --log-inv-rate 1 --repeat 3
aggregation, 500 leanSPHINCS signatures
  cycles (VM steps)           : 2,757,351 = 2^21.395
    details                   : XOR 2^19.755 (32.1%)  MUL 2^19.435 (25.7%)  SET 2^19.391 (24.9%)  KECCAK 2^17.976 (9.3%)  DEREF 2^17.195 (5.4%)  JUMP 2^16.058 (2.5%)  MEMORY 2^22.043  BYTECODE 2^18.812  TOTAL_COMMITTED 2^26.422
  proof size                  : 294.1 KiB
  proving time                : 0.986 s ± 0.4%      peak memory 4.574 GiB
  per signature               : 507.34 signatures/s
  verifying                   : 5.341 ms

data availability

cargo leanvm --prover experimental aggregate --blobs 32 --log-inv-rate 1 --repeat 3
aggregation, 32 blobs
  cycles (VM steps)           : 2,602,234 = 2^21.311
    details                   : XOR 2^20.063 (42.1%)  MUL 2^19.392 (26.4%)  DEREF 2^19.25 (24.0%)  SET 2^16.717 (4.1%)  KECCAK 2^16.088 (2.7%)  JUMP 2^14.14 (0.7%)  MEMORY 2^21.88  BYTECODE 2^18.801  TOTAL_COMMITTED 2^26.291
  proof size                  : 289.8 KiB
  proving time                : 0.643 s ± 2.6%      peak memory 4.28 GiB
  blob throughput             : 49.757 blobs/s, 6.22 MiB/s
  verifying                   : 5.466 ms

recursion

cargo leanvm --prover experimental recursion --n 2 --xmss-per-leaf 1400 --leaf-log-inv-rate 2 --log-inv-rate 1 --repeat 3
recursion 2→1, over leaves of 1,400 leanXMSS signatures, leaf rate = 1/4, recursion rate = 1/2
  cycles (VM steps)           : 431,087 = 2^18.718
    details                   : MUL 2^17.185 (34.6%)  XOR 2^16.726 (25.1%)  DEREF 2^16.641 (23.7%)  SET 2^15.409 (10.1%)  JUMP 2^13.797 (3.3%)  KECCAK 2^13.747 (3.2%)  MEMORY 2^19.394  BYTECODE 2^18.812  TOTAL_COMMITTED 2^23.611
  proof size                  : 270.5 KiB
  proving time                : 0.146 s ± 3.9%      peak memory 0.917 GiB
  verifying                   : 6.921 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                         :     63.8 ms ± 12.0%    5.1%
  commit                          :    116.1 ms ± 0.4%    9.2%
  output claim                    :     12.2 ms ± 1.8%    1.0%
  layers and openings             :    932.2 ms ± 1.2%   74.1%
  pcs opening                     :    133.7 ms ± 0.9%   10.6%
  ------------------------------------------
  prove TOTAL (witness included)  :   1258.1 ms ± 0.7%
  verify                          :      2.7 ms
  throughput                      :        833,488 permutations/s ± 0.7%
  proof size                      :       281.3 KiB  (1722 scalars, 254.4 KiB of Merkle openings)

Fibonacci

cargo leanvm --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,040,016
    details                   : MUL 2^20.944 (98.9%)  SET 2^13.288 (0.5%)  DEREF 2^12.967 (0.4%)  JUMP 2^10.968 (0.1%)  XOR 2^10.966 (0.1%)  MEMORY 2^20.959  BYTECODE 2^10.017  TOTAL_COMMITTED 2^25.014
  proof size                  : 262.6 KiB
  proving                     : 0.267 s ± 2.1%   7,641,814 cycles/s      peak memory 1.733 GiB
  verifying                   : 3.85 ms

SNARK machinery

FV Credits:

About

Minimal zkVM for Ethereum.

Resources

Stars

187 stars

Watchers

7 watching

Forks

Releases

Packages

Contributors

Languages