Storage

Decentralized data storage for AI-scale apps.

Fast, decentralized storage for AI workloads. A Log layer for append-only archives, a Key-Value layer for live state, 200 MBPS retrieval, and up to 95% less cost than AWS.

Try it without code

§ 01 · Quickstart

Recommended

Start from the Storage Web Starter Kit

A ready-to-run TypeScript + browser template with wallet connection, file uploads, and downloads already wired up. Easiest way to understand the full flow end to end.

Clone starter kit
Prefer a different language? Also available as Node TypeScript or Go.

Or follow the 6 steps below to wire it up yourself.

01

Install the SDK

bash
npm install @0gfoundation/0g-storage-ts-sdk ethers
02

Get testnet tokens

text
# claim testnet tokens at faucet.0g.ai
# send them to the wallet you plan to use for uploads
03

Initialize the signer and indexer

ts
import { Indexer } from '@0gfoundation/0g-storage-ts-sdk'
import { ethers } from 'ethers'
const RPC_URL = 'https://evmrpc-testnet.0g.ai'
const INDEXER_RPC = 'https://indexer-storage-testnet-turbo.0g.ai'
const provider = new ethers.JsonRpcProvider(RPC_URL)
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider)
const indexer = new Indexer(INDEXER_RPC)
04

Upload a file

ts
import { MemData } from '@0gfoundation/0g-storage-ts-sdk'
// In-memory payload. For a file on disk, use ZgFile instead.
const file = new MemData(new TextEncoder().encode('hello 0G'))
const [rootHash, uploadErr] = await indexer.upload(file, RPC_URL, signer)
if (uploadErr) throw uploadErr
console.log('root hash:', rootHash)
05

Retrieve it

ts
// Download back to disk at ./hello.txt, verifying the Merkle proof.
const err = await indexer.download(rootHash, './hello.txt', true)
if (err) throw err
06

Verify on Storage Scan

text
# open https://storagescan.0g.ai and search for the root hash
# confirm the file is pinned and replicated across nodes

§ 02 · Storage SDKs

§ 03 · Deep dive

§ 04 · Tutorials

§ 05 · Built with Storage

View showcase →