Last updated 2 months ago
Cardano data is usually serialized as CBOR. Storing Cardano in databases requires a mapping between CBOR and the relational model. This mapping is complex, expensive and usually suboptimal.
This is the total amount allocated to Mumak by TxPipe: A PostgreSQL custom extension to process raw Cardano CBOR. 4 out of 5 milestones are completed.
1/5
PostgreSQL extension
Cost: ₳ 37,500
Delivery: Month 1 - Apr 2024
2/5
Block dataset
Cost: ₳ 35,869
Delivery: Month 2 - May 2024
3/5
Transaction dataset
Cost: ₳ 35,869
Delivery: Month 3 - Jun 2024
4/5
Demeter Integration
Cost: ₳ 35,868
Delivery: Month 4 - Jul 2024
5/5
Completion Report
Cost: ₳ 25,608
Delivery: Month 5 - Aug 2024
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
A PostgreSQL extension that allows the database to understand CBOR Cardano structures so that queries can be performed directly without having to map all the details into a relational model.
No dependencies
We'll use Apache 2.0 License.
All artifacts will be open-source, including:
Executive Summary
Introduction
The de facto wire format used to exchange Cardano data is CBOR. By Cardano data we refer to Blocks, Transactions, UTxOs, Certificates and all of its inner structures.
When indexing this data onto a relational database, such as PostgresQL, we usually deserialize the CBOR structures and map the values to different columns & tables in our schema.
Some times having a normalized data model is exactly what your use-case needs, but there are multiple scenarios where this mapping just adds complexity and performance penalties.
Mumak is a PostgreSQL extension that provides several custom functions to interact with Cardano CBOR data directly on the database.
For example, this means that you could store a whole Cardano Tx as CBOR in a bytes PostgreSQL column and then use SQL to ask things such as:
The evaluation of these values will happen in-process, as part of the Db query execution.
Usage Example
Let say that we have a table where we store transactions in CBOR format. By doing this, we could connect to the PostgreSQL instance and run queries like these:
SELECT
tx_hash(tx_cbor, era),
tx_lovelace_output(tx_cbor, era)
FROM txs
WHERE
tx_has_address(tx_cbor, era, 'addr1xxx');
SELECT
tx_asset_mint(tx_cbor, era, '0x000000', 'myasset')
FROM txs
WHERE
tx_has_asset(tx_cbor, era, '0x000000', 'myasset')
SELECT
tx_metadata_label(tx_cbor, era, 721)
FROM txs
WHERE
tx_has_metadata_label(tx_cbor, era, 721)
Let's say that we now have a table where we store Cardano address as raw bytes. We could run the following queries:
SELECT
delegation_part(address)
WHERE
is_script_address(address)
SELECT
payment_part(address)
WHERE
delegation_part(address) = "0x000"
More information
If you're interested in learning more about the project, even outside the scope of the Catalyst proposal, please bookmark our git repository. We'll make sure to maintain the README updated with relevant information and news.
Simplify development of Cardano dApps
By providing a versatile tool that integrates directly with PostgreSQL, we simplify the process of interacting with Cardano on-chain data.
Improve performance of Cardano dApps
dApps that need to query & process vast volumes of data not well-suited for a normalized data model will find in this project a more efficient way to fulfill their needs.
Reduce maintenance costs of Cardano dApps
dApps that are wasting storage and compute resources maintaining a suboptimal data schema will be able to explore other, more efficient, data models using CBOR data directly.
TxPipe is an active member of the Cardano ecosystem
TxPipe has been developing open-source tools for the Cardano ecosystem for over 2 years and we're not going anywhere. Evidence of our commitment can be found by evaluating the continuous activity of our public code repositories.
Experience developing in the Cardano ecosystem
TxPipe has helped developed several dApps for the Cardano ecosystem. This experience allows us to evaluate the feasibility of the project and its potential benefit from a developer's perspective.
Succesful Catalyst proposals
We have successfully completed 2 prior Catalyst proposals. This may serve as evidence that our team has the required capabilities to fulfill these type of projects.
Development process will be public and open-source
Both the output and the development process will be public and open-source. This approach provides an easy way for the Catalyst team and the Cardano community to evaluate the progress at each step of the process.
PostgreSQL extension
This milestone is about developing the business logic of the custom PostgreSQL functions that are installed into the PostgreSQL instance, allowing developers to interact with raw Cardano CBOR.
Outputs:
Acceptance Criteria:
Block dataset
This milestone is about providing the means to create datasets that hold Cardano block data leveraging the query capabilities of the Mumak PostgreSQL extension.
Outputs:
Acceptance Criteria:
Transaction dataset
This milestone is about providing the means to create datasets that hold Cardano transaction data leveraging the query capabilities of the Mumak PostgreSQL extension.
Outputs:
Acceptance Criteria:
Demeter Integration
This milestone is about the integrating all Mumak datasets as part of the Demeter platform to provide a zero-configuration experience for developers that want to query the data without provisioning their own infrastructure.
Outputs:
Acceptance Criteria:
Completion Report
This milestone is about wrapping up the project and providing relevant insights for the Catalyst team and larger Cardano community to evaluate the result of the proposal.
Outputs:
Acceptance Criteria:
Assigned Team:
Additional Team Members
FTE = Full-time equivalent
Total budget = ₳ 170,714
Software Development
Infrastructure:
Project Management
The bulk of the budget falls under the software development category. TxPipe has extensive experience in the field, allowing it to provide good value for money. The hourly rates are defined using fair market prices. The estimation for the level of effort takes into account all of the optimizations that our team is capable of providing after years of experience developing software solutions in the Cardano ecosystem.