# 0Gkit > The neutral, MIT-licensed TypeScript toolkit for the 0G network — Storage, Compute, DA, Attestation, Chain, a `0g` CLI, an MCP server, React hooks, and drop-in feature Kits. Every package is versioned independently on npm under the `@foundryprotocol/0gkit-*` scope, and every write returns a uniform `Receipt`; every failure is a typed `ZeroGError`. This file follows the [llms.txt](https://llmstxt.org) convention so AI agents can discover and read the docs. Every page below is also available as clean Markdown by visiting `https://docs.0gkit.com/llms/.md`. A single concatenated dump of all pages lives at [https://docs.0gkit.com/llms-full.txt](https://docs.0gkit.com/llms-full.txt). ## Overview - [0gkit — the neutral 0G builder toolkit](https://docs.0gkit.com/): **0gkit** is the neutral, MIT-licensed, defacto builder toolkit for the [0G network](https://0g.ai). It gives you small, composable TypeScript packages for every 0G surface — Stor… - [Getting started](https://docs.0gkit.com/getting-started): The fastest path from zero to a running 0G app — pick a template, get a runnable project with `.env.example`, `git init`, and dependencies installed. - [create-0g-app](https://docs.0gkit.com/getting-started/create-0g-app): `create-0g-app` was the original planned npm-create package, but that npm name is held by another publisher. Use the working public initializer instead: - [create-0gkit-app](https://docs.0gkit.com/getting-started/create-0gkit-app): The fastest way to start a 0G project — one command, a runnable app, no manual setup. Pairs with [`0g dev`](/cli) for zero-faucet local development. ## Concepts - [Concepts](https://docs.0gkit.com/concepts): Five ideas run through every 0gkit package. Learn them once and every package behaves predictably. - [Compute — router() vs direct()](https://docs.0gkit.com/concepts/compute-router-vs-direct): `@foundryprotocol/0gkit-compute` gives you two ways to run an inference, and the right default is **`router()`** — you name a model, not a provider address. - [Durable jobs](https://docs.0gkit.com/concepts/durable-jobs): `@foundryprotocol/0gkit-jobs` exists because the synchronous HTTP request/ response cycle is the wrong shape for most interesting 0G workflows. Inference that takes 90 seconds, a… - [MCP — make 0gkit native to your AI tool](https://docs.0gkit.com/concepts/mcp): `@foundryprotocol/0gkit-mcp` is the neutral 0G [Model Context Protocol](https://modelcontextprotocol.io) server: every 0G primitive — Storage, Compute (inference), Data Availabili… - [Observability — OTel + cost attribution](https://docs.0gkit.com/concepts/observability): Every production app eventually needs to answer three questions: - [Datadog — instrument0g wire-up](https://docs.0gkit.com/concepts/observability/exporters/datadog): Datadog accepts OTLP traces through the Datadog Agent (recommended) or through the OTLP-native intake. Both work — the agent route is the most common because it gives you per-host… - [Honeycomb — instrument0g wire-up](https://docs.0gkit.com/concepts/observability/exporters/honeycomb): Honeycomb's OTLP endpoint accepts traces over HTTP with a single auth header. Sign up at [honeycomb.io](https://www.honeycomb.io), create an environment, and grab the API key — th… - [Vercel OTel — instrument0g wire-up](https://docs.0gkit.com/concepts/observability/exporters/vercel): Vercel ships an OpenTelemetry collector on every function deployment. If your app is Next.js on Vercel, your function spans already flow into the platform Observability tab; with… ## Packages - [Packages](https://docs.0gkit.com/packages): 0gkit is eleven independently published packages under the `@foundryprotocol/0gkit-*` scope (version `0.1.0`). Each page below documents the **real** exported API, derived from so… - [0gkit-contracts](https://docs.0gkit.com/packages/0gkit-contracts): Typed contract clients + Foundry codegen for 0G chain contracts. - [0gkit-devnet](https://docs.0gkit.com/packages/0gkit-devnet): Local 0G devnet harness used by `0g dev`. - [0gkit-indexer](https://docs.0gkit.com/packages/0gkit-indexer): Reorg-safe polling indexer for chain events with persistable cursors. - [@foundryprotocol/0gkit-kits](https://docs.0gkit.com/packages/0gkit-kits): The kits engine: a neutral, dependency-light core that resolves, composes, and - [@foundryprotocol/0gkit-observability](https://docs.0gkit.com/packages/0gkit-observability): OpenTelemetry instrumentation for 0gkit primitives. One call wires every - [0gkit-testing](https://docs.0gkit.com/packages/0gkit-testing): Mocks, fixtures, vitest matchers, and `setupLocalDevnet` for testing on 0G. - [@foundryprotocol/0gkit-attestation](https://docs.0gkit.com/packages/attestation): Neutral 0G TEE attestation: parse, sign (EIP-191), recover, verify, and - [@foundryprotocol/0gkit-chain](https://docs.0gkit.com/packages/chain): Neutral 0G native-chain helpers: explorer URLs, native balance, - [@foundryprotocol/0gkit-cli](https://docs.0gkit.com/packages/cli): The neutral `0g` command line — `init`, `doctor`, `chain`, `storage`, - [@foundryprotocol/0gkit-compute](https://docs.0gkit.com/packages/compute): Neutral 0G Compute: model-first routing, explicit-provider inference, provider - [@foundryprotocol/0gkit-core](https://docs.0gkit.com/packages/core): The neutral 0G foundation: network presets, a viem client factory, the - [@foundryprotocol/0gkit-da](https://docs.0gkit.com/packages/da): Neutral 0G Data Availability: deterministic digest, encoder publish, and a - [@foundryprotocol/0gkit-jobs](https://docs.0gkit.com/packages/jobs): Durable async job runner for long-running 0G workflows (inference, agents, - [@foundryprotocol/0gkit-mcp](https://docs.0gkit.com/packages/mcp): The neutral 0G MCP server — every 0G primitive as an `og_*` MCP tool for - [@foundryprotocol/0gkit-react](https://docs.0gkit.com/packages/react): Neutral React hooks for 0G: `useUpload`, `useDownload`, `useInference`, - [@foundryprotocol/0gkit-storage](https://docs.0gkit.com/packages/storage): Neutral 0G Storage client: `upload`, `download`, `computeRoot`, `exists`. - [@foundryprotocol/0gkit-wallet](https://docs.0gkit.com/packages/wallet): Node wallet loaders for 0G: `fromPrivateKey`, `fromFile`, `fromEnv`, - [@foundryprotocol/0gkit-wallet-react](https://docs.0gkit.com/packages/wallet-react): React + wagmi v2 wallet integration for 0G: `ZeroGWalletProvider`, ## Kits - [Kits](https://docs.0gkit.com/kits): Kits are **drop-in, composable, multi-framework feature overlays** for 0G apps. A kit injects a working feature — files, dependencies, and env var stubs — into any compatible temp… - [agent-memory kit](https://docs.0gkit.com/kits/agent-memory): **Persistent agent memory on 0G Storage — append-only JSONL blobs per - [ai-oracle kit](https://docs.0gkit.com/kits/ai-oracle): **Signed AI answers with commitments anchored to 0G Storage (default) or - [Build & publish a kit](https://docs.0gkit.com/kits/authoring): Kits are the **shared skills repo for 0G**. Anything you build once — an attested inference flow, a storage-backed cache, an indexer view — can be packaged as a kit and published… - [durable-agent kit](https://docs.0gkit.com/kits/durable-agent): **Resumable multi-step agent loop with per-step durability on 0G Storage.** - [inft-studio kit](https://docs.0gkit.com/kits/inft-studio): **Mint intelligent NFTs with AI-generated media stored on 0G Storage and - [live-feed kit](https://docs.0gkit.com/kits/live-feed): **Reorg-safe live social feed on 0G Storage + 0gkit-indexer.** Posts are - [prediction-market kit](https://docs.0gkit.com/kits/prediction-market): **AI-resolved, proof-anchored prediction market.** Lifecycle: open → bet → - [sealed-inference kit](https://docs.0gkit.com/kits/sealed-inference): **Signed AI inference with a verification badge driven by the real verify - [trade-signal kit](https://docs.0gkit.com/kits/trade-signal): ⚠ **Advisory only — not financial advice; no orders executed.** - [yield-intel kit](https://docs.0gkit.com/kits/yield-intel): ⚠ **Demo — not financial advice; no automated execution.** ## Cookbook - [Cookbook](https://docs.0gkit.com/cookbook): End-to-end tutorials. Pick an archetype, follow it from `npm create` to a running app, then graduate to production hardening. Every tutorial uses only the published `@foundryproto… - [Cookbook · AI agent](https://docs.0gkit.com/cookbook/ai-agent): A multi-step ReAct agent where every inference call is paid through **0G Compute**, gated on a TEE attestation, and orchestrated as a durable job. The loop survives worker restart… - [Cookbook · Chat app](https://docs.0gkit.com/cookbook/chat-app): A real-time chat where every message is persisted to **0G Storage** and the on-chain `MessagePosted` event log is the source of truth. By the end you'll have a Next.js app that le… - [Cookbook · NFT minter](https://docs.0gkit.com/cookbook/nft-minter): Mint an ERC-721 token whose **metadata JSON** and **media file** both live on **0G Storage** rather than IPFS or AWS S3. `tokenURI(id)` returns `0g-storage://` where `… ## Guides - [CLI reference](https://docs.0gkit.com/cli): The `0g` command line (`@foundryprotocol/0gkit-cli`) is the universal, language-agnostic surface for 0G. Every command mirrors a primitive package; `--json` makes it scriptable fr… - [Contributing](https://docs.0gkit.com/contributing): Thanks for helping build the neutral 0G toolkit. The canonical source for this guide lives at [CONTRIBUTING.md](https://github.com/rajkaria/0gkit/blob/main/CONTRIBUTING.md) in the… - [MCP guide](https://docs.0gkit.com/mcp): `@foundryprotocol/0gkit-mcp` is the neutral 0G [Model Context Protocol](https://modelcontextprotocol.io) server. It exposes every 0G primitive as an `og_*` tool so Claude Desktop,… - [Migrating from the official 0G SDKs](https://docs.0gkit.com/migrate-from-official-sdks): If you are already using `@0gfoundation/0g-storage-ts-sdk`, `@0gfoundation/0g-compute-ts-sdk`, or rolling your own DA HTTP client, **0gkit is a drop-in replacement** that gives yo… - [React guide](https://docs.0gkit.com/react): `@foundryprotocol/0gkit-react` is four thin reactive hooks over the 0G primitives. `react` is a peer dependency. - [Templates](https://docs.0gkit.com/templates): 0gkit ships **nine** starter projects so you can go from zero to a running 0G app in one command. Each is a minimal, correct, copy-and-go example focused on one surface. - [Troubleshooting & FAQ](https://docs.0gkit.com/troubleshooting): Almost every "it doesn't work" has a one-line answer from the preflight: ## Error reference - [Error codes](https://docs.0gkit.com/errors): Every error 0gkit can throw, with cause + fix. - [ATTESTATION_BAD_PAYLOAD](https://docs.0gkit.com/errors/ATTESTATION_BAD_PAYLOAD): Attestation envelope malformed - [ATTESTATION_BAD_SIGNATURE](https://docs.0gkit.com/errors/ATTESTATION_BAD_SIGNATURE): Attestation signature did not recover - [ATTESTATION_EXPIRED](https://docs.0gkit.com/errors/ATTESTATION_EXPIRED): Attestation is too old - [CHAIN_INSUFFICIENT_FUNDS](https://docs.0gkit.com/errors/CHAIN_INSUFFICIENT_FUNDS): Account has insufficient funds - [CHAIN_NONCE_TOO_LOW](https://docs.0gkit.com/errors/CHAIN_NONCE_TOO_LOW): Nonce already used - [CHAIN_RPC_TIMEOUT](https://docs.0gkit.com/errors/CHAIN_RPC_TIMEOUT): RPC call timed out - [CHAIN_RPC_UNREACHABLE](https://docs.0gkit.com/errors/CHAIN_RPC_UNREACHABLE): RPC endpoint unreachable - [CHAIN_TX_REVERTED](https://docs.0gkit.com/errors/CHAIN_TX_REVERTED): Transaction reverted on-chain - [CHAIN_TX_TIMEOUT](https://docs.0gkit.com/errors/CHAIN_TX_TIMEOUT): Transaction did not confirm in time - [COMPUTE_BAD_ATTESTATION](https://docs.0gkit.com/errors/COMPUTE_BAD_ATTESTATION): TEE attestation verification failed - [COMPUTE_BUDGET_EXCEEDED](https://docs.0gkit.com/errors/COMPUTE_BUDGET_EXCEEDED): Inference cost exceeded budget - [COMPUTE_INFERENCE_FAILED](https://docs.0gkit.com/errors/COMPUTE_INFERENCE_FAILED): Inference call returned an error - [COMPUTE_NO_PROVIDER](https://docs.0gkit.com/errors/COMPUTE_NO_PROVIDER): No provider serving the requested model - [COMPUTE_PROVIDER_UNREACHABLE](https://docs.0gkit.com/errors/COMPUTE_PROVIDER_UNREACHABLE): 0G Compute provider unreachable - [CONFIG_INVALID_ADDRESS](https://docs.0gkit.com/errors/CONFIG_INVALID_ADDRESS): Not a valid 0x address - [CONFIG_INVALID_ARGUMENT](https://docs.0gkit.com/errors/CONFIG_INVALID_ARGUMENT): Invalid argument passed to a primitive - [CONFIG_INVALID_NETWORK](https://docs.0gkit.com/errors/CONFIG_INVALID_NETWORK): Unknown network name - [CONFIG_MISSING_ENV](https://docs.0gkit.com/errors/CONFIG_MISSING_ENV): Missing required environment variable - [CONTRACTS_ABI_MISMATCH](https://docs.0gkit.com/errors/CONTRACTS_ABI_MISMATCH): ABI doesn't match deployed contract - [CONTRACTS_CODEGEN_FAILED](https://docs.0gkit.com/errors/CONTRACTS_CODEGEN_FAILED): 0g contracts generate failed - [CONTRACTS_NO_ADDRESS](https://docs.0gkit.com/errors/CONTRACTS_NO_ADDRESS): Standard contract has no known address - [CONTRACTS_REVERTED](https://docs.0gkit.com/errors/CONTRACTS_REVERTED): Typed contract write reverted - [DA_INVALID_PAYLOAD](https://docs.0gkit.com/errors/DA_INVALID_PAYLOAD): DA payload empty or oversized - [DA_PUBLISH_FAILED](https://docs.0gkit.com/errors/DA_PUBLISH_FAILED): DA publish failed - [DA_VERIFY_FAILED](https://docs.0gkit.com/errors/DA_VERIFY_FAILED): DA proof verification failed - [INDEXER_CURSOR_BACKEND_UNREACHABLE](https://docs.0gkit.com/errors/INDEXER_CURSOR_BACKEND_UNREACHABLE): Cursor backend unreachable - [INDEXER_EVENT_DECODE_FAILED](https://docs.0gkit.com/errors/INDEXER_EVENT_DECODE_FAILED): Log topic doesn't match any ABI event - [INDEXER_REORG_LIMIT_EXCEEDED](https://docs.0gkit.com/errors/INDEXER_REORG_LIMIT_EXCEEDED): Reorg depth exceeded configured limit - [JOBS_BACKEND_UNREACHABLE](https://docs.0gkit.com/errors/JOBS_BACKEND_UNREACHABLE): Jobs backend unreachable - [JOBS_HANDLER_THREW](https://docs.0gkit.com/errors/JOBS_HANDLER_THREW): Job handler threw an exception - [JOBS_JOB_NOT_FOUND](https://docs.0gkit.com/errors/JOBS_JOB_NOT_FOUND): Job ID not found - [JOBS_WEBHOOK_BAD_SIGNATURE](https://docs.0gkit.com/errors/JOBS_WEBHOOK_BAD_SIGNATURE): Webhook HMAC signature invalid - [OBSERVABILITY_EXPORTER_FAILED](https://docs.0gkit.com/errors/OBSERVABILITY_EXPORTER_FAILED): OTel exporter rejected the export - [OBSERVABILITY_TRACE_DIR_NOT_SET](https://docs.0gkit.com/errors/OBSERVABILITY_TRACE_DIR_NOT_SET): No trace directory configured for 0g traces. - [OBSERVABILITY_TRACE_NOT_FOUND](https://docs.0gkit.com/errors/OBSERVABILITY_TRACE_NOT_FOUND): Trace id not found in the configured trace directory. - [OBSERVABILITY_TRACE_READ_FAILED](https://docs.0gkit.com/errors/OBSERVABILITY_TRACE_READ_FAILED): Trace JSONL file could not be parsed. - [STORAGE_DOWNLOAD_FAILED](https://docs.0gkit.com/errors/STORAGE_DOWNLOAD_FAILED): Download from 0G storage failed - [STORAGE_INVALID_BYTES](https://docs.0gkit.com/errors/STORAGE_INVALID_BYTES): Storage input bytes empty or invalid - [STORAGE_QUOTA_EXCEEDED](https://docs.0gkit.com/errors/STORAGE_QUOTA_EXCEEDED): Storage quota exceeded - [STORAGE_ROOT_MISMATCH](https://docs.0gkit.com/errors/STORAGE_ROOT_MISMATCH): Computed root doesn't match expected - [STORAGE_ROOT_NOT_FOUND](https://docs.0gkit.com/errors/STORAGE_ROOT_NOT_FOUND): Storage root not found on network - [STORAGE_UPLOAD_FAILED](https://docs.0gkit.com/errors/STORAGE_UPLOAD_FAILED): Upload to 0G storage failed - [WALLET_BAD_DER_SIGNATURE](https://docs.0gkit.com/errors/WALLET_BAD_DER_SIGNATURE): Malformed DER signature from KMS - [WALLET_CHAIN_MISMATCH](https://docs.0gkit.com/errors/WALLET_CHAIN_MISMATCH): Signer chainId doesn't match active chain - [WALLET_KMS_PUBKEY_FAILED](https://docs.0gkit.com/errors/WALLET_KMS_PUBKEY_FAILED): AWS KMS GetPublicKey failed - [WALLET_KMS_SIGN_FAILED](https://docs.0gkit.com/errors/WALLET_KMS_SIGN_FAILED): AWS KMS Sign returned no signature - [WALLET_NO_CONNECTOR](https://docs.0gkit.com/errors/WALLET_NO_CONNECTOR): No wagmi connector available - [WALLET_NO_PRIVATE_KEY](https://docs.0gkit.com/errors/WALLET_NO_PRIVATE_KEY): No private key derived from mnemonic