Contents


IBM Blockchain 101: Quick-start guide for developers

Create your first blockchain network and start coding applications

Comments

Join the blockchain revolution! This developerWorks quick-start guide is for application developers who are exploring blockchain technology and want to quickly develop a blockchain network and deploy applications.

Simple instructions show you how to activate a blockchain network based on the latest Hyperledger Fabric framework, write and install chaincode (business logic for the network), and develop client applications to streamline business processes and digital interactions. (Hyperledger Fabric™ is a Hyperledger® project hosted by The Linux Foundation®.)

Concepts

Let's start with a quick summary a blockchain for business use, the Hyperledger Fabric framework, and the IBM Blockchain Platform.

Blockchain for business

Simply put, a blockchain network is a decentralized system for the efficient and secure exchange of business assets. A shared, distributed ledger records an immutable history of asset transactions between members of the network, and catalogs the current state (world state) of those assets. The business rules that govern transactions are encoded in smart contracts, also known as chaincode.

Instead of relying on a central authority or trusted intermediary, such as a bank or brokerage firm, to validate transactions, members of a blockchain network use a consensus mechanism as a basis of ensuring trust, accountability, and transparency across the network. For additional confidentiality, members join one or more channels that allow for data isolation; a channel-specific ledger is shared across the authenticated peers in that channel.

A blockchain network for business is collectively owned and operated by a group of identifiable and verifiable institutions, such as a business or university, for example. It's a permissioned network, where the participants are known to each other. Blockchain technology underpins the bitcoin network, but the bitcoin network is non-permissioned, which makes it poorly suited to business use cases. It has no identifiable ownership structure and is operated by a community of participants that may or may not be identifiable.

The IBM Blockchain Platform

The IBM Blockchain Platform is the only fully integrated enterprise-ready blockchain platform designed to accelerate the development, governance, and operation of a multi-institution business network. The Platform is built on the latest Hyperledger Fabric code base, whose modular architecture ensures enterprise-level security, data integrity, scalability, and performance.

Hyperledger Fabric

To meet the demands of modern markets, IBM and other companies are collaborating to develop an open source, industry-focused implementation of blockchain technology for business use, called Hyperledger Fabric, one of the Hyperledger projects hosted by The Linux Foundation. Hyperledger Fabric is a framework for distributed ledger solutions on permissioned networks. Its modular architecture maximizes the confidentiality, resilience, flexibility, and scalability of your blockchain solutions.

1

Create a blockchain network

With concepts under your belt, the first step is to create a blockchain network where you can practice developing, testing, and deploying your code. You can create a blockchain network in several ways:

Local options:

  • Option 1: On your local machine, using the Hyperledger Fabric code base on GitHub
  • Option 2: On your local machine, using the IBM-certified Hyperledger Fabric images on DockerHub, which includes IBM support available for purchase

IBM Cloud options:

  • Option 3: Using the IBM Bluemix Container Service
  • Option 4: Using the IBM Blockchain Platform

Option 1: Hyperledger Fabric code base on GitHub

One local option is to clone the Hyperledger Fabric code base directly on GitHub and expedite the startup, configuration, and testing process with Docker scripts. Following these instructions will lead to a fully functional blockchain network:

Option 2: IBM-signed Hyperledger Fabric images on DockerHub

Another local option is to use the Docker images for Hyperledger Fabric that are signed and certified by IBM. These images are based on the latest Hyperledger Fabric and include enhancements for serviceability. The images undergo rigorous testing for functionality, stability, and performance on z Systems and LinuxONE (s390), Power (ppc64le), and x86. Technical support from IBM is available for purchase when using these images.

Option 3: IBM Bluemix Container Service

A cloud-based option is to launch your blockchain network inside a Docker container. A container is a standard way to package code so it can be moved between environments and run without changes.

Follow these instructions to set up the IBM Blockchain Platform for Developers on the IBM Container Service. You'll first prepare a cluster on the IBM Container Service to deploy to, and then you'll deploy a default development environment in a single script. The script will bootstrap a blockchain network, join peers to a channel, and launch the Hyperledger Composer playground. The Hyperledger Composer playground is a tool for quickly creating, editing, and testing a blockchain network. The hosted version (Online Playground) runs your network in browser memory.

Option 4: IBM Blockchain Platform

Another cloud-based option is to activate your blockchain network on the IBM Blockchain Platform. This enterprise-ready blockchain platform makes it easy to activate and manage a secure business network across multiple organizations. Best of all, it’s powered by open source technology from Hyperledger Fabric and Hyperledger Composer, paving the way for collaborative application development in your preferred environment.

