Skip to main content

OnchainDB

A collective intelligence database with built-in data monetization. Available in TypeScript, Go, PHP, and Python.

Data Availability (DA) Layer

The underlying storage layer providing verifiable data persistence. OnchainDB stores all data with cryptographic verification.

Collection

A logical grouping of documents, similar to a table in traditional databases.

Document

A JSON record stored in a collection on the blockchain.

App Key (X-App-Key)

API key for application-level operations, required for write operations. Sent via X-App-Key header.

User Key (X-User-Key)

API key for user-level operations, enables Auto-Pay when user has granted authz. Sent via X-User-Key header.

Auto-Pay

Automatic payment flow when userKey is provided and user has granted authz to the broker. No payment callback needed.

x402 Payment Flow

Payment callback pattern where store() receives a callback function that’s invoked when server returns HTTP 402, allowing the client to handle payment.

Index (Required)

Data structure that enables efficient query performance. REQUIRED for production use - every collection MUST have at least one index. Without indexes, queries perform slow full collection scans and collections are not visible in the OnchainDB dashboard. Supports hash (for equality lookups) and btree (for range queries) index types with optional unique constraints. Always create indexes BEFORE storing data.

Namespace

Logical grouping mechanism in the DA layer that isolates data for different collections.

Payment Proof

Transaction verification required for write operations, containing tx hash, addresses, and payment amount.

Broker

Intermediary service that handles payment processing and revenue distribution for OnchainDB operations.

PriceIndex

Special index type that changes payment model from data-size-based to field-value-based, enabling revenue-sharing business models for applications built on OnchainDB. Perfect for building e-commerce platforms, ticketing systems, and marketplace applications.

Revenue Split

Automatic distribution of payments when using PriceIndex, configured server-side (typically 70% to app wallet and 30% to platform). Not user-configurable.

HTTP 402 Payment Required

Protocol for paid read operations where queries return a quote before data access, enabling pay-per-query monetization.

X402Quote

Standardized payment quote format (camelCase) used by QueryBuilder.execute() via PaymentRequiredError. Contains quoteId, totalCostTia, brokerAddress, network, chainType, and all payment options. Supports multi-chain payments (Cosmos, EVM, Solana).

PaymentRequiredError

SDK error thrown by QueryBuilder.execute() when a query requires payment. Contains an X402Quote object with all payment details. Catch this error to handle payment flows in applications.

Quote ID

Unique identifier for a payment quote that must be included when re-querying after payment.

Task Ticket

Unique identifier for async operations, used to track operation status and completion.

Blob Storage

Binary file storage capability for images, videos, documents up to 2MB with custom metadata.

Query Builder

Fluent API for constructing complex queries with logical operators and field conditions.

Batch Operations

Bulk data operations that process multiple records efficiently with progress tracking.

TIA

Native token used for data availability payments (measured in utia - micro TIA).

Data Availability (DA)

Guarantee that published data is available for download and verification on the blockchain.

LogicalOperator

SDK component for combining query conditions using And, Or, and Not operators.

DatabaseManager

SDK component for managing collections, indexes, relations, and materialized views within an application. Access via client.database(appId).

Materialized View

Pre-computed query result that updates automatically when source data changes. Created via db.createView(name, sourceCollections, query). Use for complex aggregations, JOINs, and dashboard analytics.

Append-Only Storage

Storage model where updates and deletes don’t modify existing data. Instead, new records are appended with updated timestamps. Original data remains immutable on the blockchain.

Soft Delete

Deletion method that appends a record with deleted: true rather than physically removing data. Original data remains on-chain for audit purposes.