CorDapp Template Overview heading-link-icon

This section provides an overview of the content of the CorDapp template. It contains the following:

On the left, you can see the folder structure created, ready for CorDapps development.

CorDapp template folders in IntelliJ
CorDapp template folder structure

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.

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.

Corda Runtime gradle tasks in IntelliJ
Corda Runtime gradle helpers

The Gradle helpers are grouped into five folders:

The corda-runtime-plugin-local-environment tasks help with the lifecycle of your local Corda cluster:

HelperDescription
startCordaStarts 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.
stopCordaStops the Corda cluster using Docker Compose and deletes all containers and networks used by the cluster.
stopCordaAndCleanWorkspace1. 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.

The corda-runtime-plugin-cordapp tasks help to create and deploy CPIs:

HelperDescription
createGroupPolicyCreates 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. .
createKeyStoreCreates 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. .
buildCPIsBuilds your CorDapp and wraps it in a signed CPI.
deployCPIsDeploys 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.

The corda-runtime-plugin-network tasks set up your virtual nodes:

HelperDescription
vNodesSetupSets 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.

The corda-runtime-plugin-queries tasks are standard queries that are useful to run against your Corda cluster:

HelperDescription
listVNodesQueries the Corda cluster and returns the list of virtual nodes. This includes the ShortHash that you need for running flows.
listCPIsQueries the Corda cluster and returns the list of CPIs uploaded.

The corda-runtime-plugin-supporting tasks are are supporting Gradle tasks, used internally by other tasks:

HelperDescription
getNotaryServerCPBDownloads the Notary Server CPB.
projInitCreates the workspace directory.
updateProcessorTimeoutUpdates the processor timeout in the corda.messaging config section of the Corda cluster.

In the toolbar, you can select the DebugCorDapp run configuration to debug the running Corda instance from IntelliJ.

Menu in IntelliJ to debug Corda
CorDapp template DebugCorDapp

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.