CelesDb Overview
CelesDb is a custom-built database designed to optimize the storage and retrieval of blockchain state data for the Celestium network. Unlike traditional key-value databases commonly used in blockchain clients, CelesDb is specifically tailored to meet the demands of high-throughput parallel execution and asynchronous state management.
Motivation for CelesDb
Most Ethereum clients rely on general-purpose key-value stores like LevelDB, RocksDB, or LMDB, which internally use data structures such as B-Trees or LSM-Trees. However, Ethereum itself represents state using a Merkle Patricia Trie (MPT). This results in a mismatch between the underlying storage structure and the logical state representation, causing performance inefficiencies.
CelesDb addresses this by natively implementing the Patricia Trie structure for both in-memory and on-disk storage. This direct mapping eliminates the overhead of embedding one data structure within another, significantly improving read and write performance.
Key Features of CelesDb
Feature
Description
Native Patricia Trie Implementation
CelesDb stores blockchain state directly as a Patricia Trie on disk and in memory, optimizing access times.
Asynchronous I/O (async I/O)
Supports non-blocking database operations using modern system calls (e.g., io_uring on Linux).
Parallel State Access
Designed to support parallel transaction execution, allowing concurrent reads and writes.
Low-latency Performance
Bypasses filesystem caching in certain cases for direct I/O access, reducing overhead.
Optimized for High Throughput
Supports batch writes and parallel state reads to match the demands of Celestium’s parallel execution model.
Asynchronous I/O (async I/O)
A critical feature of CelesDb is its support for asynchronous I/O operations. Since Celestium executes multiple transactions in parallel, traditional blocking I/O would cause performance bottlenecks. Instead, CelesDb uses Linux’s io_uring interface to enable non-blocking, kernel-level asynchronous I/O operations. This allows:
Multiple I/O requests to be initiated simultaneously.
CPU resources to be used for other tasks while waiting for disk operations to complete.
Reduced context switching compared to traditional thread-based blocking I/O.
How CelesDb Supports Parallel Execution
Parallel transaction execution requires efficient concurrent access to state. CelesDb is designed to support:
Concurrent Reads: Multiple transactions can read state simultaneously without blocking each other.
Optimistic Writes: Transactions write to isolated state buffers during execution, reducing conflicts.
State Merging: After transactions execute, CelesDb merges state changes in block order to ensure deterministic final state.
Low-level Optimizations
Optimization
Description
Direct I/O Access
Avoids OS-level filesystem caching in certain cases to reduce overhead.
Batch Writes
Bundles multiple state changes into a single write operation for efficiency.
Memory-efficient Trie Nodes
Stores Patricia Trie nodes in compact formats, minimizing memory and disk usage.
Benefits of CelesDb
Faster Block Processing: Reduces state access latency during parallel and optimistic execution.
Improved Scalability: Handles high transaction throughput by supporting parallel state access.
Lower Resource Usage: Efficient memory and disk management tailored for blockchain workloads.
Comparison with Traditional Solutions
Aspect
CelesDb
LevelDB / RocksDB
Data Structure
Native Patricia Trie
LSM-Tree / B-Tree
Async I/O Support
Full support via io_uring
Limited / None
Parallel Access
Built-in support for parallel reads/writes
Designed for sequential access
Blockchain State Efficiency
Optimized for Patricia Trie-based state storage
General-purpose storage
Future Development
CelesDb will continue to be improved with:
Further optimizations for Patricia Trie compaction.
Caching strategies to reduce disk access for frequently read state.
Cross-platform async I/O support beyond Linux (e.g., Windows IOCP).
Final Thoughts
CelesDb is a cornerstone innovation of the Celestium blockchain, enabling high-performance state management that aligns with parallel and asynchronous execution models. This custom database ensures that Celestium can achieve scalability and efficiency without compromising on Ethereum-compatible state guarantees.
Last updated