What is a CorDapp?

CorDapps (Corda Distributed Applications) are distributed applications that run on the Corda platform. The goal of a CorDapp is to allow nodes to reach agreement on updates to the ledger. They achieve this goal by defining flows that Corda node owners can invoke over RPC:

node diagram

CorDapps take the form of a set of JAR files containing class definitions written in Java and/or Kotlin.

These class definitions will commonly include the following elements:

  • Flows
  • States
  • Contracts
  • Services
  • Serialization whitelists

But may also include:

  • APIs and static web content
  • Utility classes

Flows are routines for nodes to run. They can perform a variety of tasks, but usually involve ledger updates. Flows subclass FlowLogic. For more information on flows, see Writing CorDapp Flows.

States define the facts that parties agree and transact over. States implement the ContractState interface. For more information on states, see Writing CorDapp States.

Contracts define the shared rules for updating the ledger. Contracts implement the Contract interface``. To learn more about implementing contracts, see Writing CorDapp Contracts.

Services are intended to provide long-lived utilities that don’t need to run on the network. Services subclass SingletonSerializationToken

Serialization whitelists restrict the objects a node can deserialize when being sent messages from other nodes. Serialization whitelists implement the SerializationWhitelist interface.

In this example, we’ll go over the components of a CorDapp designed to trade bonds. This CorDapp would be deployed by all Node owners wishing to establish a business network to trade bonds.

There are several components required for the minimum implementation of this CorDapp. First are the three required flows:

  • An issuance flow, for example IssueBondFlow, to allow new bonds to be issued onto the ledger
  • A bond trading flow, TradeBondFlow, where bonds already issued can be exchanged between parties
  • An exit flow, ExitBondFlow where bonds can be exited from the ledger

These three flows allow for a basic lifecycle of bond creation, trading, and exiting between the transacting parties. However, there are several more components that are required in order to implement this CorDapp:

  • A state must be created to represent the bonds, BondState, this state is what will be issued, traded, and exited by the flows
  • A BondContract must also be created to define the rules defining valid transactions

Each node owner will install this CorDapp onto their node, and can then issue, trade, and exit bonds with other node owners.

Was this page helpful?

Thanks for your feedback!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.

We're sorry this page wasn't helpful. Let us know how we can make it better!

Chat with us

Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.

Create an issue

Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.

Propose documentation improvements directly

Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.