A Road to Less Coding: Auto-Generate APILibrary

December 03, 2019

This blog is about streamlining the process of connecting your Corda node to an existing system or a front end application.

With the recent launch of OpenAPI support, you can now automate the building of client libraries for your CorDapps.

Every Corda developer has had the experience of having to build an integration with their existing system. It might be a bank system, back-end business software, or a web application. The experience is tedious and complex.

Before today, in order to connect to a Corda node, you had to write a client in a JVM-compatible language using the CordaRPCClient class because the Corda node is a secure box running inside an JVM.

The client normally looks like something like this:

Writing the client is the little step that stops you from showing your brilliant CorDapp to your friends and your boss if they haven’t learned how to start flows using the node shell. (⚠️ Don’t get me wrong. Implementing a web server by yourself is very easy. Check out these two articles to find out more information: Spring cleaning : Migrating your CorDapp away from the deprecated Corda Jetty web server and Streaming data out of a Corda node with Spring WebFlux by our R3 employees)

Introducing project Braid. Braid is a standalone client server that can present your CorDapp (and the APIs of your node) as an OpenAPI end point (formally know to developers as a swagger-api) API templates.

Thanks to the OpenAPI client, having to write your own custom REST APIs is a thing of the past. Now, after you finish your CorDapp development, you start up the Braid server. It will give you an API template, use the Openapi-generator tool to generate the API libraries in your desired language. Then you can start using the APIs anyway you like!

Braid provides easy integration to Corda from any programming language, and secure connections with TLS/SSL. It’s fast — capable of handling 8–9K concurrent requests per second on a small Amazon instance; and it scales well.

Behind the scene, Braid uses Vert.x, a lightweight reactive java framework. According the techempower.com, Vert.x’s performance is significantly better than Spring-boot for multiple queries. That said, Braid will be the next best option to connect your node with your existing applications.

Note: Braid was developed by an established R3 partner, LAB577. The core developer team of LAB577 has many years of experience with Corda. LAB577 is also a member and maintainer of the Cordite Foundation.

Conclusion:

This new procedure will shorten the development cycle and decrease the learning curve of developing Cordapps. For developers, it will make the application experience easier. For business owners and entrepreneurs, it will all come back as cost-savings for the project. This is the ultimate goal as the main contributors of our Corda community: to provide a smoother development experience that better fosters the Corda ecosystem

Try it out:

Openapi-sample: https://github.com/corda/openapi-sample
Or, learn more about Corda at corda.net.

Contact: slack.corda.net | Peter.li@r3.com


A Road to Less Coding: Auto-Generate APILibrary was originally published in Corda on Medium, where people are continuing the conversation by highlighting and responding to this story.