Create a decentralized energy network with IBM Blockchain Platform

Get the code


This developer code pattern first demonstrates how to package your smart contracts using the IBM Blockchain Platform VSCode extension, then setting up a network on IBM Blockchain Platform. You will then deploy the decentralized smart contract package onto the network. Lastly, we generate client-side certificates so you can subsequently enroll an application identity and submit transactions on the smart contract.


A key application of blockchain being explored is a decentralized energy network. The idea stems from a neighborhood where certain residents are producing energy through solar panels or other means and can sell excess energy to residents needing energy. The transactions would be based on coins in each resident’s account. As per a pre-determined contract and rate, the coins would be debited from the consumer and credited to the producer for a certain billing period. Each transaction would need to be atomic and added to a blockchain ledger for trust and verification.

The network consists of residents, banks, and utility companies. Residents can exchange coins for energy among each other. The application assumes a pre-paid system where transactions occur after the energy is consumed and the values are updated. The resident can exchange coins for Fiat money (USD) with banks on the network. The residents can also transact coins for energy with a utility company on the network.

This code pattern demonstrates how a Node.js smart contract can be packaged using the IBM Blockchain Platform VSCode extension. Using the extension, you can set up a local instance of the Hyperledger Fabric network, on which you can install and instantiate the contract. The application is set up with a Node.js server using the Fabric Node SDK to process transactions that communicate with the network.

When you have completed this code pattern, you will understand how to:

  • Package the smart contract using IBM Blockchain Platform VSCode extension
  • Set up a Hyperledger Fabric network on IBM Blockchain Platform
  • Install and instantiate smart contract package onto the IBM Blockchain Platform
  • Develop a Node.js server with the Hyperledger Fabric SDK to interact with the deployed network
  • Interact with the contract and execute transactions using the SDK



  1. Use the IBM Blockchain Platform VSCode extension to package the decentralized energy smart contract.
  2. Launch the IBM Blockchain Platform and Kubernetes services on IBM Cloud.
  3. Install chaincode on the peer node.
  4. Instantiate the chaincode on the peer node.
  5. Execute the decentralized energy smart contract transactions from a Node.js application.


Ready to get started? Please see the README for detailed instructions.