Skip to content

Building and packaging of the Java bindings in C-KZG-4844

License

Notifications You must be signed in to change notification settings

Consensys/jc-kzg-4844

Repository files navigation

jc-kzg-4844

Build Status GitHub license Version of 'c-kzg-4844' Maven Central

Provides building and packaging of the Java bindings in C-KZG-4844.

Dependency

dependencies {
    implementation("io.consensys.protocols:jc-kzg-4844:<version>")
}

Minimal sample

// load the library once at startup
CKZG4844JNI.loadNativeLibrary();

// once a trusted setup is loaded, all methods will use it
CKZG4844JNI.loadTrustedSetup("trusted-setup.txt");

byte[] blob = ...;
byte[] commitment = CKZG4844JNI.blobToKzgCommitment(blob);
byte[] proof = CKZG4844JNI.computeBlobKzgProof(blob, commitment);

boolean isValidProof = CKZG4844JNI.verifyBlobKzgProof(blob, commitment, proof);

// the current trusted setup should be freed before a new one is loaded
CKZG4844JNI.freeTrustedSetup();

Loading trusted setup

There are two ways to load the trusted setup.

File

The file needs to be of the following format: trusted_setup.txt

Method parameters

Look at the loadTrustedSetup(byte[], long, byte[], long) method.

Supported platforms

  • x86-64
    • Windows
    • Linux
    • MacOS
  • aarch64
    • Linux
    • MacOS