This cordapp-example application allows a party (lender) to issue an IOU to another party (borrower).
IOUState
: This is a LinearState and a QueryableState that represents an IOU that can be issued by one party (lender) to another party (borrower).
IOUContract
: This is used to govern the evolution of an IOUState. This file includes validation rules governing theCreate
command forIOUState
.
ExampleFlow
: This flow is used to create anIOUState
. It takes 2 arguments as the parameters: theiouValue
(Int) and theotherParty
(Party).
Set up for CorDapp development
- Open a terminal and go to the project root directory and type: (to deploy the nodes using bootstrapper)
./gradlew clean build deployNodes
- Then type: (to run the nodes)
./build/nodes/runnodes
This should open up 3 new tabs in the terminal window with Corda interactive shells.
One for the Notary, one for Party A, and one for Party B.
(If any of the nodes is missing a Corda interactive shell, from the root folder, navigate to ./build/node/{missing party node}
and run java -jar corda.jar
to boot up the Corda interactive shell manually.)
- Next, navigate to the Party A Corda interactive shell to start the
ExampleFlow
to issue an IOU (from Party A (lender) to Party B (borrower)). Type the following command:
flow start ExampleFlow$Initiator iouValue: 20, otherParty: PartyB
You should see the following output in the terminal:
- To check that you've successfully issued an IOU from Party A to Party B, navigate to the Party B Corda interactive shell to check all of the existing
IOUState
in Party B's vault. Type:
run vaultQuery contractStateType: "net.corda.samples.example.states.IOUState"
This command will output all the States in Party B's vault which has a contract state type of IOUState
.
You've now successfully issued an IOUState
of value 20, from Party A to Party B!