Use CI/CD to deploy a chaincode to blockchain in private cloud on LinuxONE

Get the code

Summary

This code pattern provides the means for users to experiment with chaincode deployment from GitHub and test the chaincode on a pre-set blockchain network in IBM Cloud Private on LinuxONE. It also allows users to perform CI/CD operations to automatically track modifications to the chaincode in GitHub and upgrade the chaincode on the network appropriately.

Description

This code pattern is targeting smart contracts, or chaincode developers; It allows a simple method for deploying a chaincode from GitHub directly to a blockchain network and test it using a provided web application. The blockchain network in this code pattern is pre-set on IBM Blockchain Platform for IBM Cloud Private on LinuxONE using the LinuxONE Community Cloud, removing the burden of setting up the blockchain network and administrating it. Developers can focus solely on the chaincode development aspect. A sample chaincode is provided for the users to experiment with. However, users may also deploy and exercise their own chaincode(s).

The provided web application behaves as a portal to the blockchain network. It contains an intuitive GUI, from which users can deploy and upgrade the chaincode from GitHub and then invoke transactions and query the entities.

Moreover, users can also experiment with simplistic automatic CI/CD for the chaincode. With simple configuration steps, users enable automatic tracking of chaincode changes in the GitHub repository, and automatic deployment of new versions of the code to the blockchain network. This is a simple CI/CD pipeline based on GitHub webhooks, mainly to demonstrate its capability with blockchain and allow a platform for learning, experiment and early development. However, users can later deploy a more advanced CI/CD pipeline in their environment based on popular solutions, such as Jenkins. It is recommended to perform a more coherent development discipline including continuous integration and testing before deploying code in production.

To summarize, this code pattern provides chaincode developers an easy starting point for building, developing, and testing chaincodes using a provided CI/CD pipeline, on a pre-set blockchain network.

Flow

flow

  1. The user obtains a sample chaincode (smart contract)
  2. The user creates a local GitHub repository with the chaincode
  3. The user accesses the web application GUI on LinuxONE Community Cloud to interfacethe IBM Blockchain Platform for ICP
  4. The user deploys the chaincode to a pre-set blockchain network and invokes transactions and query operations
  5. The user enables and tests CI/CD automation (optional)

Instructions

Find the detailed instructions in the README. The steps show you how to:

  1. Provision IBM Blockchain Platform for ICP on LinuxONE Community Cloud
  2. Create your chaincode local GitHub repository
  3. Deploy the chaincode
  4. Invoke transactions and queries
  5. Enable CI/CD (optional)