Ethereum vs Hyperledger Fabric

Beyond this catchy title, we will try to explain the main differences between public and private blockchains. We will assume that Ethereum (https://www.ethereum.org/) symbolizes public blockchains and Hyperledger Fabric (https://www.hyperledger.org/projects/fabric) private, or consortium blockchains. The reader should be familiar with basic blockchain concepts. If it’s not, you can have a quick catchup here : https://en.wikipedia.org/wiki/Blockchain

Genesis

Started in December 2013, the Ethereum project was designed to build public, blockchain-based, distributed applications. Rated at the top for distributed applications at the beginning, Ethereum rapidly was used for crypto-currencies, and at least for the Ether, which was used to pay for the platform’s services. The Ether became rapidly one of the most famous crypto-currency in the world.

Why Ethereum is so famous ? It’s the first blockchain to add a new dimension to the blockchain concept : smart-contracts.

To all new blockchain readers, a smart-contract is a piece of code stored in the blockchain. It allows to interact with the blockchain and dynamically validate or reject a transaction by executing this piece of code.

Following the success of Ethereum, other initiatives have emerged, like the Hyperledger initiative (consortium under the Linux Foundation) and its Fabric implementation. This blockchain joined the Hyperledger community in early 2016, following an initiative by IBM and Digital Asset. Like Ethereum, Hyperledger Fabric focus on building decentralized applications with smart-contracts (but called “chaincode”).

The main difference between Ethereum and Hyperledger Fabric is how these blockchains handle peers and data.

By design, Ethereum is a public blockchain, involving that everybody can be a part of the chain, acting as a peer. The peer will retrieve the full history of transactions, can upload smart contracts and propose new transactions.

On the other hand Hyperledger Fabric has been designed with the idea that all the blockchain concepts like distributed ledger, cryptography, immutability of data, smart contracts, traceability, etc… are great features but the openness of the system may discourage enterprises. Hyperledger Fabric is focused on how to manage the system, and grants special permissions to administrators to choose who can join the blockchain and which piece of data can be read or written.

Introduction

As stated previously, Ethereum is a “permissionless” Public blockchain. Meaning without any permission management. Public means that everyone can access to the data within the network. Permissionless means that everyone can connect to the network and interact with it with the same level of permission than every other peers.

One of the key feature of the Ethereum technology is the EVM (Ethereum Virtual Machine). It is a Virtual Machine built from scratch which act like a playground to whatever code of arbitrary algorithmic complexity. In computer science language we would say that it is “Turing Complete”. This EVM is used to run smart-contracts.

Since Ethereum is a public blockchain and since nobody is paying the infrastructure nor the maintenance costs; the EVM needs something called “gas” in order to run the smart-contracts. The “gas” can be considered as petrol for cars. Your car needs petrol as much as the Ethereum smart contract needs gas to run. It was created in order to prevent anyone to spam the blockchain from transaction and incentive blockchain miners.

For your record, inside the EVM every single operation costs gas.

If you want to run a smart-contract on the Ethereum BlockChain you will first need to provide some ETH (the Ethereum’s crypto-currency) in order to allow your smart contract to be executed by the network.

Once all the gas you own is exhausted, the EVM stops to execute your smart contract.

On the other side, Hyperledger Fabric is a permissioned blockchain, which means that administrators choose what is public, private and who can read or manipulate data in the blockchain.

The core idea of Hyperledger Fabric is to be able to build a modular architecture that fits your needs. This way, you can chose the consensus that you want or you need, you can choose the actors and entities who can read and write blocks, etc…

Since all the peers are nominated by the administrators of the blockchain, and since all the peers have a business interest to participate to the blockchain, there is no need for gas to makes things running.

That’s a big difference between Ethereum and Hyperledger Fabric. With Fabric you don’t need anymore any kind of cryptocurrency to run your smart contracts and handle transactions. Even if the blockchain infrastructure and maintenance, is not free !

Technical and Velocity

From the public Ethereum Blockchain

From a technical aspect the public Ethereum blockchain takes around 14 seconds to build a new block. So, if you send a new transaction or even nothing, a block will be created every 14 seconds. Every correct transactions will eventually be stored in a block but you don’t know exactly when. You can wait for 14 seconds or much more. However, keep in mind that if there is many applications running on the Ethereum blockchain, it will produce a lot of transactions through the network, thus decreasing performances. For instance, if UK decided to use the Ethereum blockchain to elect its next president, it would take about 40 days to process all transactions (Thanks Dominik Schiener for its analysis).

From a Private Ethereum Blockchain

Companies that need blockchains for their business but do not want to exhibit their data and smart contract to the public, Ethereum proposes to deploy a private instance of its infrastructure. This system is called “Private Ethereum Blockchain” (https://github.com/ethereum/go-ethereum/wiki/Private-network)

By building a private Ethereum blockchain, a company, can enjoy the liberty of a permissionless blockchain without having any gas issue. In a private Ethereum blockchain you can pre-fund any account with the maximum ETH an account can handle (which is around 9e+56 Ether). You can reduce also the Block Time which will therefore improve the network speed. You can choose also between 2 consensus (or build your own), Proof Of Work & Proof Of Authority. However, don’t lose of sight that using a private Ethereum blockchain will make your smart-contract only available to your private blockchain and that, and even if there is no more “lack of gas” issues, you still have to assume the deployment, infrastructure and the maintenance costs of the nodes.

From a Hyperledger Fabric Blockchain

Unlike Ethereum, Hyperledger Fabric gives you the freedom to run whatever consensus you want. You can use any of the pre-built consensus like Solo or Kafka or create your own consensus and transaction workflow.

In Hyperledger Fabric, consensus is divided in 3 steps :

  1. Endorsement,
  2. Ordering,
  3. Validation

Indeed, as it’s quoted in its Whitepaper “Hyperledger Fabric supports pluggable consensus service for all 3 phases. Applications may plug different endorsement, ordering, and validation models depending on their requirements. In particular, the ordering service API allows plugging in BFT-based agreement algorithms”

In the same way as the Ethereum private blockchain, you can modify the block time, however, if there is no transaction, no block will be created unlike in Ethereum.

From a technical and velocity point of view, Hyperledger Fabric is better positioned than Ethereum, but it will require much work to implement and deploy the solution.

Technical summary

Hyperledger Fabric Ethereum Private Ethereum
Type Private (only the persons // entities selected can join the blockchain) Public (everyone can subscribe and read the blockchain) Private
Permission Permissioned (administrators can decide who can read and write, and which data of the blockchain) Permissionless (everyone can make new transaction and manipulate data) Permissionless
Speed Very fast Fast Very fast
Scalability* Fast Medium Okay
*In order to define the scalability of the Ethereum blockchain we can assume that the average block time is between 10 seconds and 20 seconds and process around 5 transactions per second, which is a realistic hypothesis. On the other hand, Hyperledger Fabric, can run 3,500 transactions per second with a latency less than 1 second. In the meantime, Ethereum developers are working on a technology which will allow the Ethereum blockchain to run at the VISA average processing speed, which is around 1700 transactions per seconds (https://plasma.io/).

Vulnerabilities

At the time that we are writing these lines, the Ethereum Blockchain consensus is based on a Proof Of Work. The well known vulnerability of this consensus is the “50 percent attack”. If a miner, or a network of miners, own more than 50% of the network’s mining power, then can create blocks and win consensus. However it is not a cost-effective option because it requires an huge amount of mining power. To prevent this kind of attack, Ethereum is thinking about changing its consensus to a Proof Of Stake (https://en.wikipedia.org/wiki/Proof-of-stake), not everyone try to create the block, the creator is chosen in a deterministic way.

A private Ethereum blockchain will have the same vulnerabilities as the public one if it runs with a Proof of Work consensus. To corrupt a Proof of Work consensus we need more than 50% of the computation power of the network. The smaller the network, the greater the risk of network corruption. However, in case of a private Ethereum blockchain running a Proof of Authority consensus, the attacks would come from corrupted peers inside the network.

On the other hand with Hyperledger Fabric, because every node is known and designated by the administrators, there is no need of mining. The only way to be attacked is to have a compromised node in the network. But in case of a well designed Hyperledger Fabric Blockchain with a correct consensus and transaction workflow the corrupted peers will be quickly discovered.

Programming Language for Smart-Contract

As explained above, Ethereum smart-contracts are executed inside the EVM. So smart contracts must be written with Ethereum specific programming languages : LLL & Mutan, Serpent or Solidity, which nowadays is the most popular.

On the other hand, HyperLedger Fabric uses well known programming languages to write smart-contract (also called chaincode) : Go, Java or Javascript. Currently the most popular Fabric SDK is the one using NodeJS.

Opposed to Ethereum, if you already know one of these languages, you do not have to learn a new one.

Applications

Although Ethereum Blockchain has no privacy and no access restrictions, if you want to build a project that involves many people, Ethereum is the way to go.

You can also use Ethereum Private Blockchain if you want to manage accesses and peers acting with the blockchain. But keep in mind that you will still have exactly the same features as Ethereum classic and you will need to handle the deployment and infrastructure costs instead of buying ETH to provide gas to your smart-contracts.

If your project needs privacy, specific customization, business workflow and flexibility on who can read/write on what, then the Hyperledger Fabric Blockchain is the solution you need.

By design Hyperledger Fabric is a BlockChain built in order to be extremely modular and business focused. So you have a lot of flexibility on all the components of the blockchain (from the consensus, to the nodes, to the certificate, etc…).

Few example, the french Insurance AXA launched Fizzy (https://fizzy.axa/) a service of automated refund using the public Ethereum blockchain.

Using a public blockchain in this case make sense :

  • everything is public : people can read the smart contract and noticed that they have correctly subscribed to the service
  • immutability of the smart contract. Once written, nobody can change the data.
  • execution : once the conditions of your smart contract are fulfilled the actions are executed. In the previous exemple, if your flight is delayed, you will be refunded in the next 10 minutes. Regarding to the usual treatment period that’s quite an improvement
  • infrastructure cost : since Fizzy is using Ethereum public blockchain, AXA only needs to provide gas to its smart contract. So they do not have to handle deployment neither infrastructure costs.

On the other hand, there is a lot of use cases where you do not want to expose your data and transactions to everyone :

  • In the medical domain for example, we can imagine a private blockchain handled by hospitals, to share medical data between each others,
  • In finance, you can deploy a consortium blockchain to handle the private equity between the shareholders,
  • In logistic, you can want to use a consortium blockchain between you and your providers to handle all your shipping workflow and automatize invoices and payment,
  • In institutions, you may want to deploy some kind of digitalize personal records and be able to share some specific piece of data to other institutions

Partnerships & Popularity

Ethereum is by far the most powerful public blockchain running smart contracts.There is a large and active community and there is no doubt that this solution will stay the leader on public blockchains. Moreover, Ethereum is now supported by the Enterprise Ethereum Alliance with a lot of premium companies as partners like Shell, ING, Accenture, Credit Suisse and National bank of Canada ( https://entethalliance.org/members-2/ ).

Hyperledger Fabric has also it own consortium of partnership including IBM, Airbus, Intel or the huge chinese company Baidu (https://www.hyperledger.org/members). The Hyperledger Fabric team is very active and they provide 3 different SDK. Finally, Hyperledger Fabric, carried by the Linux Foundation provide new tools : explorer (Hyperledger Explorer), a deployment system (Cello) and a simplified interface in order to easily create blockchain business network (Composer).

Conclusion

To conclude, we think that Hyperledger Fabric and Ethereum blockchains are both famous and very likely to succeed in the next few years. A lot of tools are available in order to work and interact with them and a lot of developers are working continuously on those tools.

However, despite their efficiency, they do not aim the same goals.

These solutions address really different use cases. On one hand you have an open platform where everything is readable with a standard workflow of events and on the other hand you have to build and deploy your own blockchain and be able to implement the consensus you need, your business rules and choose which entities will be involved in the blockchain.

Indeed, if you are building a project which require privacy and permission you would probably use Hyperledger Fabric. If you don’t need such permission, you might consider using the Ethereum blockchain.

We only talked about two blockchains in this article. There is a lot of blockchains and even if some of them are very similar, they have been designed for different purposes.

At chainHero, we have the proficiency and experience of blockchain development. We have the ability to evaluate your project, give you a first opinion and we can set up prototypes or real projects !

If you have any kind of blockchain project, have a look to https://chainhero.io and get in touch at [email protected]

Sources:

Posted by Antoine Chabert