Hyperledger Fabric is a platform for distributed ledger solutions underpinnedby a modular architecture delivering high degrees of confidentiality,resiliency, flexibility, and scalability. It is designed to support pluggableimplementations of different components and accommodate the complexity andintricacies that exist across the economic ecosystem.
We recommend first-time users begin by going through the rest of theintroduction below in order to gain familiarity with how blockchains workand with the specific features and components of Hyperledger Fabric.
Once comfortable — or if you’re already familiar with blockchain andHyperledger Fabric — go to Getting Started - Install and from there explore thedemos, technical specifications, APIs, etc.
What is a Blockchain?¶
A Distributed Ledger
At the heart of a blockchain network is a distributed ledger that records allthe transactions that take place on the network.
A blockchain ledger is often described as decentralized because it is replicatedacross many network participants, each of whom collaborate in its maintenance.We’ll see that decentralization and collaboration are powerful attributes thatmirror the way businesses exchange goods and services in the real world.
In addition to being decentralized and collaborative, the information recordedto a blockchain is append-only, using cryptographic techniques that guaranteethat once a transaction has been added to the ledger it cannot be modified.This property of “immutability” makes it simple to determine the provenance ofinformation because participants can be sure information has not been changedafter the fact. It’s why blockchains are sometimes described as systems of proof.
Smart Contracts
To support the consistent update of information — and to enable a whole host ofledger functions (transacting, querying, etc) — a blockchain network uses smartcontracts to provide controlled access to the ledger.
Smart contracts are not only a key mechanism for encapsulating informationand keeping it simple across the network, they can also be written to allowparticipants to execute certain aspects of transactions automatically.
A smart contract can, for example, be written to stipulate the cost of shippingan item where the shipping charge changes depending on how quickly the item arrives.With the terms agreed to by both parties and written to the ledger,the appropriate funds change hands automatically when the item is received.
Consensus
The process of keeping the ledger transactions synchronized across the network —to ensure that ledgers update only when transactions are approved by the appropriateparticipants, and that when ledgers do update, they update with thesame transactions in the same order — is called consensus.
You’ll learn a lot more about ledgers, smart contracts and consensus later. Fornow, it’s enough to think of a blockchain as a shared, replicated transactionsystem which is updated via smart contracts and kept consistentlysynchronized through a collaborative process called consensus.
Why is a Blockchain useful?¶
Today’s Systems of Record
The transactional networks of today are little more than slightly updatedversions of networks that have existed since business records have been kept.The members of a business network transact with each other, but they maintainseparate records of their transactions. And the things they’re transacting —whether it’s Flemish tapestries in the 16th century or the securities of today— must have their provenance established each time they’re sold to ensure thatthe business selling an item possesses a chain of title verifying theirownership of it.
What you’re left with is a business network that looks like this:
Modern technology has taken this process from stone tablets and paper foldersto hard drives and cloud platforms, but the underlying structure is the same.Unified systems for managing the identity of network participants do not exist,establishing provenance is so laborious it takes days to clear securitiestransactions (the world volume of which is numbered in the many trillions ofdollars), contracts must be signed and executed manually, and every database inthe system contains unique information and therefore represents a single pointof failure.
It’s impossible with today’s fractured approach to information andprocess sharing to build a system of record that spans a business network, eventhough the needs of visibility and trust are clear.
The Blockchain Difference
What if, instead of the rat’s nest of inefficiencies represented by the “modern”system of transactions, business networks had standard methods for establishingidentity on the network, executing transactions, and storing data? Whatif establishing the provenance of an asset could be determined by lookingthrough a list of transactions that, once written, cannot be changed, and cantherefore be trusted?
That business network would look more like this:
This is a blockchain network, wherein every participant has their own replicatedcopy of the ledger. In addition to ledger information being shared, the processeswhich update the ledger are also shared. Unlike today’s systems, where aparticipant’s private programs are used to update their private ledgers,a blockchain system has shared programs to update shared ledgers.
With the ability to coordinate their business network through a shared ledger,blockchain networks can reduce the time, cost, and risk associated with privateinformation and processing while improving trust and visibility.
You now know what blockchain is and why it’s useful. There are a lot of otherdetails that are important, but they all relate to these fundamental ideas ofthe sharing of information and processes.
What is Hyperledger Fabric?¶
The Linux Foundation founded the Hyperledger project in 2015 to advancecross-industry blockchain technologies. Rather than declaring a singleblockchain standard, it encourages a collaborative approach to developingblockchain technologies via a community process, with intellectual propertyrights that encourage open development and the adoption of key standards overtime.
Hyperledger Fabric is one of the blockchain projects within Hyperledger.Like other blockchain technologies, it has a ledger, uses smart contracts,and is a system by which participants manage their transactions.
Where Hyperledger Fabric breaks from some other blockchain systems is thatit is private and permissioned. Rather than an open permissionless systemthat allows unknown identities to participate in the network (requiring protocolslike “proof of work” to validate transactions and secure the network), the membersof a Hyperledger Fabric network enroll through a trusted Membership Service Provider (MSP).
Hyperledger Fabric also offers several pluggable options. Ledger data can bestored in multiple formats, consensus mechanisms can be swapped in and out,and different MSPs are supported.
Hyperledger Fabric also offers the ability to create channels, allowing a group ofparticipants to create a separate ledger of transactions. This is an especiallyimportant option for networks where some participants might be competitors and notwant every transaction they make — a special price they’re offering to some participantsand not others, for example — known to every participant. If two participantsform a channel, then those participants — and no others — have copies of the ledgerfor that channel.
Shared Ledger
Hyperledger Fabric has a ledger subsystem comprising two components: the worldstate and the transaction log. Each participant has a copy of the ledger toevery Hyperledger Fabric network they belong to.
The world state component describes the state of the ledger at a given pointin time. It’s the database of the ledger. The transaction log component recordsall transactions which have resulted in the current value of the world state;it’s the update history for the world state. The ledger, then, is a combinationof the world state database and the transaction log history.
The ledger has a replaceable data store for the world state. By default, thisis a LevelDB key-value store database. The transaction log does not need to bepluggable. It simply records the before and after values of the ledger databasebeing used by the blockchain network.
Smart Contracts
Hyperledger Fabric smart contracts are written in chaincode and are invokedby an application external to the blockchain when that application needs tointeract with the ledger. In most cases, chaincode interacts only with thedatabase component of the ledger, the world state (querying it, for example), andnot the transaction log.
Chaincode can be implemented in several programming languages. Currently, Go, Node.js, and Java chaincode are supported.
Privacy
Depending on the needs of a network, participants in a Business-to-Business(B2B) network might be extremely sensitive about how much information they share.For other networks, privacy will not be a top concern.
Hyperledger Fabric supports networks where privacy (using channels) is a keyoperational requirement as well as networks that are comparatively open.
Consensus
Transactions must be written to the ledger in the order in which they occur,even though they might be between different sets of participants within thenetwork. For this to happen, the order of transactions must be establishedand a method for rejecting bad transactions that have been inserted into theledger in error (or maliciously) must be put into place.
This is a thoroughly researched area of computer science, and there are manyways to achieve it, each with different trade-offs. For example, PBFT (PracticalByzantine Fault Tolerance) can provide a mechanism for file replicas tocommunicate with each other to keep each copy consistent, even in the eventof corruption. Alternatively, in Bitcoin, ordering happens through a processcalled mining where competing computers race to solve a cryptographic puzzlewhich defines the order that all processes subsequently build upon.
Hyperledger Fabric has been designed to allow network starters to choose aconsensus mechanism that best represents the relationships that exist betweenparticipants. As with privacy, there is a spectrum of needs; from networksthat are highly structured in their relationships to those that are morepeer-to-peer.