Skip to content

Commit

Permalink
Add bindings to readme (#154)
Browse files Browse the repository at this point in the history
* Add bindings section to readme

* Reorganize a little bit

* Remove extra blank lines
  • Loading branch information
jtraglia authored Feb 23, 2023
1 parent 1d3558c commit 6b2ee20
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 10 deletions.
34 changes: 27 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions bindings/csharp/README.md
Original file line number Diff line number Diff line change
@@ -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 change: 1 addition & 0 deletions bindings/python/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
5 changes: 4 additions & 1 deletion bindings/python/Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
26 changes: 26 additions & 0 deletions bindings/python/README.md
Original file line number Diff line number Diff line change
@@ -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
```
3 changes: 2 additions & 1 deletion bindings/rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endif
# Makefile Rules
###############################################################################

all: c_kzg_4844.o
all: c_kzg_4844.o test

%.o: %.c
@$(CC) $(CFLAGS) -c $<
Expand Down

0 comments on commit 6b2ee20

Please sign in to comment.