c-kzg-4844/bindings/node.js
dancoffman c9ac623fe7
Turn CPP exceptions back off to see if that fixes the ELF problem
2022-11-16 16:23:06 -08:00
..
.gitignore gyp that maybe works on yarn install 2022-11-05 00:28:36 -07:00
.npmignore Ignore a couple more files that do not need to be published 2022-11-08 12:57:15 -08:00
.prettierignore Do not run prettier on dist 2022-11-03 22:37:56 -07:00
.prettierrc.json Messy publish but it works 2022-11-05 00:46:26 -07:00
Dockerfile Add test harness for building and running NodeJS tests on Linux 2022-11-08 12:47:19 -08:00
Makefile Add test harness for building and running NodeJS tests on Linux 2022-11-08 12:47:19 -08:00
README.md Patch blst submodule sha 2022-11-04 00:13:02 -07:00
babel.config.js Cleanup 2022-11-03 15:13:49 -07:00
binding.dist.gyp Turn CPP exceptions back off to see if that fixes the ELF problem 2022-11-16 16:23:06 -08:00
binding.gyp Turn CPP exceptions back off to see if that fixes the ELF problem 2022-11-16 16:23:06 -08:00
jest.config.js Cleanup 2022-11-03 15:13:49 -07:00
kzg.cxx Turn CPP exceptions back off to see if that fixes the ELF problem 2022-11-16 16:23:06 -08:00
kzg.ts Be better at TypeScript 2022-11-04 13:29:52 -07:00
package.json Turn CPP exceptions back off to see if that fixes the ELF problem 2022-11-16 16:23:06 -08:00
rollup.config.js Start working on NPM publish 2022-11-04 18:48:52 -07:00
test.ts Make C++ exceptions catchable in JS-land 2022-11-16 15:26:05 -08: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

First, 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

After making changes, regenerate the distributable JS and type defs

make bundle