Hyperledger Smart Contracts – A New Way to Go
Hyperledger Smart Contracts seem such a genius invention that you may wonder why nobody thought about them before. They are a ridiculously simple method of executing transactions between any parties without any middlemen. In real life, one of the main problems of any transaction is a matter of trust, and we do not mean the Billy Joel song but the challenge of two sides not trusting each other but trying to do business. Hence – banks, lawyers, notaries, contracts, certificates of origin, memoranda and a lot of other people producing a lot of paperwork. Lots of time and money are spent on establishing trust between two sides of the agreement.
Enter smart contracts. Doing business in a trustless environment immediately becomes easier. A smart contract is a piece of code that specifies a condition and an action that is to follow this condition. The smart contract verifies that the condition is fulfilled and authorizes the action. Otherwise, it declines it.
The textbook example that you can often find is Bob selling a concert ticket to Alice. The smart contract verifies that Bob provided the ticket and that the ticket is genuine. It also checks that Alice provided the money. Once both conditions are fulfilled, the smart contract releases the ticket to Alice and unlocks the payment to Bob. Everyone is happy. If Bob has provided the ticket but Alice is taking her time to give the money, the smart contract will return the ticket to Bob at the specified moment.
This is, of course, a very simple explanation of smart contract applications. In fact, they are capable of handling much more complex transactions and thus are very beneficial for enterprises in virtually any industry. Smart contracts can manage payments, handle insurance claims, verify product authenticity. Virtually, any business that needs its processes to run automatically subject to certain conditions can do it with a smart contract.
Since we mentioned enterprises, let’s return to what we put up as the title – Hyperledger smart contracts. The majority of smart contracts that are now being developed are Ethereum smart contracts. They serve their purpose well, but their purpose is a bit different – they are used in public applications, such as ICOs and other unrestricted platforms.
Enterprise blockchain applications require a different approach to access management and security, and for that reason, the capabilities of Hyperledger seem more attractive. In this post, we will look in the workings of Hyperledger smart contracts and see how they are different from those created in the Ethereum environment.
Hyperledger vs. Ethereum smart contracts
Comparing Hyperledger and Ethereum smart contracts is not exactly apples to oranges, as both belong to the same category and help to achieve similar goals. Moreover, according to Brian Behlendorf, Executive Director of Hyperledger, “Any positioning of the Hyperledger and Ethereum communities as competitive is incorrect”.
However, there are some fundamental differences that define their possible use cases and applications.
Hyperledger is a large umbrella project that joins several R&D areas. Hyperledger is primarily focused on serving enterprise blockchain solutions for business purposes. Smart contracts are supported by Hyperledger Fabric, a blockchain framework for creating the code for smart contracts. By the way, in Hyperledger they go under the name “chaincode”.
Ethereum smart contract platform offers a highly standardized space for creating public smart contracts according to a unified set of rules. As a result, writing smart contracts on Ethereum is rather easy and straightforward.
Both Hyperledger Fabric and Ethereum are open-source. Ethereum is a brainchild of Vitalik Buterin’s team, while Hyperledger Fabric, initially designed with the participation of IBM, has the Linux Foundation behind it.
Ethereum smart contracts are written in a special programming language that was designed for that very purpose – Solidity. It was developed with a focus on standardization and thus makes writing smart contracts easier. Of course, it requires the knowledge of this language which, unfortunately, has no other purpose so far.
Hyperledger Fabric, in its turn, uses Golang, or Go for short (now, do you see the pun in the title?). Go was created by Google and is now getting increasingly popular.
This is the main difference between smart contracts implemented in Ethereum and Hyperledger Fabric, as it determines a lot of special features in their creation and use.
Ethereum smart contracts were originally intended for public decentralized applications. This is why they work so well for ICOs and public payment platforms.
Smart contracts created in Hyperledger Fabric, on the other hand, are primarily intended for business purposes. They make a part of a closed enterprise ecosystem and are not open to the public.
As Ethereum smart contracts are meant for public use, they by default include no inherent permission mechanism and are open for everyone. They are a great choice in cases when a business aims to attract as many users as possible, for example, for crowdfunding through an ICO or for any other public application.
There is a possibility of implementing a permissioned Ethereum smart contract, however, that requires some special programming effort. Alternatively, an enterprise can set up a private Ethereum blockchain that can only be accessed by permission.
Hyperledger chaincode, in its turn, was originally designed as an enterprise solution and only allows participation by permission. Any community using a Hyperledger smart contract is a closed community where new members are accepted only by invitation. In addition, Hyperledger Fabric supports multi-level access systems.
In a Hyperledger blockchain, the permissions can be configured so that certain user groups are assigned different permissions depending on their functions. In an enterprise solution, such a flexible permission system allows achieving the desired level of security and effectiveness.
Obviously, for enterprises seeking increased security of their operations, Hyperledger offers a more effective solution as it immediately creates a security perimeter around the business network.
This point is directly related to the previous one and stems from the initial purpose of Ethereum as a public solution and Hyperledger as a private one.
In Ethereum, there is no way of making a transaction visible to certain members and hidden for others. Once the transaction is published on the network, it is visible to everyone. It is a great feature maintaining trust and transparency in the Ethereum blockchain and an advantage for public networks.
However, business applications often have different goals. An enterprise working with several partners can have different conditions for them. Naturally, the conditions are kept confidential. If there is a discount offered to one of the partners, it is essential that other partners do not know about it.
Hyperledger supports such confidentiality allowing to create and maintain flexible conditions within the same network.
Currently, Ethereum still uses the Proof-of-Work consensus algorithm which is insanely power-consuming and includes transaction fees. Again, this is perfectly logical in a public system where you pay to have your transaction processed. However, Ethereum seems to be moving towards adopting the more economic Proof-of-Stake algorithm that is to be included in its next Casper version release.
Enterprise blockchains, being closed networks, have no need of charging the per-transaction fees and are very keen on cost-saving. Therefore, for them Hyperledger smart contracts using the Practical Byzantine Fault Tolerance algorithm are more efficient.
In addition, Hyperledger can also use the so-called voting-based algorithms to achieve consensus. In Hyperledger, such consensus is reached in the pool of another, lottery-based, consensus.
Since it is a permissioned network, the degree of trust in Hyperledger is higher than in public blockchains. Not all nodes participate in validating a transaction but only those that are selected according to a special policy. This way, the network achieves higher processing speed.
Cryptocurrency and tokens
This one is easy – Ethereum has an in-built cryptocurrency, ETH, Hyperledger does not. This fact, on the one hand, gives Ethereum an advantage over Hyperledger by making it suitable for applications requiring a payment instrument.
On the other hand, both blockchains – Ethereum and Hyperledger support custom tokens. Thus, for the purposes of tokenization, both blockchains are suitable.
With our little analysis, we hope to have proved what Brian Behlendorf said – that Ethereum and Hyperledger are no competitors. Smart contracts built on Ethereum and Hyperledger Fabric are intended for different purposes and, thus, have different target audiences.
Let’s summarize the main differences between Ethereum and Hyperledger:
|Consensus algorithm||PoW||PBFT or voting-based|
In view of what we talked about, we can conclude that Ethereum can be the platform of choice for businesses that work with a wide public customer base. ICOs, insurance programs, customer loyalty programs, cryptocurrency trading platforms – these are the cases where the advantages of the Ethereum blockchain will truly shine.
The applications that involve any payment transactions should definitely choose Ethereum with its own cryptocurrency. By the way, cryptocurrencies are getting beyond their primary purpose as an investment or payment instrument. They are becoming an equivalent of other assets – for example, insurance compensations (check fizzy, a flight delay insurance program) or bonus points (see Delta Air Lines replacing SkyMiles with Ether).
On the other hand, the requirements of enterprise applications are significantly different. What they want is security, access management, confidentiality and a high degree of customization and flexibility. Hyperledger smart contracts satisfy all these requirements allowing to build reliable, secure and scalable custom solutions.
There’s a catch, though. There are many more Ethereum developers than those capable of creating an effective Hyperledger smart contract. The reason is clear – today, Ethereum is much more popular and, besides, enterprise blockchain is still in its infancy. As a company working with both Ethereum and Hyperledger, we notice that the large business is just beginning to explore the opportunities of blockchain and its applications at the enterprise level.
This situation creates a perfect window of opportunity for businesses that are looking for ways to increase their productivity and competitiveness. By implementing enterprise blockchain, they are becoming the forerunners of the new technology adoption and will immediately stand out from among the other players in the same market.
We strongly believe that blockchain can make a difference in the way companies are doing business. And we are proud to be among the ones who contribute to its development and evolution. As experts in enterprise blockchain development, we can consult you on how to integrate it in your business for the maximum benefit.
Browse our blockchain development services and contact us for a free 30-minute consultation on blockchain implementation for your business. Use this opportunity to revamp your business infrastructure with this cutting-edge technology.