This CorDapp is built on top of the Kotlin template that is provided by Corda team.
You can find the full article about the purpose of this application here: https://blog.b9lab.com/small-arms-transfer-control-with-blockchain-r3s-corda-6e2fce9d80c4
See https://docs.corda.net/getting-set-up.html.
On the top right side of InelliJ select Unit Tests gradle task then click the start button.
Below is a summary of the instructions to run the nodes from an Ubuntu terminal (for other operating systems; see https://docs.corda.net/tutorial-cordapp.html#running-the-example-cordapp):
- Browse to the CordApp folder:
cd cordapp-euc
- Deploy the nodes:
./gradlew deployNodes
- Run the nodes:
./build/nodes/runnodes
Do not click or change focus until all five additional terminals have opened, or some nodes may fail to start; wait until they fully load before proceeding to the next section.
You can add more nodes by modifying the deployNodes
task inside build.gradle
file.
When started via the command line; each node will display an interactive shell:
- Navigate to the Importer terminal and start the Issue EUC flow with the below command (to paste it in the terminal; click the mouse wheel button):
flow start IssueFlow$Initiator importer: "O=Importer,L=Brussels,C=BE", exporter: "O=Exporter,L=Stockholm,C=SE", endUser: "O=End User,L=Brussels,C=BE", itemDesc: "AK-47", itemQty: 1000, totalValue: 100000.0
- Navigate to the Exporter terminal and run the below command; you should see one new EUC state:
run vaultQuery contractStateType: com.template.states.EUCState
- Navigate to the MOD terminal and run the below command; you should see zero states, because by design MOD is only an observer that verifies and signs the transaction:
run vaultQuery contractStateType: com.template.states.EUCState
- Navigate to the Exporter terminal and start the Issue EUC flow with the below command (to paste it in the terminal; click the mouse wheel button):
flow start IssueFlow$Initiator importer: "O=Importer,L=Brussels,C=BE", exporter: "O=Exporter,L=Stockholm,C=SE", endUser: "O=End User,L=Brussels,C=BE", itemDesc: "AK-47", itemQty: 1000, totalValue: 100000.0
You should get an error:Only the importer can initiate the flow.
- Type
bye
to shutdown a certain terminal.