Create a decentralized energy network with Hyperledger Composer

Get the code View the demo

Note: This pattern focuses on older technology (e.g. Hyperledger Fabric APIs prior to Fabric 1.4), therefore there is no support for this pattern and it will be archived on May 1, 2019. You are welcome to use up to that date, but we recommend that you begin working with the updated release found at


Wondering where blockchain might apply in your own life? Interested in energy, sustainability, or climate change? Try your hand at creating a basic blockchain app to interact with a decentralized energy network! The idea behind the app is a neighborhood where residents produce and sell excess solar-panel energy to residents who need it. This is an excellent example of how blockchain can begin to transform our world.


A great way to start experimenting with blockchain is to model a network and build a blockchain application using the Hyperledger Composer toolset. In this pattern, the application presents a decentralized energy network where neighborhood residents who are producing energy through solar panels or other means can sell excess energy to fellow residents or utility companies.

Here’s how it works: The application allows the user to create network participants with account balances who can exchange coins for energy shared. (The network also includes banks to exchange cash for coins.) Transactions can be between residents, between resident and bank, or between resident and utility company. The application updates balances for each transaction, and each transaction is added to a blockchain ledger for trust and verification.

Once you create the application, you can expand it in several ways. For example, you can add specific permissions and participant access, set up real-time transactions among participants, and even integrate with IoT to read from power meters and distribute energy.


You will need to complete the following steps in this code pattern. See the readme file for full details.

  1. Clone the repo.
  2. Set up Hyperledger Fabric.
  3. Generate the Business Network Archive (BNA).
  4. Deploy to Hyperledger Fabric.
  5. Run the application.
  6. Create participants.
  7. Perform transactions.



  1. The administrator interacts with with the decentralized energy UI that comprises an Angular framework.
  2. The application processes user requests to the network through a REST API.
  3. The requests are implemented to the blockchain state database on Hyperledger Fabric v1.
  4. The REST API is used to retrieve the state of the database.
  5. The Angular framework gets data through GET calls to the REST API.