In some aspects, various blockchain technologies overlap with their intent and in other parts, they differ greatly, with their distinct features and scope. Let’s take a look at Hyperledger and Ethereum.
Hyperledger vs Ethereum: a comparison
Table of contents:
- What is blockchain?
- Is that all?
- What is Ethereum?
- What is Hyperledger?
- Permissioned blockchains vs public blockchain networks
- Private transactions between members
- Consensus mechanism
- Cost of execution
- Smart contracts
- Hyperledger Fabric vs Ethereum – modularity
- Transaction flow
- Which blockchain should I use?
What is a blockchain?
Before we start working on our Hyperledger vs Ethereum comparison, let’s quickly recap what a blockchain is. If you rip off all the buzzwords and advanced crypto jargon, you can try to treat a blockchain as… a stone. What is written in stone will remain forever, right? But there is no single stone that holds the ultimate truth. Blockchain is made of nodes communicating with each other, and every blockchain node has its own stone. Users update it as time passes with new transactions. Before accepting an entry in a stone, information is reviewed and confirmed according to the blockchain consensus algorithm. It’s just a way of agreeing on the acceptance of valid information/transactions.
After an entry’s acceptance, every stone in a public network of such stones must reflect the change. So, when a transaction happens every stone is updated. Stones are compared to deduce the state of the blockchain. So this is the main reason why blockchain is so appealing. You can have a source of true history written in stone without a central authority. This source cannot be changed.
Is that all?
Looking at Hyperledger and Ethereum, we must first introduce all the contenders. While Bitcoin may be qualified as a public blockchain that handles money transactions (decentralized cryptocurrency). Ethereum and Hyperledger Fabric blockchains are much more than that. We call them blockchains 2.0, or evolved blockchain concepts that comprise of Virtual Machine engines. This means they can execute almost arbitrary Turing-complete code that was deployed into the blockchain (a computer program of some sort).
So now using our stone metaphor, we have scripts that can be written into the stone and you can execute automatic actions that alter the stone or make calculations.
What is Ethereum?
Ethereum is a public blockchain created in 2015 by a smart guy called Vitalik Buterin. He had a vision of extending the idea of Bitcoin’s decentralized cryptocurrency to decentralised applications (what are dapps about?). Those applications would comprise of smart contracts. Ethereum can be seen as a open-source platform that runs those smart contracts. They will be executed exactly as programmed without any possibility of downtime, censorship, fraud or third-party interference.
What is Hyperledger?
Hyperledger is not a blockchain in itself. Hyperledger is an open-source project and a hub for many blockchain projects under the Linux Foundation umbrella. Some projects that reside under the Hyperledger umbrella are:
- Hyperledger Sawtooth: developed by Intel. Uses a brand new consensus algorithm called Proof of Elapsed Time (PoET) which helps to build networks with a large number of nodes with a small CPU consumption footprint. Supports both permissioned and permissionless blockchain networks.
- Hyperledger Iroha: made by Japanese developers who originally created this solution for mobile use cases. Designed for simple creation and management of assets. It’s aiming to be easy to incorporate into infrastructure projects. Consists of new chain-based Byzantine Fault Tolerant consensus algorithm. Soon they will release iOS and Android support
- Hyperledger Indy: Was created to provide independent identity on distributed ledgers. Private information is never stored in the ledger. With this solution, you will be in control of sharing your identity with others
- Hyperledger Burrow: is a permissioned blockchain node that executes Ethereum smart contracts code (usually written in Solidity). You can specify an amount of gas needed to execute given contract. To invoke a contract you need sufficient permissions, not coins or tokens. Provides high transaction throughput thanks to the proof-of-stake Tendermint consensus engine.
- Hyperledger Fabric: developed by IBM. Supports only permissioned networks. Provides elastic architecture — different components can be plugged in or out to fit the use case.
So let’s get to it — Hyperledger versus Ethereum! We’ll find out what the differences are between those blockchains in a few selected aspects. Then, hopefully, it will be easier to choose one over the other in certain blockchain applications.
Permissioned blockchains vs public blockchain networks
Ethereum is a public blockchain and permissionless network which means that it can be accessible to anyone for both read and write operations. On the other hand, Hyperledger Fabric is a private network aimed at solving problems specific to the enterprise landscape. Fabric is a permissioned network. This means that only privileged entities and nodes can participate in this decentralized platform. To receive access, one must submit enroll and be granted permission from a trusted Membership Service Provider (MSP). MSP is a component that issues and validates certificates, and later handles user authentication.
Private transaction between members
In Ethereum there are no means to issue a private transaction between members. That is, if we ignore the fact that in Quorum, JP Morgan’s fork of the Ethereum implementation, provides that feature. In our Hyperledger vs Ethereum comparison, it starkly contrasts with Hyperledger Fabric’s ability to offer that feature. Hyperledger Fabric can have multiple ledgers.
A ledger here is called a channel. A channel can be available only to certain members. This is a very important use case in enterprise integration scenarios, because it isn’t especially desirable to offer full transparency of internal business processes to the competitors. Certain contractual agreements should stay private.
Ethereum also shares the burden of most public blockchains: a requirement of costly consensus algorithm like “proof of work” to validate transactions and secure the network.
In the consensus model a transaction from one node, every node must confirm it in the form of a valid block before it’s accepted . The one node that creates a valid block first will get the reward in the form of an incentive for honest transactions validation. Nodes which create valid blocks and are rewarded for their work will get less and less rewards over time.
This consensus algorithm requires a lot of CPU power. At some point in the not-so-distant future, Ethereum will migrate to a proof-of-stake consensus algorithm. In contrast to that, Hyperledger Fabric in its default setup uses a no consensus algorithm (No-op). However, due to its pluggable architecture other consensus algorithms like Practical Byzantine Fault Tolerance can be configured. Consensus is abstracted away in a component called Ordering Service. You can even design and code your own consensus algorithm component if your needs can’t be satisfied with the existing implementations.
Hyperledger vs Ethereum: Cost of execution
Every transaction in Ethereum cost some gas, which is the way in which computing resources (CPU, storage) are valued in Ethereum. My colleague wrote a more in-depth article about Ethereum gas, if you’d like to dive in. Ether is the Ethereum’s native cryptocurrency. You can exchange it on some cryptoexchanges to your local currencies like USD or EUR.
As the Ether value as against national currencies is fluctuating, the gas costs, if expressed as a fixed factor, would also fluctuate. That’s the reason why in Ethereum we have the notion of gas and — separately — gas price (which is the value of the gas in the Ether unit). This way computational costs could stay constant to some extent even with high Ether market volatility. This translates to the observation that every transaction invoked on the Ethereum Virtual Machine will cost some real money.
Cryptocurrency is fuel for the costly proof of work consensus algorithm which secures the network. That gas cost not only incentivizes validating nodes to perform their duties. It also deters potentially hostile nodes from executing DDoS attacks that would cost them a small fortune. On the other hand, in Hyperledger Fabric there is no notion of gas. Every participant knows all the other participants of the network. In a setup like that, it’s easy to detect malicious users and activities and revoke their access to entire blockchain if the need arises.
When writing smart contracts for Ethereum, the Solidity programming language is the main choice for blockchain developers (here’s our Solidity tutorial). In Hyperledger Fabric, smart contracts are called chain codes. In this case blockchain developers have an option to write chain codes in mainstream programming languages such as Golang or Node.js.
Chaincode runs in a secured Docker container isolated from the other processes. There is also one notable difference: Solidity language was designed to ensure that smart contracts written in that language give deterministic results. Node.js and Go with their runtimes weren’t designed to keep this rule in mind. So, as a programmer, you must be careful not to use non-deterministic functions while designing your chain code.
Hyperledger Fabric vs Ethereum – modularity
Ethereum has no notions of modularity. Hyperledger is designed as modular and different components can be switched on and off.
In Ethereum, when a transaction happens it basically goes through two steps. The first transaction is added to ledger in some order and propagated to all peers. Then, the transaction is executed by all peers. Transactions must always execute deterministically to be sure that all the peers ends up in the same state. In Hyperledger Fabric, it’s a slightly different story. Clients send the transaction by choosing to endorse peers from those specified in the endorsing policy of channel. Endorsement policies are defined using domain-specific language.
The first transaction gets executed using chaincode in any order by chosen endorsement peers. The submitting client collects endorsements and validates signatures, then the transaction is sent to an ordering service. The order for each channel is specified and a Proposal of the transaction is sent to all peers in the channel. Peers validate the transaction and mark it as valid or invalid and state of the ledger is updated. As you can see, not all peers in the channel execute the same steps, as it was the case in Ethereum.
Which blockchain should I use?
I liked the Hyperledger Fabric vs Ethereum battle metaphor, but in truth Hyperledger Fabric and Ethereum were created to solve different problems. So they shouldn’t really be perceived as competition to each other. They are different products that happen to use the same backbone technology, which is the blockchain itself.
Ethereum vs Hyperledger – conclusion
Hyperledger Fabric was made for a business usage scenario, mostly enterprise solutions. Therefore, organizations can use the Hyperledger Fabric blockchain for their internal (inter-department) integration purposes — or more general cross-enterprise integration scenarios where the parties to the transactions know each other and have valid contractual agreements to communicate with. On the other hand, Ethereum was designed for public blockchain solutions with the notion of fully transparent and objective transaction execution even in an arbitrarily hostile environment. While to some chaos can be a ladder, this doesn’t work for application developers. At Espeo Blockchain, we also help people decide which tech they should pick and guide them through it.