diff --git a/README.md b/README.md index c4af9d9..9f96cbc 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,41 @@ -# C-KZG-4844: A minimal library for EIP-4844 Polynomial Commitments +# C-KZG-4844 -This is a copy of [C-KZG](https://github.com/benjaminion/c-kzg) stripped-down to support the -[Polynomial Commitments](https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md) API: +This is a minimal library for EIP-4844 that implements the [Polynomial +Commitments](https://github.com/ethereum/consensus-specs/blob/dev/specs/deneb/polynomial-commitments.md) +API. It was originally a stripped-down copy of +[C-KZG](https://github.com/benjaminion/c-kzg), but it has been heavily modified +since then. + +## Interface functions + +There are functions for KZG operations: - `blob_to_kzg_commitment` - `compute_kzg_proof` -- `verify_kzg_proof` - `compute_blob_kzg_proof` +- `verify_kzg_proof` - `verify_blob_kzg_proof` - `verify_blob_kzg_proof_batch` -We also provide functions for loading/freeing the trusted setup: +There are functions for loading/freeing the trusted setup: - `load_trusted_setup` - `load_trusted_setup_file` - `free_trusted_setup` +## Bindings + +There are bindings for the following languages: + +| Language | Link | +|----------|--------------------------------------| +| C# | [README](bindings/csharp/README.md) | +| Go | [README](bindings/go/README.md) | +| Java | [README](bindings/java/README.md) | +| Node.js | [README](bindings/node.js/README.md) | +| Python | [README](bindings/python/README.md) | +| Rust | [README](bindings/rust/README.md) | + ## Installation Initialize the blst submodule: @@ -24,14 +44,14 @@ Initialize the blst submodule: git submodule update --init ``` -Build blst: +Build the blst library: ``` cd src make blst ``` -Build the C-KZG code: +Build/test the C-KZG-4844 library: ``` cd src diff --git a/bindings/csharp/README.md b/bindings/csharp/README.md new file mode 100644 index 0000000..b3d9c3b --- /dev/null +++ b/bindings/csharp/README.md @@ -0,0 +1,15 @@ +# C# bindings + +This directory contains C# bindings for the C-KZG-4844 library. + +## Prerequisites + +These bindings require .NET 6.0 (not 7.0). This can be found here: +* https://dotnet.microsoft.com/en-us/download/dotnet/6.0 + +## Build & test + +Everything is consolidated into one command: +``` +make +``` diff --git a/bindings/python/.gitignore b/bindings/python/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/bindings/python/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/bindings/python/Makefile b/bindings/python/Makefile index 635d1dd..8772100 100644 --- a/bindings/python/Makefile +++ b/bindings/python/Makefile @@ -1,8 +1,11 @@ .PHONY: all all: install test ecc_test +../../src/c-kzg-4844.o: + cd ../../src/ && make blst && make + .PHONY: install -install: setup.py ckzg.c +install: setup.py ckzg.c ../../src/c-kzg-4844.o python3 setup.py install .PHONY: test diff --git a/bindings/python/README.md b/bindings/python/README.md new file mode 100644 index 0000000..9a625c2 --- /dev/null +++ b/bindings/python/README.md @@ -0,0 +1,26 @@ +# Python bindings + +This directory contains Python bindings for the C-KZG-4844 library. + +## Prerequisites + +These bindings require `python3` and `py-ecc`. +``` +sudo apt install python3 python3-pip +python3 -m pip install py-ecc +``` + +## Build & test + +Everything is consolidated into one command: +``` +make +``` + +You should expect to see these messages at the bottom: +``` +python3 tests.py +tests passed +python3 py_ecc_tests.py +comparison to py_ecc passed +``` \ No newline at end of file diff --git a/bindings/rust/README.md b/bindings/rust/README.md index 1c800bb..9368c32 100644 --- a/bindings/rust/README.md +++ b/bindings/rust/README.md @@ -8,7 +8,8 @@ Generates the rust bindings for the c-kzg library. cargo build --release ``` -Build with `--features="minimal-spec"` to set the `FIELD_ELEMENTS_PER_BLOB` compile time parameter to the pre-determined minimal spec value. +Build with `--features="minimal-spec"` to set the `FIELD_ELEMENTS_PER_BLOB` +compile time parameter to the pre-determined minimal spec value. ## Test diff --git a/src/Makefile b/src/Makefile index 69271d2..1a21407 100644 --- a/src/Makefile +++ b/src/Makefile @@ -42,7 +42,7 @@ endif # Makefile Rules ############################################################################### -all: c_kzg_4844.o +all: c_kzg_4844.o test %.o: %.c @$(CC) $(CFLAGS) -c $<