Corda 5 “The road ahead” — Introducing the building blocks of Corda: Project Layer Cake Part 5
Welcome back! In the previous blog post, we took some time to go over how the new Corda 5 APIs impact CorDapp development. In our Developer Preview, we released new, interface-based, modular APIs. With these modular APIs, you can develop faster by building and testing more effectively. We briefly touched on Project Layer Cake, the initiative that inspired us to make our APIs modular and split Corda into discrete, logical layers of value; network, flow, ledger, and contract.
So what value can Corda deliver? Corda can:
- Form trusted networks of participants and pass information between them.
- Coordinate complex distributed workflows.
- Record and query ledger data with a guarantee of “What You See Is What I See — WYSIWIS”.
- Safely transfer value without requiring issuer endorsement using enforceable rules.
In this blog post, I will explore how Project Layer Cake enables this and some of the history underpinning it, and tell you what this means for the CorDapp design process. I’ll also go over some use cases we envision users could build with these independent layers.
New to Corda? Have a look through our official Corda Documentation to learn more about Corda’s capabilities and key concepts.
The Origin Story
We began to investigate questions surrounding the utility of Corda back in March 2020 — while most of the world went into lockdown and everyone’s neighbour seemed to suddenly be in training to become pro-athletes. We did some soul-searching of our own here at R3. We asked ourselves some introspective questions in order to answer how we could best describe Corda and how we could guide developers to design apps that take full advantage of the platform. We reviewed as many CorDapps as we could get our hands on, trying to abstract patterns and practices to evolve our thinking and communication. Most importantly we investigated how we could evolve our APIs. It started with a simple question:
“We have lots of developers using Corda but they’re not all using it in the way we expected, What can we learn from this?”
Over the course of a month, with this question as our guiding principle, we conducted Project Layer Cake: a small-scale, time-boxed effort to understand how developers use Corda and what the platform means to their success. We wanted to come out of this project with an understanding of how to simplify the way we communicate Corda concepts to our business and technical partners.
As with all new platforms, we’ve learned some lessons. Things we thought weren’t as important have proven to be fundamental and valuable on their own. Things we thought were essential turned out to be less critical than we anticipated. For example, we had noticed some CorDapps seemed over-complex for what they were seeking to accomplish: they were using advanced smart contract capabilities even though they didn’t need them. This was an opportunity to help simplify some projects. In other cases, we saw some developers were using features we saw as mere ‘supporting capabilities’ as the core of their solution, and pushing the feature to its absolute limits. This was especially the case with the Flow Framework, which formed the entire basis of some apps. Did this mean we should be elevating some of these ‘lower level’ concepts into top-class platform features in the way we teach and document the product?
We took away a new understanding of usage patterns to inform our priorities going forward and will improve your developer experience on the platform. The outcome of Project Layer Cake grouped all of Corda’s capabilities into a series of discrete components. It was already clear during this initiative that some of these components could be represented as a series of architectural layers. We could describe a network layer, workflow layer, ledger layer, and contract layer, though this was not intended to be a definitive list.
Development Accelerator
I want to reflect on a quote from the previous blog post:
“Organisations, especially start-ups, want to build something quickly and easily without having to worry too far about the future.”
Let’s unpack this statement. Time is precious when it comes to getting a demo out to key stakeholders, and doing so is vital for the health of a business. Demos inform the success of a variety of early-stage critical outcomes for an organisation — from reviews to funding to beyond. Developing fast, and getting feedback is essential — particularly when what you are building aims to reshuffle the trust model of an existing value network, or what you are showcasing is something fundamentally new and never seen before!
During the initial phases of development, we understand what matters is investigating how Corda can solve your use case as quickly as possible. By the time you have a full-scale decentralised solution with all your business logic embedded, it could be too late to capture market needs. At R3, we want to enable you to build fast and work on your future roadmap later. One of the key insights we took from Layer Cake was that applications could be built in layers. Some of these layers might not be necessary, especially in the early days of a product. Thinking and building in layers can help you build in a way that emphasises optionality while retaining that crucial velocity.
A quick recap on what each layer of Corda represents:
- (P2P) Network — Secure networking and peer interactions, location-agnostic peer messaging, strong cryptographic keys.
- Flows — Data agnostic, decentralised apps API to coordinate actions across parties.
- Ledger — Reliable data agreement between parties.
- Contract — Decentralised enforcement of business logic, enabling concepts such as digital bearer tokens.
This Layer Cake approach also allows you to think more critically about your use case. Do you require the full suite of the guarantees Corda offers to solve your business needs? Maybe for your minimal viable product, you don’t need to worry about all the guarantees of Corda just yet.
Guiding Questions
We’ve provided a simple model for architects to determine how Corda could be used. The model does not take into account all possible dimensions that need to be considered for a real-world application, but it is a good approximation for determining the platform layers required to solve a particular problem.
The model consists of three simple questions:
- Will many node operators be involved?
- Will Corda be a system of record?
- Will Corda automate updates or evolve states?
These questions should be asked in the order presented and for each “yes” response to a question, some additional parts of the platform are unlocked. The idea here is that you only introduce the features & architectural complexity when you need them. Minimising complexity and progressively showcasing value. This allows you to focus on the optimal software patterns for your solution.
Use Cases
Another key insight we observed was our community almost always used all the features of Corda in some cases making their application more complex. Some of this may come down to the blockchain hype but a lot was because this is how we explained the platform and how our APIs were built. All our examples and samples worked this way. And the lesson we learnt was that we needed to do a better job at communicating what each layer is for and when to use it.
Let’s take a quick look at the types of use cases the Corda layers could potentially unlock now that we’ve explored the guiding questions. Why not try running these sample apps yourself to see what these layered CorDapps can do?
Flow and Network
Whenever data is shared between two or more organisations, there are security, privacy and trust considerations you need to make since data can span between multiple organisations. The Corda network layer solves these concerns. The network layer and workflows can conduct processes between mistrusting parties, and reliably represent real-world identities. This lets organisations transact data seamlessly.
To showcase flow and network capabilities, we designed a quick solar system demo. In our simulation, we try to communicate between planets in the solar system.
Try the demo out yourself in Kotlin or Java!
Flow, Network, and shared Ledger (Consensual states) CorDapp
For instances where two or more parties wish to share a record and remain in consensus, only a subset of traditional transaction features may be required. Enter Consensual States, our implementation of using the pluggable ledger model — view the last blog post to find out more.
Flow, Network, Ledger, and Contract Cordapp
The original messages and values of Corda are possible in Corda 5. Privacy guarantees can still control the lifecycle of a state and can continue to regulate a chain of approvals alternating between untrusting entities.
To showcase the full suite of Corda, we’ve evolved the solar system demo and added smart contract functionality — in this case, we’ve used a contract to limit communication to planets only, excluding Pluto.
Try the demo out yourself in Kotlin or Java!
Conclusion
I hope you leave with an understanding of the broad range of capabilities Corda has to offer. The modular APIs introduced in Corda 5 can allow you to think about Corda in a series of layers you can use to meet your business needs — Corda is no longer just a permissioned distributed platform. To have the best experience in building and operating it having this in mind is extremely important.
Corda has been designed and built to provide a comprehensive framework for implementing permissioned decentralised solutions, but with transaction finality and privacy features that make it more usable for business applications. However, the building blocks that enable Corda functionality have broader applicability. In particular, reliable messaging, the base workflow layer, and the ability to coordinate distributed processing logic are very powerful in their own right.
We want to describe Corda in terms of its functional layers and the capabilities each provides, some of which you will see on our official documentation site throughout the next few months and in the Corda 5 series.
If you’re curious to know more about how Layer Cake could be useful, give this post shameless applause! Layer Cake might conclude with more or fewer layers. We’ll be sure to give you updates on this topic while we continue to work hard on the next release of Corda 5.
Acknowledgements: Project Layer Cake initially comprised a small core team of R3 contributors: Matthew Nesbit, Mark Oldfield, Richard Brown and Roger Willis. Extracts of the written content are found throughout this blog post.
Call to action
- Next in the series, we’ll take a look at CorDapp packaging and networks on our journey towards making Corda 5 application-centric
- In the meantime, make sure to try the new Corda 5 APIs in developer preview and let us know what you think over on Slack or Discord (search for the “corda5” channel).
- Any feedback on the direction you want to give to the product team directly, let us know at devrel@r3.com.