Tech Tuesday: Blockchain – Differences between Ethereum and Hyperledger Fabric
4 July 2017 |
Adam Kempner | About a 9 minute read
In the previous post of our series (here) we have given an overview of how blockchain works. In this post we will go through the differences between two major platforms in blockchain – Ethereum and Hyperledger. If you are contemplating which one to use in your project. This blog sheds a little light and hopefully help you to decide. But before we get into detail:
What is a blockchain network?
It is a decentralised system for the exchange of business assets. It uses shared distributed ledger that records all the transactions between the members of the network. It is made up of connected nodes (computers) that individually store the blockchain code. Networks can be public or permissioned and this will determine how a node communicates with other nodes on the network (peer to peer communication).
I will now aim to explain some of the common key concepts in blockchain technology:
Distributed Ledger/Shared Ledger – A ledger is a type of database, but unlike traditional databases, distributed ledgers have no central data store or administration functionality. Changes to the ledger are recorded across the participating systems in a matter of minutes or seconds and records are protected through cryptography. An important benefit of a distributed ledger is that assets can be tracked and traded without the need for a centralised point of control. Another key benefit is that the consensus mechanism used in distributed ledgers lowers the risk of fraud. This can be treated as single source of truth within a network.
Block – A block contains a collection of data. For example, In bitcoin a block is a collection of transactions.
Node – A node is a communication entity that is participating in the global peer-to-peer network. They propagate blocks. There are 2 different kinds of nodes, which are as follows:
Full Nodes – They act independently as authoritative verifier of every single transaction on block. They generally keep full copy of the blockchain on its hard drive or they could also keep a reduced copy of the blockchain. It communicates with other peers on the network and more importantly it does not trust these peers and verifies the block (containing transactions) received from these peers. It authoritatively reconciles with its own copy of ledger. If it didn’t reconcile with any of the transaction it rejects the block and stop communicating with the peer that it received the block from. Hence, quickly the node that the malicious block is sent from is quickly isolated.
Light Nodes – They do not check or download the whole block chain.
Mining and Miner – Mining is an act of participating in a given peer to peer network in consensus. It is a computational intensive work that requires lot of processing power and time. Miner is an investor that devotes time, computer space and energy to sorting through blocks. In simple words mining means the process of making money by doing work. Ethereum is fuelled by ether. So miners (people who do mining) mine to make Ether. Mining can be done at every full node.
Smart contract – This is a collection of business rules (automated code) that is deployed on blockchain cryptocurrency network. Once nodes execute the contract, ledger is updated accordingly.
Consensus – This is a process of keeping the ledger transactions synchronised across the network. Consensus is implemented in different ways by different platforms.
Ethereum is an open software platform that enables developers to build and deploy decentralised applications. It is a public blockchain network. It aims at users interacting with social systems, financial systems in a peer to peer fashion.
Ethereum has it’s own crypto currency called Ether. Miners work to earn Ether. It has smart contracts that define rules and penalties around an agreement and also enforces those obligations. Currently, Ethereum uses proof of work protocol and the plan is to update its network to proof of stake.
What is proof of work (POW) and how does it work?
It is a consensus Algorithm. This algorithm permit nodes of the blockchain to reach consensus about the current state of the blockchain. Consensus on the global state is reached approximately every 15 seconds on Ethereum.
How does this work?
When a new block arrives to the node, it gets the hash of that block and then tries to validate. It uses POW consensus algorithm that takes lot of computational power to generate some random bits. When the generated random bits are appended to the hash of the block, it gives certain value (new hash). Node already knows the hash value it is looking for. If the generated value matches the expected answer then the block is valid.
Nodes keep trying with random bits by appending with hash obtained from transaction block. Once any of the miners find the answer then the block will be added to block chain.
Issues with proof of work
- It requires lot of computational power (CPU cycles, GPU, electricity) to get random bits
- Tragedy of the commons – Miners reward reduces over time, when this occurs less miners will mine these blocks. This could open up window for malicious users who can easily acquire more than 51% of network and thus destroying the network
Ethereum is trying to switch from proof of work to proof of stake consensus algorithm.
Proof of stake – It requires to show the ownership of the money. You no longer have to do lot of calculations, which saves lot of energy and the second advantage is you lock up ether which creates scarcity. Hence the price would go up, this means only miners who has ether (Ethereum currency) would be able to validate blocks. If malicious validators validate false nodes they lose ether.
Hyperledger is an umbrella project under the Linux Foundation founded in 2015. It seeks to foster collaboration on blockchain projects across multiple companies.There are multiple projects within Hyperledger and there are several platform implementations of hyperledger.
These are as follows:
- Fabric from IBM
- Sawtooth Lake from Intel
- R3 form Corda
So far I have not got the opportunity to look into other platform implementation apart from Hyperledger fabric. Hence, I will consider Hyperledger Fabric to compare with Ethereum.
HyperLedger Fabric focus more on larger organisations, while Ethereum is more popular with smaller apps and smart contracts on its public. HyperLedger Fabric aims to create a permission blockchain specifically for corporate use. One of the important features for corporates are data secrecy and privacy. Fabric manage distributed ledger through peer to peer protocol built on HTTP/2. It uses smart contracts to provide controlled access to the ledger, these smart contracts can be written in go or java languages.There is no crypto-currency for hyper ledger.
Some of the key concepts in hyper ledger fabric are: Ledger, Block, Chaincode, Consensus, Member, Membership services, Multi-channel, peer, transaction, policy, private channels.
We have explained the terms Ledger, Block, Consensus earlier. I will go through the rest of the terms that are specific to fabric.
Membership Services: Membership Services authenticates, authorises, and manages identities on a permissioned Hyperledger fabric network. The membership services code that runs in peers authenticates and authorizes blockchain operations.
Peer: A network entity that maintains a ledger and runs chaincode containers in order to perform read/write operations to the ledger. Peers are owned and maintained by members.
Policy: There are policies for endorsement, validation, block committal, chaincode management and network/channel management. Policies are defined through system chaincode, and contain the requisite specifications for a network action to succeed. For example, an endorsement policy may require that 100% of endorsers achieve the same result upon transaction simulation.
Transaction: An invoke or instantiate operation. Invokes are requests to read/write data from the ledger. Instantiate is a request to start a chaincode container on a peer.
Chaincode: This is smart contract in hyper ledger.
Private Channels : A Hyperledger Fabric channel is a private “subnet” of communication between two or more specific network members for the purpose of conducting private and confidential transactions. A channel is defined by members (organisations). Each party must be authenticated and authorised to transact on that channel. Each peer that joins a channel, has its own identity given by a membership services provider (MSP), which authenticates each peer to its channel peers and services.
Modular Consensus : Different industries have their own networks or even sub networks within a network. Hyperledger provides solutions for these requirements by providing pluggable consensus. Currently, it offers PBFT(Practical Byzantine Fault Tolerance) and developer communities are actively working on different consensus mechanism.
Performance and scalability : Ledgers must be able to operate continuously until its lifetime. It should allow discoverability, search, identity resolution and perform other key functions. Even the number of nodes will increase over time. Hence, performance is a key factor and Fabric is capable of scaling efficiently without any performance degradation.
The figure below shows Hyperledger logical architecture aligned in their categories:
Below is an equities market example from IBM Hyperledger fabric where it depicts uniform distributed ledger at the centre
Asset Custodian (bank), Front Office, Operations, securities depository (CSD) and a clearing party (Clearing/CCP):
Below explains the steps in the diagram above
- Using a client application, the custodian invokes chaincode to buy and sell blocks of securities
- Transactions can be triggered from any network node, but are always forwarded to the primary (leading) validating node, which orders the transactions. The primary node broadcasts the ordered transactions to all validating peers for consensus, or agreement, on the proposed order
- If the order of transactions is agreed upon, the transactions are executed and appended to the ledger on each validating node. The ledger is then replicated to all network nodes.
To sum up, some of the key features of Hyperledger Fabric are:
- Hyperledger fabric enables permissioned network, its membership identity services manages access to the participants on the network
- It provides privacy to the groups that required private confidential transactions
- Chaincode contain logic that provides specific types of transactions to the channel (ex:- Change of asset ownership) and ensures that all the transactions comply with the rules and requirements that are defined
- It is efficiently scalable without any performance degradation
The table below lists the differences between Hyperledger Fabric and Ethereum:
Read More From This Author
After going through the differences I feel that the distinction between hyperledger Fabric and Ethereum is similar to that of intranet and internet. I hope this blog offered you a bit of insight on the differences between ethereum and hyperledger fabric.
Professionalising Digital Consultant
The Professionalising Digital Consultant is key member of the digital transformation team, helping our clients with their digital maturity journey and helping ANDigital grow the professionalising digital service.I'm Interested
Leader in Product Delivery AND passionate about developing others.I'm Interested