IBM Blockchain 101: Quick-start guide for developers
Create your first blockchain network and start coding applications
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®.)
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.
- Introduction to distributed ledgers
- Blockchain glossary and use cases
- Blockchain essentials (free course for developers)
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.
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.
- Welcome to Hyperledger Fabric (full documentation)
- Key concepts
- Top 6 technical advantages of Hyperledger Fabric
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:
- 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 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.
- Get the images from the IBM Blockchain DockerHub repo
- Learn more about the IBM Blockchain Docker images
- Purchase technical support through Passport Advantage
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.
- Develop your blockchain application in the web playground, locally, or in the cloud
- See the Hyperledger Composer Playground tutorial
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.
- Activate your blockchain network on the IBM Blockchain Platform (Enterprise membership plan)
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:
- Read the Chaincode for developers tutorial
- Test your chaincode
- Get Hyperledger Fabric chaincode samples
- Install and instantiate chaincode
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:
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.
- Write your first application
- Get Hyperledger Fabric application samples
- Install the samples
- Get the Hyperledger Fabric SDKs
- Host your application on 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:
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.
Get help and support
There are lots of ways to get support and answers to your questions.
- 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.
- For general blockchain questions:
Search dW Answers. Browse questions that have already been asked, or submit a new question (include the keyword blockchain).
- For specific Hyperledger Fabric implementation questions:
The Hyperledger Rocket.Chat channels and Stack Overflow are your best bets.
- For more help with Hyperledger:
Browse the Hyperledger Channel Guide and join the discussion group suited to your question.
Help build the Hyperledger Fabric
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).
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.
The authors thank Joshua Horton of IBM for his significant technical contributions to earlier iterations of this material.
- Blockchain Developer Center
- Blockchain basics: Introduction to distributed ledgers
- Blockchain basics: Glossary and use cases
- Blockchain essentials (free course for developers)
- Blockchain Explained (29 sequential videos)
- Blockchain Solutions (3 sequential videos)
- Blockchain Composed (4 sequential videos)
- Blockchain solutions and services from IBM
- Hyperledger Composer
- Hyperledger Fabric
- Hyperledger Fabric application samples
- Hyperledger community