The Heartbeat of Cardano.

Building a Ouroborus Networking Package for JavaScript Developers

Audio Reading brought to you by Kaizen Crypto

Haskell, the core programming language of the Cardano blockchain, is a perfect choice for building critical infrastructure in the modern financial system. As a functional programming language, it allows developers to produce reliable, robust, and high assurance code. However, despite serving as a basis for Cardano Plutus and Marlowe smart contracts, Haskell is still not among the most widely used languages in today’s world of software development. 

With both on-chain and off-chain code in the Cardano ecosystem implementing Haskell, most new developers feel constrained due to the lack of networking libraries in other languages. Ashish, a stakepool operator and one of the developers behind Cardanoscan, is looking to build Ouroboros Networking package in JavaScript, which will allow developers to interact with Cardano nodes by simply installing the NPM package. 

Ashish, who will lead a team of two other developers in building the JavaScript networking package, says his team has the relevant experience and skills to undertake this project. The team has already implemented part of the networking layer within the Cardanoscan custom backend system.

Overview of the Ouroboros Networking library

The Cardan node uses an implementation of Haskell-based mini-protocols to communicate with other nodes on the network. These protocols are low-level networking specs defined by IOHK. If you want to talk to the Cardano node directly without using a Cardano CLI, you can use a mini-protocol networking package. Ouroboros is one such networking library/package that eliminates dependency on the CLI, thus giving you more development flexibility to query Cardano blocks, fetch state, submit transactions to the node, or access on-chain data. 

The networking library consists of two components – the mini protocols and a data parser. The mini protocols help communicate with the node and provide CBOR encoded data from the Cardano chain. The data parser will then parse the data and convert it into a JSON object that can be used efficiently by developers.

Bringing a Host of Possibilities to the Cardano Ecosystem

The JavaScript-based Ouroboros networking library will enable developers to build projects of any size on Cardano. Case in point is the Cardanoscan, a leading Cardano blockchain explorer, which implements this networking library as one of its core components. A developer will only need to install the Ouroboros npm package and start building on Cardano with minimal configuration required. With this package, developers can quickly spin up tools such as Cardano metadata explorers, pool explorers, analytics dashboards, wallet backend, and bots. Building multi-asset dashboards and tracking pool updates or any other on-chain data will be a possibility, even for new developers.  

Other than the above capabilities, the library will also allow you to access raw CBOR data for debugging purposes. The aim of building this package is bringing Cardano to the larger developer community so we can see the ecosystem grow day by day. 

As it stands, the networking package only implements the features that were required by the Cardanoscan explorer – which was an internal project by the proposing team. With this proposal, the team is looking to build on their existing work and create a more mature, maintainable, and feature-rich networking library. The plan is to port out existing work and enhance it to include the following:

  • Chain-Sync protocol (limited implementation of the protocol is available)
  • Transaction Submit protocol
  • Block fetch protocol
  • Local State Query protocol
  • Ping-Pong protocol
  • Data Parser based on CDDL specifications
  • MUX implementation (to provide support for talking multiple mini-protocols concurrently)
  • Test suite and examples

The implementation of this open-source networking library will follow all specifications defined by IOHK to ensure it maintains the integrity of the Cardano protocol. Additionally, the team will also perform block hash validation as part of the test suites. From a development perspective, building the library’s features will take a functional approach but there will be easy-to-consume methods such as an API for end-users (developers). 

Project Budget and Timelines

The project will focus on building on the already available implementation of the protocol which has limited features. As mentioned, the package is still not advanced, so Ashish and the team will have to build a high-performance Nodejs package with all the deliverables listed above. A lot of manual testing and working with on-chain data will be required to ensure the package works efficiently and adheres to the protocol specifications defined by IOHK. 

According to the minds behind this project, it would take them three to four months to deliver the networking library – with two developers working on the project on a full-time basis. The team is therefore requesting a total funding of $ 80,000 to make the Ouroboros networking library project a reality. From this amount, $77,000 will be used as salary for two full-time developers over the development period. The team will also spend $ 2000 on cloud VM costs (testnet relay node, mainnet relay node, and testing/dev node). The remaining $ 1000 will cover other infrastructure and miscellaneous costs. 

Final Thoughts

Javascript is one of the most widely-used programming languages with a low entrance difficulty level. Having a JavaScript package that allows developers to build on Cardano will significantly boost a new family of projects and tools around our ecosystem. 

For more information about the Ouroboros networking library for JavaScript, its implementation roadmap, or any other questions related to the project, please check out the Fund 4 developer ecosystem project proposal on IdeaScale: 

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts