Technical Introduction to Hyperledger Fabric
Open Blockchain: background
Hyperledger is a secure, open-source, automated, peer-to-peer, blockchain-based ledger system with potential in dozens (perhaps hundreds) of use cases. It was launched under the governance of the Linux Foundation in December 2015. IBM’s Open Blockchain (OBC) looks to be a key component of the project, according to presentations at a recent Hyperledger meetup in New York.
Open Blockchain was recently open-sourced and forms a core part of the proposed Hyperledger incubation. This part is now called Fabric and available at GitHub. Digital Asset Holdings (DAH) and Blockstream have also made contributions to the project.
The meetup in NYC included a technical introduction to Hyperledger Fabric (ex-Open Blockchain), with Renat Khasanshyn and Sergey Matykevich of Altoros addressing specific aspects of the framework.
The city was also the site of a recent Hyperledger face-to-face (F2F) meeting held over a few days to work on requirements, code, and an implementation to be incubated under the auspices of the Linux Foundation.
Why Hyperledger and not Ethereum?
At the meetup, the question at hand was “why?” Why Fabric (OBC) and not, for example, the Ethereum implementation of blockchain, which has gained a lot of recent notice?
An objection to Ethereum, according to Renat Khasanshyn (CEO at Altoros), is its establishment under the General Public License (GPL), which can restrict forkers of the original technology from protecting their unique work down the road.
OBC has been open-sourced, in contrast, by IBM on GitHub without GPL restrictions, which is attractive for a few reasons:
- Its existence in this time of an increasing demand for permissioned networks. Some users and use cases require validating or non-validating nodes to be controlled or sometimes just sponsored by selecting whitelisted organizations.
- Many network operators want transactors on network to obtain an identity from an issuing authority service on the network.
- There is a need for private networks as well as public ones.
- Many network operators want to keep identity and patterns of behavior completely private, inaccessible for third parties.
In a world of many networks, OBC’s potential for performance and scalability are also attractive in these early days of blockchain development.
IBM’s OBC is not the only contribution to Hyperledger. Major contributions are also coming from Digital Asset Holdings (DAH) and Blockstream in the first incubation project being proposed through the Linux Foundation, which oversees the Hyperledger Project.
How Hyperledger Fabric works
Sergey Matykevich, Senior Cloud Engineer at Altoros, then led attendees through a slide presentation that demonstrated with some code and graphics how to address the problems described above.
The process starts with creating two validation peers (VP1 and VP2).
After adding a third validation peer (VP3), Sergey moved on to deploying and distributing the application, then deploying the chaincode and executing a transaction.
According to the demo, the app and chaincode can be deployed by running these commands.
vagrant ssh cd $GOPATH/src/github.com/openblockchain/obc-peer export OPENCHAIN_PEER_ADDRESS=172.17.0.2:30303 ./obc-peer chaincode deploy -p github.com/openblockchain/obc- peer/examples/chaincode/go/map -c '{"Function":"init", "Args": []}'
The following code is responsible for executing a transaction.
./obc-peer chaincode invoke -n-c '{"Function":"put", "Args": ["key1", "val1"]}' /obc-peer chaincode query -n -c '{"Function":"get", "Args": ["key1"]}'
Peer discovery
Sergey outlined how peer discovery works:
- VP2 sends the
DISC_HELLO
message to its root discovery node (VP1). - VP1 replies.
- Nodes start “chatting”—periodically sending
DISC_GET_PEERS
(asking to share active connections). - Each node should reply with
DISC_PEERS
(list of connections). - After node receives new connections, it starts chatting with them.
Details of the Hyperledger Project can be found here. There are also a GitHub repo, Wiki, and a Slack channel.
Want details? Watch the video!
These are the slides for the technical overview of OBC (Fabric) presented at the Hyperledger NYC meetup.
Further reading
- Hyperledger Technical F2F Meeting Draws Crowd, Gets Some Work Done
- Digital Asset Contributes an Enterprise Blockchain Server to Hyperledger