Build a CPB
You can build a CPB from your CPK files using one of the following:
Build a CPB Using Gradle
To build a CPB using Gradle:
Add the CPB plugin to your project by adding the following to the start of the
build.gradle
file of your CorDapp Corda Distributed Application. A Java (or any JVM targeting language) application built using the Corda build toolchain and CorDapp API to solve some problem that is best solved in a decentralized manner. Gradle project:plugins { id 'net.corda.plugins.cordapp-cpb2' }
To sign your CPB, add a
cordapp/signing
section to the projectsettings.gradle
file.By default, the CPB plugin signs with a default key. This key should only be used for local testing. You must sign the CPBs for deployment on a dynamic network with a key that you can share with the Network Operator responsible for building the CPI from the CPB. You should always sign test CPBs with a different key used only for testing. The final key that the Network Operator uses should not be used for signing until you are ready to release. You can re-sign a CPB without building the project from source, using the Corda CLI.Run the
cbp
Gradle task:./gradlew cpb
Build a CPB Using the Corda CLI
To build a CPB using the Corda CLI A command line tool that supports various Corda-related tasks, including Corda Package Installer (CPI) creation and Corda cluster management. :
Generate a code signing key. For example:
keytool -genkeypair -alias "<key-alias>" -keystore <signingkeys.pfx> -storepass "<keystore-password>" -dname "cn=<CPI Plugin Example - Signing Key 1, o=R3, L=London, c=GB>" -keyalg <RSA> -storetype <pkcs12> -validity <4000>
You must sign the CPBs for deployment on a dynamic network with a key that you can share with the Network Operator responsible for building the CPI from the CPB. You should always sign test CPBs with a different key used only for testing. The final key that the Network Operator uses should not be used for signing until you are ready to release.Never commit your keystore to git.Use the Corda CLI
package
command, specifying the CPK files, the name, version, and file name of the CPB, and the details of the signing key:./corda-cli.sh package create-cpb \ <mycpk0.cpk> <mycpk1.cpk> \ --cpb-name <manifest-attribute-cpb-name> \ --cpb-version <manifest-attribute-cpb-version> \ --file <output.cpb> \ --keystore <signingkeys.pfx> \ --storepass <"keystore password"> \ --key <"signing key 1">
./corda-cli.cmd package create-cpb ` <mycpk0.cpk> <mycpk1.cpk> ` --cpb-name <manifest-attribute-cpb-name> ` --cpb-version <manifest-attribute-cpb-version> ` --file <output.cpb> ` --keystore <signingkeys.pfx> ` --storepass <"keystore password"> ` --key <"signing key 1">
For more information about the Corda CLI
package
command, see the Corda CLI Reference section.
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.