blobkit
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published
░▒▓███████▓▒░░▒▓█▓▒░      ░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓████████▓▒░ 
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░  ░▒▓█▓▒░     
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░  ░▒▓█▓▒░     
░▒▓███████▓▒░░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓███████▓▒░░▒▓█▓▒░  ░▒▓█▓▒░     
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░  ░▒▓█▓▒░     
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░     ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░  ░▒▓█▓▒░     
░▒▓███████▓▒░░▒▓████████▓▒░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░  ░▒▓█▓▒░     
                                                                                     

BlobKit

TypeScript SDK for Ethereum blob transactions (EIP-4844).

Blob space is useful for temporary data storage with cryptographic guarantees. Think ephemeral messaging, gaming state, proof-of-existence, or any data that doesn't need permanent on-chain storage but benefits from Ethereum's security and availability.

Installation

npm install blobkit

Setup

Create a .env file in your project root:

# Required
RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_API_KEY
PRIVATE_KEY=0x...

# Optional
CHAIN_ID=1
ARCHIVE_URL=https://your-blob-archive.com

⚠️ Security Note: Never commit your .env file or private keys to version control. Add .env to your .gitignore.

Usage

import { createFromEnv, initializeForDevelopment } from 'blobkit';
import dotenv from 'dotenv';

dotenv.config();

// Initialize KZG setup (required)
await initializeForDevelopment();

// Create client from environment variables
const blobkit = createFromEnv();

// Write blob
const receipt = await blobkit.writeBlob({
  message: 'Hello blob space',
  timestamp: Date.now()
});

// Read blob
const data = await blobkit.readBlob(receipt.blobHash);

// Verify blob
const isValid = await blobkit.verifyBlob(data, receipt.blobHash);

KZG Setup

For production, use the official Ethereum KZG ceremony parameters:

import { initializeForProduction } from 'blobkit';

// Download from: https://github.com/ethereum/kzg-ceremony-sequencer
await initializeForProduction(
  '/path/to/g1.point',
  '/path/to/g2.point',
  'text'
);

Development only:

await initializeForDevelopment(); // Uses mock setup - DO NOT use in production

Alternative Usage Patterns

import { BlobKit, createReadOnlyFromEnv } from 'blobkit';

// Read-only client (no private key needed)
const readOnlyClient = createReadOnlyFromEnv();

// Manual configuration (when not using .env)
const blobkit = new BlobKit({
  rpcUrl: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
  chainId: 1,
  archiveUrl: 'https://your-archive.com'
}, 'your-private-key');

// With ethers.js wallet
import { Wallet } from 'ethers';
const wallet = new Wallet(process.env.PRIVATE_KEY!);
const blobkitWithWallet = new BlobKit({ 
  rpcUrl: process.env.RPC_URL!, 
  chainId: 1 
}, wallet.privateKey);

Project Structure

  • kzg/ - KZG commitment implementation and trusted setup
  • blob/ - Blob encoding/decoding utilities
  • writer/ - Transaction construction and submission
  • verifier/ - Blob verification and integrity checks
  • codecs/ - Data encoding (JSON, raw binary, extensible)
  • types/ - TypeScript type definitions

Contributing

npm test        # Run tests
npm run lint    # Lint code  
npm run build   # Build SDK

License

Apache 2.0

Package Sidebar

Install

npm i blobkit

Weekly Downloads

254

Version

0.3.0

License

Apache-2.0

Unpacked Size

122 kB

Total Files

79

Last publish

Collaborators

  • zscole