IBM Blockchain 101: Quick-start guide for developers
How to deploy a blockchain network and start coding
Join the blockchain revolution! This developerWorks quick-start guide is for application developers who are getting familiar with blockchain technology and want to quickly try building and interacting with blockchain networks. We show you how to deploy a blockchain network using the latest Hyperledger Fabric v1.0 framework, write chaincode (business rules for your network), and develop client applications to streamline your business processes and digital interactions.
Let's start with a quick review of what a blockchain network is and the role of Hyperledger Fabric.
Blockchain for business
Simply put, a blockchain network is a decentralized system for the efficient and secure exchange of business assets. It uses a shared, distributed ledger for recording the history of asset transactions between members and for cataloging the current state (world state) of those assets.
Instead of relying on a central authority or trusted intermediary, such as a bank or brokerage firm, a blockchain network uses a consensus mechanism as a basis of trust, accountability, and transparency for all participants in the network. For additional confidentiality, members can join specific channels that allow for data isolation; a channel-specific ledger is shared across the authenticated peers in the 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. In other words, it's a permissioned network, where the participants are known to each other. It's widely known that blockchain technology underpins the bitcoin network. But the bitcoin network is non-permissioned, and thus 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.
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, hosted by The Linux Foundation's Hyperledger Project. 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
Deploy a blockchain network
With concepts under your belt, the first step is to deploy a blockchain network where you can practice developing, testing, and deploying your code. You can deploy a blockchain network in several ways: with IBM Blockchain on Bluemix®, with the Hyperledger Fabric code base on GitHub, or with the IBM-signed Docker images (with IBM support available for purchase).
Option 1: IBM Blockchain on Bluemix
This free, fully managed blockchain-as-a-service on Bluemix (a limited beta for non-production use) is based on the latest Hyperledger Fabric v1.0 architecture. It provides an easy mechanism to quickly spin up a business network on the IBM Cloud in minutes.
The network you build runs in a highly secured environment on IBM LinuxONE™. The network peers and resources (orderers, Certificate Authority, source code, and ledger) are all contained in an IBM Secure Service Container (SSC). You can immediately write and test chaincode (business rules) without having to design and configure a private blockchain network. Members in the network can provision their own peers and resources, and create private channels for data and asset transfer.
To sign up for the beta of IBM Blockchain on Bluemix:
- Visit the IBM Blockchain page in the Bluemix catalog.
- Under Pricing Plans, select High Security Business Network vNext (Limited Beta).
- Click Create. On the form, sign up with your company name and reason for giving the beta a try.
Option 2: Hyperledger Fabric code base on GitHub
Alternatively, if you prefer to work locally, you can clone the Hyperledger Fabric code base directly from GitHub and expedite the startup, configuration, and testing process with Docker scripts. Following these instructions will lead to a fully functional blockchain network:
Option 3: IBM-signed Hyperledger Fabric images on Docker Hub
A third option is to use the Docker images for Hyperledger Fabric that are signed, certified, and supported by IBM (for purchase). These images are based on Hyperledger Fabric v1.0 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 Docker Hub repo
- Learn more about the IBM Blockchain Docker images
- Build your first network
- Purchase technical support through Passport Advantage
Write and test simple chaincode
Chaincode is a piece of code that encodes assets and the transaction instructions (business logic) for modifying the assets. Whenever you invoke a transaction, you're calling a function in chaincode that reads and writes values to the ledger. Chaincode is written in Go (GoLang), and is installed and instantiated through an SDK or CLI onto the network of peer nodes.
- Chaincode for developers
- Testing new chaincode
- Hyperledger Fabric chaincode samples
- Installing the samples
Write and deploy client apps that invoke chaincode
Once you have a blockchain network with registered chaincode, you can build client applications that will read, write, and invoke the business rules you have written into the chaincode. Applications on a blockchain network enable users to query the ledger (ask for specific records it contains) and update it (add records to it).
The Hyperledger Fabric Client SDK provides a powerful and easy way to use a library of APIs to allow applications to interact with a Hyperledger Fabric blockchain. Node.js applications that leverage the HFC SDK can be used to perform the following network tasks:
- Securely register and enroll users. A web application administrator with registrar authority can dynamically register and enroll users who have authenticated to the web application.
- Submit transactions to the blockchain network (install/instantiate, deploy, invoke, and query).
- Store sensitive private keys and certificates in any location, such as an off-blockchain database. This requires implementing a simple key-value store interface.
Option 1: Writing and deploying client apps to Bluemix
Follow these instructions to use the Hyperledger Fabric Client SDK APIs to interact with a blockchain network on Bluemix:
Option 2: Writing and deploying client apps against a Hyperledger Fabric network
Alternatively, follow these steps to use the Hyperledger Fabric Client SDK to write an application that will interact with a Hyperledger Fabric network running locally on your machine.
Monitor and manage your blockchain network and apps on Bluemix
With IBM Blockchain on Bluemix, a built-in dashboard provides a friendly tool to keep tabs on your blockchain network and applications. See an overview of your blockchain environment, including performance data, active chaincode, and network resources. Use the monitor to manage your network components.
Get help and support
There are lots of ways to get support and answers to your questions.
- For help with IBM Blockchain on Bluemix:
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 Bluemix 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.
- Blockchain Developer Center
- Blockchain basics: Introduction to distributed ledgers
- Blockchain basics: Glossary and use cases
- Blockchain essentials (free course for developers)
- Blockchain solutions and services from IBM
- Hyperledger Composer
- Hyperledger Fabric
- Hyperledger Fabric application samples
- Hyperledger community