Deploy an asset-transfer app using blockchain

Get the code Watch the Tech Talk

Summary

Learn the basics of chaincode and application development within a Hyperledger Fabric network by creating an asset-transfer app that enables you to transfer marbles between multiple owners.

Description

In this developer code pattern, you’ll learn how to migrate from Hyperledger Fabric v0.6 to v1.1. The Marbles application that you’ll build demonstrates a method of transferring marbles between many marble owners using Hyperledger Fabric. You’ll create the app using Node.js and the Go programming language; the back end for the app is written in Go running in a blockchain network. The chaincode will create a marble and store it in the chaincode’s managed state. The chaincode itself can store data as a string in a key/value pair setup. You’ll “stringify” JSON objects to store more complex structures.

Flow

flow

  1. The administrator interacts with Marbles, our Node.js application, through a browser.
  2. The client-side JavaScript code opens a websocket to the backend Node.js application and instructions are sent to the application from the browser.
  3. The proposal accesses the ledger to simulate a transaction. This proposal is built by Marbles (using the SDK) and then sent to a blockchain peer.
  4. The endorser (process on the peer) will endorse (or sign) the transaction if there are no issues.
  5. The SDK collects all the signed proposals and, if the policy is fulfilled, sends the transaction with the signed endorsements to the ordering service. The orderer service orders the transactions, creates a block, and delivers it to the appropriate peers.
  6. 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.

Instructions

Ready to put this code pattern to use? Complete details on how to get started running and using this application are in the README.