CorDapp compatibility between Corda and Corda Enterprise

Corda and Corda Enterprise have an Open Core approach. This means that both Corda and Corda Enterprise are compiled against the Corda Core library.

This allows CorDapps to be developed for compatibility between Corda and Corda Enterprise.

In order to develop a CorDapp for compatibility between Corda and Corda Enterprise follow these steps:

  • Ensure your CorDapp is designed per Structuring a CorDapp and annotated according to CorDapp separation. In particular, it is critical to separate the consensus-critical parts of your application (contracts, states and their dependencies) from the rest of the business logic (flows, APIs, etc). The former - the CorDapp kernel - is the Jar that will be attached to transactions creating/consuming your states and is the Jar that any node on the network verifying the transaction must execute.
  • Compile this CorDapp kernel Jar once, and then depend on it from your workflows Jar. In terms of Corda depdendencies,this should only depend on the corda-core package from the Corda Open Source distribution.
  • Your workflow Jar(s) should depend on the CorDapp kernel (contract, states and dependencies). Importantly, you can create different workflow Jars for Corda and Corda Enterprise, because the workflows Jar is not consensus critical. For example, you may wish to add additional features to your CorDapp for when it is run on Corda Enterprise (perhaps it uses advanced features of one of the supported enterprise databases or includes advanced database migration scripts, or some other Enterprise-only feature).When building a CorDapp against Corda Enterprise, please note that the corda-core library still needs to come from the open source distribution, so you will have dependencies on Corda Enterprise and a matching open core distribution. Specifically, any CorDapp targeted to run on Corda Enterprise should have unit and integration tests using Corda Enterprise.

In summary, structure your app as kernel (contracts, states, dependencies) and workflow (the rest) and be sure to compile the kernel against Corda open source. You can compile your workflow (Jars) against the distribution of Corda that they target.