#commitment #kzg #scheme #ethereum #cryptography #blockchain #eip-7594

rust_eth_kzg

This crate provides an implementation of the cryptography needed for EIP-7594

6 releases

0.5.2 Sep 24, 2024
0.5.1 Aug 27, 2024
0.4.1 Aug 13, 2024
0.3.4 Aug 5, 2024

#6 in #kzg

Download history 1914/week @ 2024-08-30 1341/week @ 2024-09-06 1477/week @ 2024-09-13 1427/week @ 2024-09-20 1179/week @ 2024-09-27 1224/week @ 2024-10-04 1660/week @ 2024-10-11 1803/week @ 2024-10-18 1595/week @ 2024-10-25 1254/week @ 2024-11-01 483/week @ 2024-11-08 1118/week @ 2024-11-15 1489/week @ 2024-11-22 2140/week @ 2024-11-29 1653/week @ 2024-12-06 1736/week @ 2024-12-13

7,281 downloads per month

MIT license

645KB
3.5K SLoC

Rust Eth KZG

Overview

What

A cryptographic library that is compatible with the KZG commitment scheme used in the Ethereum blockchain for PeerDAS.

Why

The cryptography implemented in this library is the prerequisite needed for Ethereum's version of Data Availability Sampling(DAS). The library has been implemented in a modular way, so one can also use the underlying polynomial commitment scheme, for a different purpose.

Installation

Rust

cargo add rust_eth_kzg

Node

npm i @crate-crypto/node-eth-kzg

Java

pkg:maven/io.github.crate-crypto/java-eth-kzg@X.Y.Z

CSharp

dotnet add package EthKZG.Bindings

Nim

Use the github URL for Nim.

Building the source

This library is written in Rust and offers bindings to C, C#, node.js, golang, Java and Nim. These bindings can be found in the bindings folder. The bindings expose an API that is compatible with the API needed for Ethereum.

If you only intend to modify the cryptography, then a Rust compiler will be needed. For the bindings, one should check the respective language's README file to find out additional requirements.

Building everything

To build everything including the artifacts needed for the bindings, you can run:

./scripts/compile.sh

To only build the native Rust code, you can run:

cargo build

Benchmarks

Benchmarks can be run by calling:

cargo bench

Note: This will benchmark the underlying Rust library. It will not account for (if any) discrepancies due to calling the library via a particular language. An example of this is the CGO overhead when calling a foreign language from Golang; in our case, this overhead is negligible compared to the actual computations being performed.

Consensus Specs

This library conforms and is tested against commit 13ac373a2c284dc66b48ddd2ef0a10537e4e0de6.

License

Licensed and distributed under either of

MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT

or

Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0) at your option. These files may not be copied, modified, or distributed except according to those terms.

Dependencies

~4–6MB
~186K SLoC