Last updated a month ago
Interacting with the Cardano node is extremely hard. It uses a custom binary protocol. Specs are incomplete. Only Haskell is supported out-of-the-box. Only way to connect is via unix sockets.
This is the total amount allocated to gRPC ❤️ Cardano: A streaming API for Cardano using Dolos by TxPipe. 4 out of 5 milestones are completed.
1/5
Implement remaining UTxO RPC endpoints
Cost: ₳ 37,498
Delivery: Month 1 - Apr 2024
2/5
Client SDKs
Cost: ₳ 37,673
Delivery: Month 2 - May 2024
3/5
Demeter Integration
Cost: ₳ 37,673
Delivery: Month 3 - Jun 2024
4/5
Integration with Ecosystem Libraries
Cost: ₳ 37,674
Delivery: Month 4 - Jul 2024
5/5
Final Report
Cost: ₳ 26,564
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 streaming, real-time API that uses gRPC + protobuf to provide a performant and developer friendly way to interact with the Cardano blockchain.
No dependencies
We'll use Apache 2.0 License.
The following artifacts will be open-source:
Executive Summary
Introduction
Connecting to the Cardano node is extremely hard due to a set of design choices. Most of the other blockchains ecosystems have a much more streamlined experience. This is an important barrier for developer adoption and a performance penalty for existing Cardano projects.
gRPC is an open-source project that originated at Google. It is used extensibly across the industry. It's slowly becoming the defacto protocol for backend APIs due to it's performance and extensive toolchain.
Dolos is a Cardano "data-node" developed by TxPipe that has a different set of design-choices that make it suitable for providing a gRPC API. In fact, it already provides gRPC API with limited functionality.
By extending Dolos' functionality to other type of gRPC interactions, we can provide an efficient and developer-friendly alternative to existing integration mechanisms.
Why gRPC instead of Ouroboros mini-protocols
Ouroboros mini-protocols is a custom binary protocol which isn't well documented (there're gaps in the spec). Connecting through this protocol requires building custom client libraries in each of programming language. This is a huge effort and prone to errors. On top of that, the restriction of having to connect through unix socket is a blocker for many use-cases.
gRPC uses a binary encoding called "protobuf" which has similar (or better under specific scenarios) performance and efficiency as CBOR, both in terms of space optimization and encoding/decoding speed.
gRPC uses a strict schema, both client and server needs to know in advance the structure of the messages that will be exchanged. What may seem like a burden, is actually a very powerful mechanism to ensure forward and backward compatibility between servers and clients.
gRPC has an extensive toolchain that provides automatic code generation for all of the main stream programming languages (Python, C++, Golang, NodeJS, Javascript, Rust, etc). By using the protocol schema, client and server libraries can be created for any of the supported languages with a strict guarantee of compatibility between them.
Why gRPC instead of traditional HTTP/JSON APIs
gRPC uses HTTP/2, a version of the HTTP protocol that support multi-plexing. This means that many client-server interactions can be bundled into the same HTTP connection, greatly improving the latency and throughput of the communication.
gRPC uses "protobuf", a much more compact binary encoding that provides between 2x - 10x reduction in payload size compared to JSON.
gRPC has streaming support. Both client-side, server-side or bidirectional streaming. Streaming provides an efficient mechanism to implement event-driven scenarios, where one party needs to wait for the other to notify about new events.
gRPC also provides an out-of-the-box bridge to websockets, allowing javascript clients to connect directly from the browser.
Why a streaming API
The blockchain is a live sequence of events (new blocks, new transactions, rollbacks). dApps need to constantly monitor these events to create a consistent view of the state and make apply corresponding changes.
Most popular APIs in Cardano rely on request / reply semantics where each request responds with a fixed view of the state of the chain (eg: give me the utxos of this address). Monitoring changes requires continuous polling of the data just in case anything has changed. This is extremely inefficient.
Streaming is a mechanism where two parties (eg: client / server) exchange a sequence messages efficiently without relying on poling. In our case, a single gRPC connection is used where the server will push a new event (message) every time a relevant change is detected.
For example, just to mention a few, a dApp can connect to our API and ask for notifications every time a change is detected on a particular Cardano address, or get a notifications when a transaction has reached the chain, or when a particular asset has moved between addresses.
About UTxO RPC
UTxO RPC is a spec built on top of gRPC, specifically designed to interact with blockchains that use the UTxO model. It provides well-defined methods for the different type of common interactions that are required (eg: chain sync, state queries, transaction submission, etc).
Having a spec which is implementation-agnostic promotes interoperability. It allows different teams and tool providers to build their own concrete, independent implementations of clients and servers while maintaining compatibility among each other.
This proposal will use UTxO RPC as the interface for the gRPC endpoints. There're other teams / projects in the Cardano ecosystem which are planning on using the same spec. This will foster interoperability.
Simplified development of Cardano dApps
A modern, performant and developer friendly API that provides streaming semantics will simplify development of many Cardano dApps and potentially improve the performance in specific scenarios.
Attract developers from other ecosystem
By introducing gRPC, a well-known industry standard, as a mechanism to interact with the Cardano blockchain, we're lowering the entry barrier to many developers that are already familiar with these technology.
Provide better UX for end-users in certain interactions
Using streaming semantics provides a way for dApps to implement user experiences that are more reactive and responsive that their counterparts using poling mechanisms.
Boost performance and facilitate scalability:
The introduction of gRPC provides the reliability and speed of a modern protocols, enhancing overall network responsiveness. This enables dApps to handle higher transaction volumes and user traffic with greater efficiency and lower costs.
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.
TxPipe is one of the entities behind the UTxO RPC spec
TxPipe provided the initial design and has continued supporting the development of the UTxO RPC spec. We have a deep understanding of the protocol and we're very well suited to build a full server-side implementation.
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.
Implement remaining UTxO RPC endpoints
Dolos already provides some of the gRPC endpoints, but not all of them. This milestone is about implementing the server side business logic for the remaining required endpoints.
Tasks:
Outputs:
Acceptance Criteria:
Client SDKs
This milestone is about providing client libraries in many of the mainstream programming languages to facilitate access to the gRPC endpoints from consumer applications.
Tasks:
Outputs:
Acceptance Criteria:
Demeter Integration
This milestone is about the integration Dolos as part of the Demeter platform to provide a zero-configuration experience for developers that want to access the API without provisioning their own infrastructure.
Tasks:
Outputs:
Acceptance Criteria:
Integration with Ecosystem Libraries
This milestone is about providing a streamlined development experience to developer that already use one of the well-known frameworks for interacting with the Cardano blockchain.
Tasks:
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:
FTE = Full-time equivalent
Total budget = ₳ 177,082
Software Development:
Cloud Infrastructure:
Project Management:
The bulk of the budget falls under the software development categories. 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.