Sign in

Now that we have implemented all states and contracts the only missing bit is implementing flows.

What is a workflow?

In Corda R3, every operation is associated with a flow, a flow is basically an operation that the client can perform on the application developed.

The flow responsibility is to create new states or fetch from the ledger an existing state and create a new one, evolving the state this way, and what do we do with this states? We need to persist them, or add it to the ledge and request every other node that is interested in these new states to validate…


Now that we have our states created with all the fields that matter to us, it’s time to create the contracts that bind our states.

In Corda R3 we need to create a contract class that is responsible for all possible changes related to the state it is binded. We saw that on the previous post about states, that each state class has an annotation @BelongsToContract that receives a contract class as parameter.

First we start by creating a BaseContract that implements the Contract interface, this way we let the framework know that his class is a contract.

The Contract


On the previous post we learned about Corda main components, and one of them was the state component.

In this article we will implement in code the specified components and build and run the nodes and query a random node to find if the states were created as they were supposed.

You will notice that the Corda project is split into multiple modules, the first one we will take a look is the contracts module. In this module we will find two classes already created as templates, TemplateContract inside the contracts package, and TemplateState inside the states package.

On this…


There are three main components for a corda application (cordapp): Workflows, Contracts and States.

States

Each state contains the information that we want to store into the ledge. This state is then encrypted and saved in a way that we can not modify it’s content. After a state is saved into the ledger it can only be read or evolve. Read basically means a query to the ledge and find that state, evolve can be a little more tricky to understand because as we just said a state can not be modified, but we can create a new state that represents…


This article is the first of a series of articles about Corda R3 (Corda from now on).

In the first one, we will learn what a distributed ledger is and how Corda can help us implement a DApp (distributed application), and an initial setup of the framework using IntelliJ as our main IDE.

But before we start, first we need to understand what our goal is, what we are trying to build here and why Corda can help us build our project.

What Are We Building?

We are going to build a simple proof of concept project I call, DBanking. …

Marcus

Master In Software Engineering and Android Engineer at Busuu, with a great passion for technologies, programming and photography.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store