- Download and install a JDK 8 JVM (minimum supported version 8u131)
- Download and install IntelliJ Community Edition (supported versions 2017.x and 2018.x)
- Open IntelliJ. From the splash screen, click
Import Project
- Select
Import project from external model > Gradle > Next > Finish
- Click
File > Project Structure…
and select the Project SDK (Oracle JDK 8, 8u131+) - Open the
Project
view by clickingView > Tool Windows > Project
- Run the test in
src/test/java/ProjectImportedOKTest.java
. It should pass!
Normally, you'd interact with a CorDapp via a client or webserver. So we can focus on our CorDapp, we'll be running it via the node shell instead.
Once you've finished the CorDapp's code, run it 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 deployNodes
- macOS:
./gradlew deployNodes
- Windows:
-
Start the nodes by running the following command:
- Windows:
build\nodes\runnodes.bat
- macOS:
build/nodes/runnodes
- linux:
./deploy.sh
- Windows:
States define shared facts on the ledger. Our state, CbioState, will define a CBIO. It will have the following structure:
-------------------
| |
| CbioState |
| |
| - owner |
| - amount |
| - paidValue |
| - lastOwner |
-------------------
Contracts govern how states evolve over time. Our contract, CbioContract, will define how CbioStates evolve.
//Acceptable values for typeFuel E1GC,E1GM,E2G,BIODIESEL,E1G2G,
flow start CbioIssueFlowInitiator typeFuel: "E1GC", qtyEmission: 1000, qtyReagent: 300
flow start CbioMoveFlowInitiator newOwner: Petrobras, amount: 500, paidValue: 1000
flow start CbioRedeemFlowInitiator amount: 100
run vaultQuery contractStateType: cbio.contracts.CbioState