Taxonomy Icon

Blockchain

Interacting with a blockchain network

Get the code View the demo

Summary

Welcome to the second in the series of five patterns that builds a complete end-to-end blockchain application. Developing a blockchain app entails several steps to stand up a network, create chaincode to define the type of transactions supported, then use an application to test the network and its rules. You can do that last step via exposing the transactions through REST APIs or you can build a simple application. In this developer pattern, you will learn how to go the application route to execute transactions and requests against a blockchain network.

Description

Blockchain is a trending technology that every developer should get to know. The technology certifies the authenticity of transactions by all participants in the network. There are neither intermediaries nor regulations other than the established contracts that come with the setup of the network.

Once you have your network, with participants and transactions defined, the next step is to create an application that tests that the network is set up correctly and operates as expected. One might call this a unit test, which repeatedly exercises the functionality of code. You should always build test cases to verify the logic of your code. In this case, you want to ensure that each participant can only execute transactions defined for that participant. Additionally, you want to validate that all the transactions are working as expected. This effort is fundamental to the development lifecycle process.

This developer code pattern helps you take what you built in the first step of this composite pattern, testing out the transactions. If you haven’t deployed the network in step 1, check out Explore Hyperledger Fabric through a complete set of APIs and set it up now. Then you are ready for this pattern, where you will build the application, deploy it, and step through issuing transactions.

Flow

flow

  1. Run a build script that launches the network in three steps.
  2. Ensure that all old Docker images are removed so you build the network from a clean system.
  3. Generate the cryptographic material. The crypto configuration file (crypto-config.yaml) defines the identity of who is who. It tells peers and orderers what organization and domain they belong to. It then initializes a blockchain network or channel and services with an Orderer Genesis Block, which serves as the first chain block. Membership services are installed on each channel peer.
  4. Install the chaincode on the peers and build the Docker images of the orderer, peers, channel, and network.
  5. Launch the network.
  6. View transaction logs.
  7. Perform transactions using the web application.
  8. View results of transactions in the web application.

Instructions

To put this code pattern to use, see the complete details on how to get started are in the README.