* Initial improvements. * Updates tutorials. * Missing imports. * Addresses review feedback.
2.2 KiB
The CorDapp Template
When writing a new CorDapp, you’ll generally want to start from one of the standard templates:
The Cordapp templates provide the boilerplate for developing a new CorDapp. CorDapps can be written in either Java or Kotlin. We will be providing the code in both languages throughout this tutorial.
Note that there's no need to download and install Corda itself. The required libraries are automatically downloaded from an online Maven repository and cached locally.
Downloading the template
Open a terminal window in the directory where you want to download the CorDapp template, and run the following command:
//github.com/corda/cordapp-template-java.git ; cd cordapp-template-java git clone https:
//github.com/corda/cordapp-template-kotlin.git ; cd cordapp-template-kotlin git clone https:
Opening the template in IntelliJ
Once the template is download, open it in IntelliJ by following the instructions here: https://docs.corda.net/tutorial-cordapp.html#opening-the-example-cordapp-in-intellij.
Template structure
For this tutorial, we will only be modifying the following files:
// 1. The state
java
cordapp-contracts-states/src/main/java/com/template/TemplateState.
// 2. The flow
java cordapp/src/main/java/com/template/Initiator.
// 1. The state
cordapp-contracts-states/src/main/kotlin/com/template/StatesAndContracts.kt
// 2. The flow
cordapp/src/main/kotlin/com/template/Flows.kt
Progress so far
We now have a template that we can build upon to define our IOU CorDapp. Let's start by defining the IOUState
.