SmartDB: query Cardano eUTXO state like a database
Cardano's extended UTXO (eUTXO) model gives the chain its determinism and parallelism, but it makes application state awkward to read. A dApp's balances, orders, or NFT listings are scattered across many unspent outputs rather than sitting in a queryable account record, so teams end up writing their own indexing and aggregation code before they can build features.
Under a Project Catalyst grant in the Cardano Open Developers category (Fund 11), Protofire built SmartDB, an open-source library that mirrors on-chain eUTXO data into a relational database and exposes it through familiar queries. It maps outputs to records and datums to table columns, distinguishes UTXOs being read from those being consumed to reduce transaction collisions, and serves reads from the mirror to cut repeated calls to indexing services. Protofire also shipped a scaffold and code generator and a reference dApp so teams can start from a working example.
“Teams wrote repeated calls to indexing services, built manual aggregation logic, and kept custom code in sync with the chain.”
Why building on Cardano's eUTXO model is hard to query
Cardano uses an extended UTXO ledger. State lives in unspent transaction outputs and their attached datums rather than in mutable account balances, which is what gives the chain deterministic fees and parallel transaction validation. The trade-off falls on application developers.
To show something as basic as a user's balance or a set of open positions, a dApp has to collect and interpret many separate outputs, because there is no single account row to read.
In practice teams solved this each on their own. They wrote repeated calls to indexing services such as Blockfrost, built manual aggregation logic, and kept custom code in sync with the chain. That work sat between them and the product, and concurrent spends of the same output could collide, so two users acting at once could produce failed transactions. The pattern repeated across DeFi and NFT projects in the Cardano ecosystem, which is the gap the Catalyst grant set out to close.
How Protofire built the SmartDB abstraction layer
Protofire built SmartDB as a middleware library that keeps a relational mirror of on-chain state. It maps outputs to records and datums to table columns, so a developer can read and filter application state with ordinary database queries instead of reconstructing it from raw outputs each time.
The library supports both MongoDB and PostgreSQL backends and stays in sync with the chain through indexing services after each confirmed transaction.
Two design choices address the specific eUTXO pain points. Its UTXO management distinguishes outputs being read from those being consumed and applies a selection algorithm that minimizes conflicts when several users transact at once. A caching layer serves repeated reads from the mirror rather than re-querying the chain, cutting redundant indexing calls.
Around the core library, Protofire published a scaffold and code generator that produce the schema and boilerplate for a new project, plus a reference marketplace dApp that exercises the library end to end with token and NFT flows.
What Protofire delivered
The work is open source under the Protofire GitHub organization. The core library is Cardano-SmartDB, with the Cardano-SmartDB-Scaffold code generator and the Cardano-Simple-Marketplace reference marketplace dApp built on top of it.
The grant itself is public on Project Catalyst. Together they give a Cardano team a working pattern for querying application state without writing indexing and aggregation from scratch.