import { Storage } from "@foundryprotocol/0gkit-storage"; import { fromEnv } from "@foundryprotocol/0gkit-wallet"; const signer = await fromEnv(); const storage = new Storage({ network: "galileo", signer }); // Live upload — get a verifiable Merkle root + receipt. const { root, tx } = await storage.upload(bytes); // Or preview cost first — no broadcast, no signer required. const { estimate } = await storage.upload(bytes, { dryRun: true });
Everything you need to ship on 0G, and nothing you don't.
The 0G network ships five separate SDKs, each with its own shape, its own error style, and no shared concept of a receipt or a cost. 0Gkit unifies them — without hiding them.
One surface, every capability
Storage, compute, DA, attestation, and chain — all in one consistent TypeScript API. Stop juggling five different SDK shapes with five different error styles.
Neutral by design
MIT-licensed. Zero hidden coupling. Every primitive exposes `.raw()` back to the official 0G SDK. The toolkit is a help, never a cage.
Actionable errors
Every failure is a typed `ZeroGError` with `.code`, `.hint`, and `.helpUrl`. The error tells you exactly which env var is missing or which broker to call.
Agent-native from day one
MCP server, language-agnostic CLI with `--json`, and React hooks. Drive 0G from Claude, Cursor, the shell, the browser, or your Next.js app.
Cost preview on every write
Every primitive answers `.estimate()` and every write supports `{ dryRun: true }`. Know what an upload, inference, or DA publish will cost before you broadcast.
Production-ready primitives
Reorg-safe indexer, durable job runner (memory/sqlite/redis), OpenTelemetry observability, a TEE attestation gate, typed contract clients. Not just a wrapper — a stack.
Real code. Real primitives.
Every package is small, faithful, and self-contained. Install only what you use; everything else stays out of your bundle.
18 packages. Pick one, pick six, or scaffold an app.
The dependency direction is always one way: primitives depend on `core`; surfaces depend on the primitives. No cycles. No surprise transitive deps.
Layer — Foundation
Network presets, clients, receipts, errors. The shared base.Layer — Primitives
One thin, faithful wrapper per 0G capability. Drop any of them at any time.Layer — Developer surfaces
Same primitives, different mouths — CLI, MCP, React, indexer, jobs, observability.Layer — Scaffolder
Discover via Google. Install via npm. Templates land you in 60 seconds.Same network. Better developer ergonomics.
0Gkit doesn't hide the official 0G SDKs — every package re-exports them via `.raw()`. It just gives you the consistent surface you'd build yourself.
Stop wiring SDKs. Start shipping on 0G.
One command picks a template, writes a network-aware .env.example, installs deps, and runs git init. The next step is cd.