This is a project written to understand writing Corda applications. It is intended for learning purpose. It demonstrates simple insurance policy purchase and claims, transaction in the distributed ledger Corda.
This project references corda documentation and bootcamp-corda. Thanks to the contributors and developers, most part of the template project could be reused.
-
Download and install Oracle JDK 8 JVM (minimum supported version 8u131)
-
Download and install IntelliJ Community Edition (supported versions 2017.x and 2018.x)
-
Download the arun-insurance repository:
git clone https://github.com/corda/arun-insurance
-
Open IntelliJ. From the splash screen, click
Import Project
, select thearun-insurance
folder and clickOpen
-
Select
Import project from external model > Gradle > Next > Finish
-
Click
File > Project Structure…
and select the Project SDK (Oracle JDK 8, 8u131+)i. Add a new SDK if required by clicking
New…
and selecting the JDK’s folder -
Open the
Project
view by clickingView > Tool Windows > Project
Run the application with the following steps:
-
Build a test network of nodes by opening a terminal window at the root of your project and running the following command:
- Windows:
gradlew.bat deployNodesJava
- macOS:
./gradlew deployNodesJava
- Windows:
-
Start the nodes by running the following command:
- Windows:
build\nodes\runnodes.bat
- macOS:
build/nodes/runnodes
- Windows:
-
Open the nodes are started, go to the terminal of InsuranceA (not the notary!) and run the following command to issue $100 insurance to Anil:
flow start InsuranceIssueFlow insurer: Anil, amount: 100
-
To view the insurance policy, run the following command in their respective terminals:
run vaultQuery contractStateType: arun_insurance.InsuranceState
- Run the
gatherDependencies
Gradle task from the root of the project to gather all the CorDapp's dependencies inlib/dependencies
- Update
gradle/wrapper/gradle-wrapper.properties
to point to a local Gradle distribution (e.g.distributionUrl=gradle-4.4.1-all.zip
) - In
build.gradle
, under bothrepositories
blocks, comment out any repositories other thanflatDir { ... }