Taxonomy Icon

Blockchain

Create a decentralized energy network with Hyperledger Composer

Get the code View the demo

Summary

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.

Description

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.

Instructions

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.

Flow

flow

  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.