0Gkitv1.0.0
v1.0.0 shipped — 18 packages on npm, API stable until v2 →

Build on 0G in 60 seconds.

0Gkit is the neutral, MIT-licensed TypeScript toolkit for the entire 0G network. Storage, compute, DA, attestation, and chain — one consistent surface across 18 small, composable packages. No framework. No lock-in. Just 0G.

npm create 0gkit-app@latest

MIT licensed · TypeScript-first · Works with raw 0G SDKs (escape hatch on every primitive)

v1.0.0
API stable
Public surface frozen until v2
18
packages on npm
Install only what you use
600+
tests passing
CI gate on every PR
MIT
open source
No strings, no contracts
Why 0Gkit

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.

Hands on

Real code. Real primitives.

Every package is small, faithful, and self-contained. Install only what you use; everything else stays out of your bundle.

upload.tsStorage
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 });
Upload bytes to 0G Storage. One call, a content-addressed Merkle root back.
inference.tsCompute
import { Compute } from "@foundryprotocol/0gkit-compute";

const compute = new Compute({ network: "galileo", signer });

const { output, receipt } = await compute.inference({
  messages: [{ role: "user", content: "Summarise this thread..." }],
  model: "llama-3.3-70b",
  maxOutputTokens: 512,
});

// receipt: { provider, model, txHash, gas, blockNumber, ... }
Run inference against the 0G Compute broker network. Get a typed Receipt with the provider, model, and on-chain tx.
verify.tsAttestation
import { verifyEnvelope } from "@foundryprotocol/0gkit-attestation";

// `signed` came back from your TEE provider.
const ok = await verifyEnvelope(signed, expectedSigner);

if (!ok) {
  throw new ZeroGError({
    code: "ATTESTATION_VERIFY_FAILED",
    message: "TEE quote did not match expected signer",
    hint: "Confirm the provider key from the registry",
  });
}
Pure crypto. Verify a TEE attestation envelope offline — no broker, no chain hit, no surprises.
shellCLI
$ npm create 0gkit-app@latest my-app
$ cd my-app

# Spin up local devnet (storage CAS + chain)
$ 0g dev

# Preview costs offline — no key, no broadcast
$ 0g estimate storage ./video.mp4 --json

# Or upload for real
$ 0g storage put ./video.mp4

# Inference
$ 0g infer --model llama-3.3-70b "hello"
Drive every 0G primitive from the shell. `--json` everywhere — pipe into jq, Python, Go, anything.
The package map

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.
0Gkit vs raw 0G SDKs

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.

Concern
0Gkit
Raw 0G SDKs
Surface area
One consistent TS API across storage / compute / DA / attestation / chain
Five separate SDKs, five different shapes, five different conventions
Errors
Typed `ZeroGError` with `.code`, `.hint`, `.helpUrl`
Generic Error or string — no structured remediation
Receipts
Uniform `Receipt` envelope (txHash, block, latency, explorer URL)
Each primitive returns its own ad-hoc shape
Cost preview
`.estimate()` + `{ dryRun: true }` on every write
Roll your own gas + fee math, no encoder-level preview
CLI
`0g` binary with `--json` — pipe into anything
None — write your own each project
Agent access (MCP)
Every primitive as an `og_*` MCP tool out of the box
Not provided
React hooks
`useUpload` · `useInference` · `useEvent` · `useLogs`
Not provided
Indexing
Reorg-safe `Indexer` with persisted cursors (memory/sqlite/redis)
Roll your own polling + reorg detection
Background work
Durable `JobRunner` with HMAC webhooks and backoff
Roll your own queue + delivery semantics
Observability
OpenTelemetry instrumentation with `0g.*` semantic attributes
Not provided
Escape hatch
`.raw()` on every primitive — you are never blocked
N/A (you are already there)
License
MIT
MIT

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.

npm create 0gkit-app@latest
60-second tutorialBrowse 9 templates