0Gkitdocs↗ HomePlaygroundGitHub

0gkit

0gkit is the neutral, MIT-licensed, defacto builder toolkit for the 0G network. It gives you small, composable TypeScript packages for every 0G surface — Storage, Compute (inference), Data Availability, TEE Attestation, and the native chain — plus a language-agnostic 0g CLI, an MCP server for AI agents, and React hooks.

It is not a framework. Every package is a thin, faithful wrapper that you can drop at any time: each one exposes an escape hatch back to the raw 0G SDK. The toolkit is a help, never a cage.

The neutrality principle

0gkit is deliberately vendor-neutral. No @foundryprotocol/0gkit-* package imports @foundryprotocol/* (the Foundry product) or any non-@0gkit workspace package. This is enforced in CI by pnpm boundary:check (dependency-cruiser). Foundry-specific functionality ships as a separate, opt-in plugin that is absent by default — you turn it on explicitly (ZEROG_FOUNDRY=1) and it is loaded through a computed specifier so the neutrality boundary stays green by construction.

What this means for you: 0gkit has zero hidden coupling. It is just 0G, viem, and (optionally) the official 0G SDKs.

The package map

PackageWhat it gives you
@foundryprotocol/0gkit-coreNetwork presets, a viem client factory, the Receipt envelope, the ZeroGError taxonomy.
@foundryprotocol/0gkit-chainExplorer URLs, native balance, waitForReceipt, the testnet faucet.
@foundryprotocol/0gkit-storageStorage: upload / download / computeRoot / exists.
@foundryprotocol/0gkit-computeCompute: provider discovery, broker inference, an OpenAI-compatible shim.
@foundryprotocol/0gkit-daDA: deterministic digest, encoder publish, local integrity verify.
@foundryprotocol/0gkit-attestationParse / sign / recover / verify / report a TEE attestation envelope (pure crypto).
@foundryprotocol/0gkit-cliThe 0g command line: init, doctor, chain, storage, infer, da, attest.
@foundryprotocol/0gkit-mcpEvery primitive as an MCP og_* tool for Claude / Cursor / Cline / any agent runtime.
@foundryprotocol/0gkit-reactuseUpload / useDownload / useInference / useAttestation.

The dependency direction is always one way: chain, storage, compute, da, and attestation build on core; the cli, mcp, and react packages build on the primitives. core depends on nothing but viem.

When to reach for 0gkit vs the raw 0G SDKs

Reach for 0gkit when you want:

  • One consistent surface across every 0G capability instead of five different SDK shapes.
  • Actionable errors. Every failure is a ZeroGError with a .code and a .hint that tells you the exact remedy (missing env var, run 0g doctor, which attestation check failed). No silent failures, ever.
  • A uniform Receipt for everything that touches the chain (tx hash, block, latency, explorer link).
  • A language-agnostic surface — the 0g CLI with --json lets any stack (Python, Go, shell) drive 0G.
  • Agent-native access — the MCP server exposes every primitive to an LLM with no glue code.

Reach for the raw 0G SDK when:

  • You need an SDK feature 0gkit does not wrap yet. Every package has an escape hatch — Storage#raw(), Compute#raw(), or just use the underlying viem client from createClient — so you are never blocked.

Next steps

  • Getting started — install and a 60-second end-to-end example.
  • Cookbook — end-to-end tutorials: build a chat app, a TEE-attested AI agent, an NFT minter backed by 0G Storage.
  • ConceptsReceipt, the ZeroGError taxonomy, networks, the client factory, the escape hatch.
  • Packages — one detailed page per package with full API reference and runnable examples.
  • CLI reference · MCP guide · React guide