Please describe your proposed solution.
Create a Golang library to make it easy to write applications that interact directly with a Cardano node. This library will implement support for the Ouroboros network protocol, including the various mini-protocols. This library will eventually fully support both the NtC (node-to-client) protocol (using the UNIX socket to talk to the local node) and the NtN (node-to-node) protocol (used for nodes talking to each other via TCP) as both a client and server, but this proposal is limited to client support for all NtC protocols. This will allow for things like querying the tip, submitting a transaction, or syncing the blockchain from a local node, using Golang code without shelling out to “cardano-cli” or needing to maintain another piece of infrastructure (such as cardano-submit-api, cardano-db-sync, or Ogmios).
Please describe how your proposed solution will address the Challenge that you have submitted it in.
Golang is an extremely popular programming language. GitHub Language Statistics from GitHut 2.0 (code: <https://github.com/madnight/githut>) show that in Q4 2021, the number of pull requests on Golang repositories grew 8.161% and Haskell repositories grew 0.180% (source: https://madnight.github.io/githut/#/pull_requests/2021/4/Go,Haskell) while the number of repository stars on Golang repositories grew 11.763% and Haskell repositories grew 0.178% (source: <https://madnight.github.io/githut/#/stars/2021/4/Go,Haskell>). The Golang developer community is approximately 4x the size of the Haskell developer community, based on the number of Github repos with code for each. Since it’s hard to judge community size, we’re using these numbers as a proxy. We hope to bridge the gap between Golang developers and the Cardano blockchain and attract more developers to Cardano.
Creating a Golang library for interacting with Cardano nodes will allow tapping into a much larger pool of developers than the existing Haskell libraries generally allow for. This will also lower the barrier for entry into the Cardano ecosystem.
What are the main risks that could prevent you from delivering the project successfully and please explain how you will mitigate each risk?
One of the biggest challenges that this project will face is the lack of documentation for particular parts of the Ouroboros network protocol outside of the official Haskell code. This usually requires reading through the Haskell code and/or combing through packet captures to determine how something is supposed to work.
Another challenge comes from Cardano using maps with bytestring keys in CBOR-encoded data (such as in block bodies, transactions, and, LocalTxSubmission refusal reasons), which cannot be natively represented in Golang. This can be mitigated with some foreknowledge of the encoded data structure and/or some custom CBOR parsing code (on top of the general “fxamacker/cbor” library).