npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

rust-kzg-node

v1.0.0

Published

Rust KZG Node.js bridge

Readme

rust-kzg-node

High-performance KZG Cryptographic Library for Node.js, powered by Rust.

rust-kzg-node provides fast, reliable, and cross-platform bindings for KZG (Kate, Zaverucha, Goldberg) polynomial commitments, essential for Ethereum's Data Availability Sampling (DAS) and EIP-4844/EIP-7594 implementation. The core logic is built on the robust and battle-tested rust-kzg library, ensuring native speeds in your Node.js application.

✨ Features

  • Native Performance: Core cryptographic operations are executed in Rust, bypassing JavaScript overhead.
  • Parallel Batching: Utilizes the Rayon crate to execute batch commitment and proof computations concurrently across available CPU cores.
  • Full API Coverage: Supports EIP-4844 (blob_to_commitment) and EIP-7594 (compute_cell_proofs).
  • Cross-Platform Binaries: Includes pre-compiled binaries for all major platforms (Windows, macOS, Linux, and their ARM variants).

📦 Installation

This package is distributed via npm and includes pre-built native binaries (.node files).

npm install rust-kzg-node
# or
yarn add rust-kzg-node

🛠️ Usage

1. Loading the Trusted Setup

The library must be initialized once by loading the necessary G1 and G2 parameters from the trusted setup. These bytes must be prepared outside of this library.

import { KzgWrapper } from 'rust-kzg-node';

// NOTE: Replace these with your actual trusted setup bytes (Uint8Array)
const G1_MONOMIAL_BYTES = new Uint8Array(...);
const G1_LAGRANGE_BYTES = new Uint8Array(...);
const G2_MONOMIAL_BYTES = new Uint8Array(...);

// Initialize the KZG instance
const kzgInstance = KzgWrapper.loadKzg(
  G1_MONOMIAL_BYTES,
  G1_LAGRANGE_BYTES,
  G2_MONOMIAL_BYTES
);

2. Computing a KZG Commitment

The primary function for EIP-4844. Takes a single blob (32 * 4096 bytes) and returns the KZG commitment.

// A single blob array (must be 131072 bytes long)
const blob = new Uint8Array(131072).fill(1); 

try {
    const commitment = kzgInstance.blobToCommitment(blob);
    console.log(`Commitment: ${commitment}`); 
    // Example output: 0x93361414e5a973a9437b084e62217c45... (48 bytes + 0x prefix)
} catch (error) {
    console.error("Error computing commitment:", error.message);
}

3. Parallel Batch Processing

For maximum performance, use the batch methods. All inputs will be processed concurrently using Rust's Rayon library.

const blobs = [
    new Uint8Array(131072).fill(1),
    new Uint8Array(131072).fill(2),
    // ... many more blobs
];

// Computes commitments for all blobs in parallel
const commitments = kzgInstance.blobToCommitmentBatch(blobs);
console.log(`Computed ${commitments.length} commitments in parallel.`);

// Computes cell proofs for all blobs in parallel (EIP-7594)
// Returns Array<Array<string>>
const allProofs = kzgInstance.computeCellProofsBatch(blobs);
console.log(`Computed ${allProofs.length} sets of proofs in parallel.`);