CorDapp Template Overview
This section provides an overview of the content of the CorDapp template. It contains the following:
Project Structure
On the left, you can see the folder structure created, ready for CorDapps development.
For Kotlin, write your flow
Communication between participants in an application network is peer-to-peer using flows.
code in workflows/src/main/kotlin/<your package path>
and your contract and states
An immutable object representing a fact known by one or more participants at a specific point in time. You can use states to represent any type of data, and any kind of fact.
code in /contracts/src/main/kotlin/<your package path>
.
For Java, use workflows/src/main/java/<your package path>
for your flows and /contracts/src/main/java/<your package path>
for your contract and states code.
For test code, use the corresponding test folder.
Gradle Helpers for the Combined Worker
On the right, you can see the Gradle tasks that help you work with a local deployment of Corda using the combined worker. The combined worker is a Corda cluster that runs all of the workers in one JVM process for development purposes.
The Gradle helpers are grouped into five folders:
- corda-runtime-plugin-local-environment
- corda-runtime-plugin-cordapp
- corda-runtime-plugin-network
- corda-runtime-plugin-queries
- corda-runtime-plugin-supporting
corda-runtime-plugin-local-environment
The corda-runtime-plugin-local-environment
tasks help with the lifecycle of your local Corda cluster:
Helper | Description |
---|---|
startCorda | Starts an instance of the Corda cluster using Docker Compose, with the combined worker container on the network with the necessary prerequisites (Kafka and Postgres). This requires Docker Engine or Docker Desktop running. The Docker Compose process will continue to run in a ‘Run’ console, providing output from all of the containers, until it is shut down. Note, Corda takes about one minute to start up. You should poll the cluster with one of the corda-runtime-plugin-queries helpers until it responds to confirm if the cluster is live and ready to interact. |
stopCorda | Stops the Corda cluster using Docker Compose and deletes all containers and networks used by the cluster. |
stopCordaAndCleanWorkspace | 1. Stops the Corda cluster using Docker Compose and deletes all containers and networks used by the cluster (same as the stopCorda task).2. Recursively deletes workspace directory, to reset any pending state. |
corda-runtime-plugin-cordapp
The corda-runtime-plugin-cordapp
tasks help to create and deploy CPIs:
Helper | Description |
---|---|
createGroupPolicy | Creates the group policy A JSON file containing network information that is bundled with a CPB to create a CPI. which is required to set up the application network The set of all possible entities onboarded according to the rules of the network. Application networks enable people and businesses to interact with each other on Corda. . |
createKeyStore | Creates the signing keys for publishing the CPIs Corda Package Installer. A signed ZIP/JAR combination of a CPB and a Group Policy File that defines not only the application code that a virtual node will run, but also the details of the MGM with which to register, and the details of network PKI requirements. . |
buildCPIs | Builds your CorDapp and wraps it in a signed CPI. |
deployCPIs | Deploys the CPI to your local Corda cluster. If the CPI has already been deployed to the nodes on the cluster, this task performs a forced upload and replaces the old CPI with the new one. |
Some tasks have a dependency on the others. So, for example, if you run deployCPIs
, it also runs createGroupPolicy
, createKeyStore
and buildCPIs
.
corda-runtime-plugin-network
The corda-runtime-plugin-network
tasks set up your virtual nodes:
Helper | Description |
---|---|
vNodesSetup | Sets up the virtual nodes specified in config/static-network-config.json on you local Corda cluster with the uploaded CPI. |
Some tasks have a dependency on the others. So, for example, if you run vNodesSetup
, it also runs deployCPIs
.
vNodesSetup
the first time you upload your CPI to the Corda cluster. On subsequent builds, you can just run deployCPIs
. (vNodeSetup
has no effect if the virtual nodes have already been set up. It will not try to recreate them.)corda-runtime-plugin-queries
The corda-runtime-plugin-queries
tasks are standard queries that are useful to run against your Corda cluster:
Helper | Description |
---|---|
listVNodes | Queries the Corda cluster and returns the list of virtual nodes. This includes the ShortHash that you need for running flows. |
listCPIs | Queries the Corda cluster and returns the list of CPIs uploaded. |
corda-runtime-plugin-supporting
The corda-runtime-plugin-supporting
tasks are are supporting Gradle tasks, used internally by other tasks:
Helper | Description |
---|---|
getNotaryServerCPB | Downloads the Notary Server CPB. |
projInit | Creates the workspace directory. |
updateProcessorTimeout | Updates the processor timeout in the corda.messaging config section of the Corda cluster. |
Debug Configuration
In the toolbar, you can select the DebugCorDapp
run configuration to debug the running Corda instance from IntelliJ.
Was this page helpful?
Thanks for your feedback!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.
We're sorry this page wasn't helpful. Let us know how we can make it better!
Chat with us
Chat with us on our #docs channel on slack. You can also join a lot of other slack channels there and have access to 1-on-1 communication with members of the R3 team and the online community.
Create an issue
Create a new GitHub issue in this repository - submit technical feedback, draw attention to a potential documentation bug, or share ideas for improvement and general feedback.
Propose documentation improvements directly
Help us to improve the docs by contributing directly. It's simple - just fork this repository and raise a PR of your own - R3's Technical Writers will review it and apply the relevant suggestions.