BUILT ON CELESTIA

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.

Stacky reading code
onchaindb-cli
# Install OnChainDB SDK
$ npm install @onchaindb/sdk
import { 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.

Stacky with coffee

How It Works

Build, deploy, and earn in three simple steps

1

Build Your App

Use the OnChainDB SDK with familiar CRUD operations. No smart contracts, no gas optimization—just write code like you normally would.

2

Set Your Prices

Configure pricing for reads and writes on your collections. Every query generates revenue that flows directly to your wallet.

3

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.

Stacky sleeping

Ready to Build with OnChainDB?

Join developers building the future of decentralized data storage