c-kzg-4844/bindings/node.js
dancoffman 46fb7cc10b
Update README
2022-11-03 23:44:08 -07:00
..
dist Fix type 2022-11-03 22:57:03 -07:00
.gitignore Remove SWIG 2022-11-02 13:27:00 -07:00
.prettierignore Do not run prettier on dist 2022-11-03 22:37:56 -07:00
.prettierrc.json Use rollup to product distributable JS file 2022-11-03 22:30:54 -07:00
Makefile nodejs binding make build should do less 2022-11-03 23:27:21 -07:00
README.md Update README 2022-11-03 23:44:08 -07:00
babel.config.js Cleanup 2022-11-03 15:13:49 -07:00
binding.gyp Have gyp copy the .node file 2022-11-03 23:14:11 -07:00
jest.config.js Cleanup 2022-11-03 15:13:49 -07:00
kzg.cxx Attempt more consistency. Remove test for verifyKzgProof which is not used in 4844 2022-11-03 19:54:45 -07:00
kzg.ts Fix type 2022-11-03 22:57:03 -07:00
package.json Have gyp copy the .node file 2022-11-03 23:14:11 -07:00
rollup.config.js Generate type defs 2022-11-03 22:35:09 -07:00
test.ts Use rollup to product distributable JS file 2022-11-03 22:30:54 -07:00
tsconfig.json Do not run prettier on dist 2022-11-03 22:37:56 -07:00
yarn.lock Always make, never package.json scripts 2022-11-03 22:49:06 -07:00

README.md

This directory contains the code necessary to generate NodeJS bindings for C-KZG.


  loadTrustedSetup: (filePath: string) => SetupHandle;

  freeTrustedSetup: (setupHandle: SetupHandle) => void;

  blobToKzgCommitment: (blob: Blob, setupHandle: SetupHandle) => KZGCommitment;

  computeAggregateKzgProof: (
    blobs: Blob[],
    setupHandle: SetupHandle
  ) => KZGProof;

  verifyAggregateKzgProof: (
    blobs: Blob[],
    expectedKzgCommitments: KZGCommitment[],
    kzgAggregatedProof: KZGProof,
    setupHandle: SetupHandle
  ) => boolean;

Spec: https://github.com/ethereum/consensus-specs/blob/dev/specs/eip4844/polynomial-commitments.md

npm install -g yarn if you don't have it.

Install the blst submodule

git submodule update --init

Build blst and c_kzg_4844.c

cd src && make blst lib

Generate NodeJS bindings and run the TypeScript tests against them

cd ../bindings/node.js && yarn install && make test

After doing this once, you can re-build (if necessary) and re-run the tests with

make build test