Ethereum vs Hyperledger: Which Open-Source Blockchain Platform to Choose?
Ethereum and Hyperledger are both Blockchain platforms in the continuously evolving technology landscape. They are quite different due to their origin and use-cases. In this article, we will explain the key differences and analyze which one to choose.
What is Blockchain or Distributed Ledger Technology?
Blockchain or DLT (Distributed Ledger Technology) originated as a public permissionless Blockchain network. But in order to explain what it is and how it can be used, we need some background.
Origin of the Bitcoin network and how it influenced its design
The 2008 banking crisis was significant, and many lost their money. The risks of the prevailing banking system became clear as quite a few people tried to devise an alternative system. Their objective was to build a system where banks and governments can’t interfere with their money. Bitcoin was born as a result of such libertarian ideas.
The requirements of a decentralized payment network
A person or a group of people created the Bitcoin network under the nickname “Satoshi Nakamoto”. They created a peer-to-peer (P2P) network where users could send digital money to other users without any intervention from banks and governments. They had to address three broad requirements, as follows:
The P2P network should be decentralized and not controlled by other participants.
Hackers shouldn’t be able to hijack any sensitive information of individual network participants.
The decentralized network should be stable, i.e. participants can’t frequently branch away with one part of the network.
The currency is digital and has no physical presence and backing of the government. Given this, participants shouldn't be able to spend the same digital money twice, which is called the double spending problem.
How did the Bitcoin network address these requirements?
Satoshi Nakamoto solved the 1st requirement easily by creating a P2P network. It didn’t have a central server because all participants have equal authority. To address the 2nd requirement, the team used a digital signature with the public key-private key encryption. Participants have 2 keys. The public key can be shared with anyone. This is the address where someone else can send digital currencies like Bitcoin (BTC) in this case.
However, the private key is unique and secret. The two keys are linked to each other. It’s easy to create the public key from the private key, however, it’s incredibly difficult the other way.
Let’s now understand the Blockchain structure and how issues three and four are addressed.
Bitcoin network blocks, and the chain
Bitcoin transactions are stored in an intermediate repository called ‘mempool’. When transactions are validated, they are grouped together in a data structure called ‘block’. The network uses cryptographic hash functions. These convert the data of the block into a scrambled alphanumeric string called ‘hash’. It’s easy to create a hash from a data set, but it’s impossible to recreate the data from the hash. Even a slight change to the data results in a completely different hash.
A block has its transaction data; additionally, it also has the cryptographic hash of the previous block. As you can see, only the first Bitcoin block doesn't have the hash of any previous block. Additionally, the block also has the answer to a complex cryptographic puzzle. We will discuss this puzzle a little later. Each block has a reference to the earlier block, so we can see an imaginary chain forming, which is called ‘Blockchain'.
It's a decentralized network with all participants having equal authority. All participants, i.e., their computers have the entire data in the network. They are called ‘nodes’ and each node can view the entire set of blocks in the distributed database. It’s called a ‘Distributed Ledger Technology’ (DLT).
As you can see, with equal authority, every node can create new blocks according to their preference. This creates a risk because nodes can frequently branch off with a new network, which can create a highly unstable network! Also, any node can spend the same digital currency twice, i.e. exploit the ‘double-spend' weakness. Enter the consensus algorithm!
The ‘Proof of Work’ consensus algorithm
The creators of Bitcoin used a consensus algorithm called the ‘Proof of Work’ (POW). Although all nodes have the same authority, to create a new block with transactions, a node must solve that complex mathematical puzzle we mentioned earlier. It requires no skill, but it requires trying out one number after another quickly. The puzzle is difficult to solve, but not impossible. It’s an asymmetric puzzle, i.e., verifying a solution is very easy. It requires a very high amount of computing power. Solving this puzzle and creating a block this way is called ‘Mining’, and we call the nodes ‘Miners’.
When a miner solves a puzzle, they broadcast it to the network. Others review and once they confirm, the miner gets to create a new block. There is a reward, in a form of a fraction of the new Bitcoin minted. As you can see, new blocks can be created only when a complex mathematical task is solved.
If a miner tries to create a new block without following the standards, other miners will reject it. Branching off with a part of the network isn’t easy! For hackers to attack this network, they must capture a majority of the computing power in this decentralized network. That’s very hard with many nodes running computers with high computing powers.
How does the Bitcoin network prevent ‘double-spend’?
Assume a hacker has identified a transaction in the 519th Bitcoin block for manipulation. Once the hacker changes that transaction, they need to solve the puzzle again. It's hard to convince other miners because they will accept an answer with a small hash value only. A small hash value has many leading zeros in it, and it's very hard to find. Let’s suppose the hacker finds it.
Now since the hacker has changed the data in the 519th block, the hash has been changed. Now, the hacker must update the 520th block to incorporate this new hash of the 519th block in it. Otherwise, the new block will be in a very short chain. Miners will immediately reject that chain since they know that only the longest chain is the true one.
As soon as the hacker changes the 520th block, the hash for that also changes. This way the hacker must change the 521st block. This challenge continues! By the time the hacker changes so many blocks, everyone in the network finds that out, and the plan is failed!
What’s different in the Ethereum Blockchain network?
Vitalik Buterin and his team created the Ethereum Blockchain network following the main principles of the Bitcoin network. It uses the same kind of blocks, P2P network, public key-private key encryption, and the POW consensus algorithm. Its native cryptocurrency is Ether (ETH). However, unlike just a P2P payment network using cryptocurrencies, the Ethereum Blockchain has more to offer.
Ethereum ‘Smart contracts’
The Ethereum Blockchain network introduced the ‘Smart contract’ concept. Smart contracts are programs. They have ‘If-Then-Else’ conditions, based on which they check if a condition is fulfilled. It then transfers crypto assets. These are open-source programs, like the Blockchain protocols programs generally are.
They are stored as part of the Ethereum Blockchain blocks and no one can tamper with them after deployment. The execution results are permanently recorded in the Blockchain making it irreversible. Ethereum smart contracts are coded in ‘Solidity’, the proprietary language of Ethereum.
The ‘Ethereum Virtual Machine’ (EVM)
The Ethereum project also uses their platform called the ‘Ethereum Virtual Machine’ (EVM). Developers can create ‘Distributed Apps’ (DApps) using this platform. Virtual machines execute smart contracts, so these DApps can execute business functions other than sending digital currency from one address to another.
DApps are like web apps, however, they have a few distinguishing characteristics. While the front-end can be in any language, DApps must have smart contracts as their backend code.
DApps must be open-source, besides, they must use a crypto token created using a standard cryptographic algorithm. No entity can hold the majority of crypto tokens and no entity can control the future of the DApp. It executes autonomously. In addition, any change to it must be approved by the user community through consensus. A DApp also must store its data in a decentralized Blockchain following cryptographic standards.
Crypto tokens based on the Ethereum network
Developers can also create crypto tokens using the Ethereum platform. They use relevant crypto token standards like ERC 20 for this. Users of their DApps can access these apps using these crypto tokens. The computation on the main Ethereum network still uses its native cryptocurrency Ether.
Decentralized business models using the Ethereum network
EVMs, smart contracts, and DApps allowed developers and Blockchain-crypto start-ups to create new decentralized business models and disrupt existing centralized businesses. These DApps allow users to transact among themselves without a central authority charging exorbitant fees. Transactions take place using the crypto token of the DApp.
There are many examples. Hundreds of Blockchain-crypto start-ups offered their products built on the Ethereum platform and launched their ‘Initial Coin Offerings’ (ICOs). An example is LockTrip, which is a vacation rentals marketplace with 0% commission. They intend to disrupt existing vacation marketplaces like Booking.com and Airbnb.
Limitations of public Blockchains like Bitcoin and Ethereum
Decentralization allows peer-to-peer transactions, whereas consensus algorithms enable immutable records in public Blockchains like Bitcoin and Ethereum. However, these also impose limitations on them, as follows:
All nodes store the complete data, so activation of a new node can take days!
Transaction validation requires the participation of all nodes. Since different nodes use different computing powers and network bandwidth, the network can only be as fast as the slowest node! This scalability issue becomes more pronounced as more nodes join. Bitcoin can process just 3-5 ‘transactions per second' (TPS), whereas Ethereum is only marginally better with 7-15 TPS.
The POW consensus algorithm requires high computing power which causes huge electricity demands. All Bitcoin miners require more electricity than the electricity consumption in some countries!
While cryptocurrency networks and ‘Business to Consumer’ (B2C) companies have used public Blockchains so far, these limitations impede their use in the enterprise context.
Enterprise Blockchain requirements
Now that we’re done with prehistory, we can go further and discuss the key features in particular. Enterprises have markedly different requirements according Blockchain networks, but there are some common features required by most companies.
Enterprises often work in heavily regulated industries where data privacy is the key challenge. Public permissionless Blockchains make the entire data visible to all nodes. This is one of the reasons why enterprises can’t use them. Enterprise Blockchains need data privacy.
Public Blockchains allow anyone to join the network, even anonymous users. The mathematics in the Blockchain protocol program and data encryption techniques provide trust in the system, not participants. Enterprises can’t let such unrestricted access to their systems since they have proprietary data. They need access control.
Since public Blockchains allow anonymous and pseudonymous users, they may need to go too long to protect the network. This necessitates energy-hungry consensus algorithms like POW. On the other hand, enterprises will only allow trusted participants in their network, besides, such participants are bound by the codes of conduct of the enterprise. Consensus algorithms like POW are not relevant here, so these are not practical in the enterprise context. They need consensus algorithms aligned with their workflow, and roles, and responsibilities.
Enterprises often have 1,000 or more TPS requirements that means they need better scalability than public Blockchains.
No one owns the Bitcoin network. Despite criticism over the energy-consuming POW consensus algorithm and steady centralization of mining pools, Bitcoin will likely use this process in the foreseeable future. While the Ethereum Foundation oversees developments around the Ethereum network, DApps are decentralized. Enterprises need a tighter governance framework around their Blockchain network. Publicly listed enterprises need to be very transparent with their shareholders, investor communities, and regulators.
The Hyperledger Blockchain platform
Hyperledger is a collaborative effort. It includes several open-source Blockchain platform projects, e.g., Hyperledger Fabric, Hyperledger Indy, etc. The Linux Foundation hosts this, however, many companies from a wide spectrum of industries participate in this project. IBM, SAP, Accenture, Cisco, Daimler, American Express are just a few of the companies, while the membership list is huge!
Hyperledger Fabric is one of the more famous projects under this umbrella effort. It’s quite a mature project and it’s a Blockchain framework implementation for enterprises. IBM and Digital Asset had first created this jointly. For the rest of this article, we will use Hyperledger Fabric as the pole for comparison with Ethereum.
What’s common between Ethereum and Hyperledger Fabric?
There are a few similarities between Ethereum and Hyperledger Fabric, as follows:
Data encryption: Both Blockchain networks use advanced cryptographic techniques for data encryption.
Distributed ledger: Both have implemented the concept of distributed ledger however, it's implemented quite differently in case of Hyperledger. More on this later.
Smart contracts: Like Ethereum, Hyperledger Fabric also has them. They are called ‘chaincodes’.
Key differences between Ethereum and Hyperledger
Ethereum and Hyperledger Fabric have some important differences. Let’s review them.
Ethereum has its native cryptocurrency to fuel the computation within the network. Ethereum network users need to pay the ‘Gas price’ to execute transactions in this network. These are paid in Ether. As I have explained earlier in this article, you can also create your DApp running Ethereum smart contracts with a crypto token. It’s a token created on the Ethereum platform, however, remember that it’s separate from Ether.
Hyperledger Fabric isn’t suitable for cryptocurrencies and it doesn’t have any. It’s for enterprise use. Enterprises typically don’t have a cryptocurrency use case. Their B2C or B2B transactions already have payment terms and conditions specified. Enterprises intend to use Blockchain for efficiency and simplicity of processes.
Ethereum foundation tries to implement a consensus-based governance, however, it’s not easy. Ethereum stakeholders and the original project team aren’t fully aligned on the matters of governance.
Enterprises can’t quite work with a decentralized governance model. When some enterprise implements their own private Blockchain, it follows the governance model in their organization. On the other hand, when multiple enterprises work together and implement a consortium Blockchain for an industry-specific use case, they govern it jointly. An example is the Maersk-IBM Blockchain shipping platform.
Ethereum smart contracts are codes in Solidity or Vyper languages. These are Ethereum proprietary languages. However, chaincode in Hyperledger Fabric can be developed in various popular programming languages. Both are open-source platforms.
Ethereum main network uses the POW consensus algorithm. However, some developers use sidechains for their DApps to get better scalability. Loom Network, a Blockchain start-up, provides SDK to develop ‘DAppChains’, i.e. DApp specific sidechains. Developers can use a different consensus algorithm in their sidechains.
On the other hand, Hyperledger Fabric models its consensus algorithm according to a typical business process workflow. The transaction process has three phases, as follows:
Distributed logic processing involving chaincodes.
Transaction validation and commit.
There are different roles and tasks related to the transaction divided across these roles. This is performed as follows:
A requester submits a transaction request.
An endorser follows an endorsement policy. It specifies the number and combination of endorsements needed for a given type of transaction.
Endorsers send transactions to peers using a ‘read/write’ channel. This is done using chaincodes.
Now endorsers send the digitally signed proposal responses back, which are also called ‘endorsements’.
At this point, the client submits a transaction to the orderer.
The orderer creates a block of transactions and sends it to peers.
A peer checks for endorsements and whether there are conflicting transactions. When all conditions are met, the peer commits the transaction in the Blockchain.
Signatures and ‘read/write sets' are the only datasets that go back-and-forth through the network. This helps in improving scalability and performance. Endorsers and peers are the only people that see the transaction while data privacy is maintained.
Both platforms use smart contracts. I have earlier mentioned the difference with respect to the smart contract programming language. There is another key difference. Hyperledger Fabric uses the container technology to host smart contracts, whereas Ethereum just uses contract accounts and stores them in the Blockchain.
Who wins? Ethereum Blockchain or Hyperledger Fabric?
The two Blockchain platforms were created for entirely different purposes. As far as completely transparent decentralized Blockchain networks are concerned, Ethereum remains a top choice for entrepreneurs and developers. Most Blockchain-crypto ICOs over the past couple of years have used Ethereum platform for their new decentralized business models.
On the other hand, enterprises have completely different requirements, as I have mentioned earlier. Hyperledger Fabric provides data privacy, access control, scalability, and high transaction throughput. These suites enterprises. Fabric also has a few other advantages for enterprises, as follows:
A modular architecture where developers can develop and use components like consensus algorithm in a plug-n-play manner.
Hyperledger uses ‘channels’ for partitioning data as it’s highly suitable for stringently regulated industries like banking and healthcare.
Hyperledger offers very good querying features using LevelDB and optional CouchDB.
Fabric has a ‘Hardware Security Module’ (HSM) that increases the security of digital keys for sensitive use cases like identity management.
The Blockchain is not a one-size-fits-all solution for all business problems. You need to carefully evaluate your business model. If you need a completely transparent and fully decentralized Blockchain network with crypto tokens, Ethereum can be the right choice. You will need to contend with scalability and transaction throughput issues.
On the other hand, if you are in an enterprise environment and dealing with regulations, then you need data privacy and access control. Add to that the typical high transaction throughput demands of enterprises. Hyperledger Fabric is a good bet for you in such situations.
No worries! Just talk to one of our Blockchain experts for a thoughtful advice.