The Database That Lives On-Chain
The Collective Intelligence Database
A pay-for-access database where apps collaborate, earn together, and grow the pie instead of fighting over slices. Store data on Celestia, monetize every query, and join data across apps—no backend servers required.

# Install OnChainDB SDK
$ npm install @onchaindb/sdkimport { createClient } from '@onchaindb/sdk';
// Initialize client
const client = createClient({
endpoint: 'https://api.onchaindb.io',
appKey: 'your-app-key',
appId: 'your-app-id'
});
// Create index for fast queries
const db = client.database('your-app-id');
await db.createIndex({
name: 'idx_todos_owner',
collection: 'todos',
field_name: 'owner',
index_type: 'hash'
});
// Store data with x402 payment
const result = await client.store(
{ collection: 'todos', data: [{ title: 'Buy groceries', owner: 'celestia1...' }] },
paymentCallback
);
// Query - Method (simple)
const todos = await client.query({ collection: 'todos', limit: 10 });
// Query - Helper (advanced)
const filtered = await client.queryBuilder()
.collection('todos').whereField('owner').equals('celestia1...').execute();Why OnChainDB?
Build apps that earn revenue from day one
Earn From Every Query
Monetize your data with every read and write. Set custom prices per collection and start earning from day one.
No Backend Required
Skip the servers, databases, and DevOps. Just write your frontend, connect to OnChainDB, and deploy to Amplify or Netlify.
Cross-App Data Joins
Query and join data across multiple apps in a single request. Revenue splits automatically between all data providers.
Built on Celestia
Your data lives permanently on Celestia's Data Availability layer. Cryptographic verification, no central servers.
HTTP 402 Payments
Industry-standard payment protocol handles micropayments automatically. No payment processor negotiations required.
Materialized Views
Pre-computed query results for fast reads. Create custom views with aggregations, joins, and filters—price them separately.

How It Works
Build, deploy, and earn in three simple steps
Build Your App
Use the OnChainDB SDK with familiar CRUD operations. No smart contracts, no gas optimization—just write code like you normally would.
Set Your Prices
Configure pricing for reads and writes on your collections. Every query generates revenue that flows directly to your wallet.
Deploy & Earn
Deploy to Amplify or Netlify. Your data lives on Celestia, payments are automatic via HTTP 402, and revenue flows directly to your wallet.
See It In Action
Web3 power meets Web2 simplicity. Ship production apps in hours, not months.
Finally, blockchain development as easy as traditional web development.
Todo App
A task management application demonstrating CRUD operations with on-chain data persistence
E-Commerce Store
Full-featured online store with PriceIndex revenue sharing and blockchain-based order tracking
Social Platform
Decentralized social network showcasing real-time updates and transparent user interactions

Ready to Build with OnChainDB?
Join developers building the future of decentralized data storage