2

Write and install simple chaincode

Chaincode defines the business policy and transactional instructions for creating and modifying assets in a channel's ledger. Because chaincode typically handles business logic agreed to by members of the blockchain network, chaincode is also called a smart contract. In a Hyperledger Fabric-based blockchain, the two terms are synonymous.

Chaincode runs in a Docker container that is associated with any peer that needs to interact with it. Chaincode is written in Go, and is installed and instantiated through an SDK or CLI onto the network of peers. Whenever you invoke an asset transaction, you're calling a function in chaincode that reads and writes values to the ledger.

Option 1 (Local): Writing and installing chaincode

These instructions and samples will help you write and install your chaincode on a local blockchain network running Hyperledger Fabric:

Option 2 (IBM Cloud): Installing chaincode for a network created using the IBM Blockchain Platform

You can deploy your chaincode directly to the network through a REST interface:

3

Write and deploy client-side applications that invoke chaincode

Once you have a blockchain network with registered chaincode, you can write Node.js and Java™applications that will invoke chaincode to query or update a channel-specific ledger in your blockchain network.

The Hyperledger Fabric Client SDKs provide a powerful and easy way to use a library of APIs to enable interaction between your application and your network. Applications that leverage the HFC SDK can be used to perform the following network tasks:

  • Register and enroll members
  • Create channels and join peers to a channel
  • Install chaincode on peers, and instantiate chaincode on a channel
  • Call chaincode functions to update the ledger
  • Query the ledger for specific transactions, blocks, or keys
  • Monitor events on a channel, such as successful commitment of a transaction

Option 1 (Local): Writing and deploying client apps locally against a Hyperledger Fabric network

These instructions and samples will help you use the Hyperledger Fabric Client SDKs to write applications that interact with a Hyperledger Fabric network running locally on your machine. If you choose, you can push your application to the IBM Cloud.

Option 2 (IBM Cloud): Writing and deploying client apps to a network created using the IBM Blockchain Platform

These instructions and sample apps will help you use the Hyperledger Fabric Client SDK APIs to interact with a blockchain network:

4

Monitor and manage your network and apps on the IBM Blockchain Platform

On the IBM Blockchain Platform, a built-in dashboard provides a friendly tool to keep tabs on your blockchain network and applications. For any channel, you can view the block details, member information, and instantiated chaincode details.

5

Get help and support

There are lots of ways to get support and answers to your questions.

  1. For help with the IBM Blockchain Platform:
    Start at the Getting support page. From there, the Service status page will help you investigate known issues and find release notes for new commits of the Hyperledger Fabric code. And GitHub issues will help you reach the Blockchain development team so you can share details and code snippets from your specific instance.
     
  2. For general blockchain questions:
    Search dW Answers. Browse questions that have already been asked, or submit a new question (include the keyword blockchain).
     
  3. For specific Hyperledger Fabric implementation questions:
    The Hyperledger Rocket.Chat channels and Stack Overflow are your best bets.
     
  4. For more help with Hyperledger:
    Browse the Hyperledger Channel Guide and join the discussion group suited to your question.
6

Help build the Hyperledger Fabric

Get involved! Your contribution to the Hyperledger Fabric is welcome. Rocket.Chat is used for communication, and longer running discussions and decisions go to the mailing list.

Hyperledger Fabric's maintainers are responsible for reviewing and merging all patches submitted for review. They guide the overall technical direction within the guidelines established by the Hyperledger Project's Technical Steering Committee (TSC).

Next steps

We'll conclude this quick-start with three great ways to continue building your blockchain skills:

  • Stay in know with the Blockchain Newsletter from developerWorks. Check out the current issue and subscribe.
  • Stop by the Blockchain Developer Center on developerWorks. It's your source for free tools and tutorials, along with code and community support, for developing and deploying blockchain solutions for business.
  • Take the Blockchain essentials course for developers to learn the ins and outs of asset transfers. At the end of the free, self-paced course, take a quiz, get a badge, and start planning useful blockchain applications for your business network.

Acknowledgments

The authors thank Joshua Horton of IBM for his significant technical contributions to earlier iterations of this material.


Downloadable resources


Related topics


Comments

Sign in or register to add and subscribe to comments.

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Blockchain, Cloud computing
ArticleID=1038760
ArticleTitle=IBM Blockchain 101: Quick-start guide for developers
publish-date=08212017