░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░▒▓████████▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓███████▓▒░░▒▓███████▓▒░░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░
░▒▓███████▓▒░░▒▓████████▓▒░▒▓██████▓▒░░▒▓███████▓▒░░▒▓█▓▒░░▒▓█▓▒░▒▓█▓▒░ ░▒▓█▓▒░
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.
npm install blobkit
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
.env
file or private keys to version control. Add .env
to your .gitignore
.
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);
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
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);
-
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
npm test # Run tests
npm run lint # Lint code
npm run build # Build SDK
Apache 2.0