Building Your First CorDapp
Follow this learning path to build your first CorDapp Corda Distributed Application. A Java (or any JVM targeting language) application built using the Corda build toolchain and CorDapp API to solve some problem that is best solved in a decentralized manner. with a step-by-step guide. This set of tutorials teaches you how to implement the functionality and features you need to get any CorDapp up and running.
Before You Start
Before you start building your first CorDapp:
Read about Corda key concepts.
Install the required prerequisites.
Read the CorDapp template installation instructions
The Story
This example showcases a delivery versus payment (DvP) scenario. You are building a CorDapp for an apple orchard that wants to offer a way for customers to purchase a voucher that they can later redeem for a bushel of apples.
There are two parties involved in this transaction:
- The owner of the orchard - Farmer Bob.
- A customer named Dave.
Your CorDapp must follow this process:
- Farmer Bob creates and issues a voucher to Dave for the apples he wishes to buy.
- Farmer Bob prepares the amount of apples Dave requested.
- Dave goes to the orchard to pick up his apples and redeems his voucher.
- The voucher is marked as spent and Farmer Bob gives Dave his apples.
An important feature of this CorDapp is that the voucher cannot be used more than once. It must be considered invalid after it is redeemed.
Corda Implementation
- Farmer Bob issues a voucher to Dave via a ledger transaction. In your CorDapp, this voucher is called
AppleStamp
and is a state on the ledger. One transaction has been performed so far. - When Farmer Bob prepares the apples Dave requested, he self-issues a bushel of apples via a self-issue transaction. This is another state
An immutable object representing a fact known by one or more participants at a specific point in time. You can use states to represent any type of data, and any kind of fact.
on the ledger -
BasketofApples
. Two transactions have been performed so far. - Next, Dave goes to the orchard to pick up his apples and redeems his voucher, triggering a transaction on the ledger that consumes the
AppleStamp
state. Three transactions have been performed so far. - The
BasketofApples
state is transferred to Dave when theAppleStamp
state is consumed and Farmer Bob gives Dave his apples.
All of these transactions are initiated by flows.
Next Steps
Follow these tutorials in sequential order to build your CorDapp:
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.