From 49485dd2b29f34ebc907ccec5e9558930a4373cb Mon Sep 17 00:00:00 2001 From: Ignacio Hagopian Date: Fri, 6 Oct 2023 17:11:07 -0300 Subject: [PATCH] readme: new readme Signed-off-by: Ignacio Hagopian --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 13a4c11..42aefc1 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,67 @@ -# zig-verkle-crypto -This is a Zig implementation of the [reference spec](https://github.com/crate-crypto/verkle-trie-ref) for Ethereum Verkle Trees cryptography. +# verkle-crypto -## Development +A pure Zig implementation of Verkle Tree cryptography. -This repository is quite experimental and might be under heavy development for a while. -Probably until being feature complete, it might not be entirely safe or performant. +## Features -Here be dragons! +This library is feature complete: +- [X] Relevant finite field arithmetic. +- [X] Bandersnatch and Banderwagon group implementations. +- [X] Pedersen Hashing for trie-key caculations. +- [X] Proof creation and verification. + +Some notes about the implementation: +- Both trie-key calculation and proof verification are very efficient. +- This library has no external dependencies. +- No assembly is used, so it can be compiled to all [supported targets](https://ziglang.org/download/0.11.0/release-notes.html#Tier-System). +- This library is single-threaded. It's planned to add multi-threading support in the future. +- Comptetitive with (or faster, single threaded) than [go-ipa](https://github.com/crate-crypto/go-ipa) or [rust-verkle](https://github.com/crate-crypto/rust-verkle). + +This library isn't audited nor battle-tested, so it isn't recommended to be used in production. + +## Test +``` +$ zig build test --summary all +Build Summary: 3/3 steps succeeded; 48/48 tests passed +test success +└─ run test 48 passed 4s MaxRSS:344M + └─ zig test ReleaseSafe native success 14s MaxRSS:388M + +``` + +## Bench +`AMD Ryzen 7 3800XT`: +``` +$ zig build bench -Dtarget=native -Doptimize=ReleaseFast +Setting up fields benchmark... + Legendre symbol... takes 9µs + Field square root... takes 8µs + Field inverse... takes 6µs + Field batch inverse (100 elements)... takes 13µs + Mul... takes 21ns + Add... takes 5ns + +Benchmarking Pedersen hashing... + with 1 elements... takes 6µs + with 2 elements... takes 7µs + with 4 elements... takes 10µs + with 8 elements... takes 15µs + with 16 elements... takes 26µs + with 32 elements... takes 46µs + with 64 elements... takes 88µs + with 128 elements... takes 170µs + with 256 elements... takes 343µs + +Setting up IPA benchmark... + proving takes 55ms, verifying takes 4ms + +Setting up multiproofs benchmark... + Benchmarking 100 openings... proving takes 73ms, verifying takes 5ms + Benchmarking 1000 openings... proving takes 120ms, verifying takes 12ms + Benchmarking 5000 openings... proving takes 336ms, verifying takes 39ms + Benchmarking 10000 openings... proving takes 607ms, verifying takes 72ms +``` ## License -MIT \ No newline at end of file +MIT. \ No newline at end of file