Add bindings to readme (#154)

* Add bindings section to readme

* Reorganize a little bit

* Remove extra blank lines
This commit is contained in:
Justin Traglia 2023-02-23 09:53:08 -06:00 committed by GitHub
parent 1d3558cec2
commit 6b2ee20102
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 76 additions and 10 deletions

View File

@ -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

15
bindings/csharp/README.md Normal file
View File

@ -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
```

1
bindings/python/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
build/

View File

@ -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

26
bindings/python/README.md Normal file
View File

@ -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
```

View File

@ -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

View File

@ -42,7 +42,7 @@ endif
# Makefile Rules
###############################################################################
all: c_kzg_4844.o
all: c_kzg_4844.o test
%.o: %.c
@$(CC) $(CFLAGS) -c $<