Create a to-do list app using blockchain  

Create a web-based to-do list application using Hyperledger Fabric V1.0

Last updated | By Ishan Gulhane, Kevin Hoyt

Description

Hyperledger Fabric is a shared, immutable ledger for recording the history of transactions; it’s fostering a new generation of transactional applications. This pattern shows you how to perform traditional data store transactions with blockchain and migrate from Hyperledger Fabric v0.6 to v1.0. You’ll implement a web-based to-do list application that enables you to browse, read, edit, add, and delete list items.

Overview

This developer pattern helps you understand how developers perform common transactions of creating, reading, updating and deleting against a Hyperledger Fabric blockchain. It also helps you migrate from Hyperledger Fabric V0.6 to Hyperledger Fabric V1.

This web-based client is designed around Polymer 2 Release Candidate, which acts as a polyfill for assorted web components specifications. These specifications include Custom Elements, Shadow DOM, HTML Imports, and HTML Templates. As Hyperledger Fabric supports cross-origin resource sharing (CORS) out of the box, the web client communicates directly via HTTP/JSON.

As requests arrive on Hyperledger Fabric, they are mapped to a specific smart contract written in Go. There are two types of requests that can be made. The first is an invoke request, which will take place asynchronously on Hyperledger Fabric, returning only a transaction identifier. The second is a query request which will return some value. This project uses invoke requests for create, update, and delete operations, and query requests for read operations.

The to-do list application that you will create is designed to help you understand how common transactions needed by business processes can be adapted to use blockchain. Remember: blockchain does not equal Bitcoin! (Although it might be said that Bitcoin is one of the first true blockchain applications.) As a distributed ledger, blockchain’s distinct characteristics, such as decentralization, consensus, and encryption, have broad-reaching implications to many businesses and organizations, including finance, transportation, health care, and more.

Flow

  1. The user interacts with the to-do client application in their browser.
  2. When the user performs any action, the application calls the server application API where the registered admin interacts with the Hyperledger Blockchain Network.
  3. Reading or writing the ledger is called a proposal. The proposal is built by the to-do app server (through the SDK) and then sent to a blockchain peer.
  4. The peer communicates to its to-do chaincode container (CC). The chaincode will run/simulate the transaction. If there are no issues, it endorses the transaction and sends it back to the to-do application.
  5. Using the SDK, the to-do app sends the endorsed proposal to the ordering service. The orderer packages many proposals from the whole network into a block.
  6. The orderer broadcasts the new block to peers in the network.
  7. The peer validates the block and writes it to its ledger. The transaction has now taken effect and any subsequent reads will reflect this change.

Related Blogs

Leveraging the power of AI at Unite Berlin

Last week, from June 19 – 21, we were at Unity’s premiere in Berlin: Unite 2018. This conference brought together Unity’s video game and development community. Unity touches 770 million gamers all over the world and is the market leader for consumer AR and VR use cases and is also rapidly emerging as the market...

Continue reading Leveraging the power of AI at Unite Berlin

Apps without privacy issues: Creating a blockchain wellness app on the cloud

Kubecoin takes fitness data directly from the phone health kit and places transactions on the "Kubechain." The app works anonymously and assigns a made-up identity to you, along with a randomly generated avatar. Your data can’t be traced to you, but you'll be able to see where your assigned avatar ranks on our leaderboard.

Continue reading Apps without privacy issues: Creating a blockchain wellness app on the cloud

Related Links

Blockchain courses

Get started with blockchain essentials with these learning resources from developerWorks.

IBM Blockchain

Discover enterprise-level production-ready blockchain services.