Abstract
The rise of distributed ledger technology has revolutionized the way we think about decentralized systems and their applications. Among the many blockchain platforms available, Hedera and Polygon have emerged as popular choices for businesses and developers seeking to leverage distributed ledger technologies with improved metrics for various use cases. This article presents a comparative analysis of Hedera and Polygon, focusing on their key features, consensus mechanisms, scalability, transaction fees, ecosystem, and some decentralized application examples. The findings aim to provide readers with a comprehensive understanding of these two distributed ledger technologies, aiding businesses and developers in making informed decisions when considering the adoption of decentralized platforms for their projects.
Introduction
Distributed ledger technology (DLT) refers to the underlying technological framework and protocols that enable multiple parties to access, validate, and update records in a networked database simultaneously. DLT serves as the foundational technology for blockchains and provides features such as transparency in viewing changes and their origins, reduced need for data auditing, reliable data storage, and controlled access only to authorized users [1]. By using cryptography features, DLTs allow information to be stored securely and accurately in immutable databases, being less sensitive to cyberattacks and related corruptions.
Blockchain is a type of DLT which has gained widespread attention as a revolutionary technology with its decentralized system, promising improvements across various industries. Its entry has spurred the development of diverse applications, such as NFTs, decentralized finance, and cryptocurrencies, among others. The demand for blockchain platform applications has been steadily rising, leading to rapid advancements in solutions to meet the growing demand [2].
Normally, projects based on DLT rotate around three core concepts: decentralization, scalability and security [3]. The blockchain trilemma syntagm posits that achieving scalability, decentralization, and security simultaneously in a blockchain is challenging, and trade-offs must be made among these properties when building a decentralized system [4]. The most recent observation of trilemma at play was Ethereum blockchain. Because of network congestion, transaction costs have increased, making the platform less accessible for minor transactions and thus, becoming rigid to infrastructure scalability and throughput improvements.
Hedera and Polygon are DLT platforms that have been designed with a focus on proposing possible solutions to this trilemma, thus designing decentralized, scalable and secure systems which can handle high throughput and fast transaction speeds, making them suitable and reliable for applications that require inexpensive and rapid transactions.
As the cryptocurrency market vigorously evolves in time, it becomes crucial to thoroughly understand the advantages and disadvantages of different technologies in order to make informed decisions about their application.
Why Hedera and Polygon?
Both Hedera and Polygon were proactive about solving the underlying trilemma problem and having a strong vision about the future of performant, safe and versatile decentralized systems which were able to fulfill the actual user requirements.
To start with, Hedera Hashgraph is a distributed ledger technology (DLT) platform that was founded by Leemon Baird, a computer scientist, and a technology executive Mance Harmon in 2018.
It is known for its unique consensus algorithm called the Hashgraph consensus algorithm, which is based on a directed acyclic graph (DAG) data structure and claims to provide high throughput, low latency, and high security.
Evolving in time, Hedera formed strategic partnerships with various companies and organizations across different industries, including financial services, supply chain management, and gaming, to explore and implement the use of their DLT platform in various real-world applications.
The second candidate, Polygon, is a Layer 2 scaling solution that addresses scalability challenges by utilizing sidechains for off-chain computation and a decentralized network of Proof-of-Stake (PoS) validators [5].
Actually, the Polygon derived from the Matic Network which was introduced in 2017 by a team of four software engineers based in Mumbai: Jaynti Kanani, Sandeep Nailwa, Anurag Arjun, and Mihailo Bjelic. The actual rebranding happened in February 2021, repositioning itself as Polygon Technology company [6].
Polygon aims to tackle the issues of scalability and usability while maintaining decentralization and leveraging the existing developer community and ecosystem, being as well compatible with existing Ethereum tooling and offering much faster and cost-effective transactions [5].
Even though these two platforms are quite different, their main goal is to create a performant substrate for a vast array of applications and become the world’s mass-adopted public distributed ledgers.
Hedera vs Polygon
In this section will be performed a detailed comparative analysis of two distributed ledger technologies based on criterias described in Table 1.
Consensus mechanisms
Polygon utilizes a proof-of-stake (PoS) consensus mechanism for processing transactions on its blockchain, being a category of consensus algorithms for public blockchains that depend on a validator’s economic stake in the network.
In public blockchains that utilize a proof-of-stake (PoS) consensus mechanism, a group of validators alternates in proposing and voting on the next block. The influence of each validator’s vote is determined by the size of their deposit or stake. PoS offers several benefits, including enhanced security, lower risk of centralization, and improved energy efficiency compared to other consensus mechanisms [7].
However, the Hedera hashgraph consensus algorithm uses another approach – gossip about gossip with virtual voting. It is a consensus mechanism where nodes in the network share information through a gossip protocol and then vote on events correspondingly. Virtual voting in a network uses a voting algorithm to reach consensus, with timestamps assigned to transactions and a median of timestamps acting as the vote result. This creates a fairer system than blockchain, where the network decides, not one node [8].
Both Hedera and Polygon consensus algorithms achieve the Byzantine Fault Tolerance (BFT), in case of Hedera being an asynchronous BFT.
Table 1 – A brief overview of DLT platforms
Architecture
Hashgraph architecture relies on a distributed ledger technology that uses a directed acyclic graph (DAG) represented in Figure 1.
Hedera Hashgraph is distinct from traditional blockchains as it employs a different approach for storing information. Instead of using blocks, Hedera Hashgraph stores information in hashes, which represent specific events [9].
In hashgraph, a system of nodes communicate with each other through a gossip about gossip mechanism, where nodes not only gossip about events but also about the gossip messages they receive from other nodes. The obtained network of events forms a DAG structure which underlines the historical arrangement of transactions through the network. Hashgraph also employs a virtual voting algorithm for achieving consensus on the order of events. Members can calculate every other member’s votes by internally looking at each of their copies of the hashgraph and applying the virtual voting algorithm.
1 – Hashgraph event (left) and DAG structure (right)
Polygon network is a blockchain application platform that utilizes hybrid Proof-of-Stake (PoS) and Plasma-enabled sidechains. Its architecture is characterized by a separation of a generic validation layer from different execution environments, including full-blown Ethereum Virtual Machine (EVM) sidechains and other Layer 2 approaches like zero-knowledge rollups [10].
Generally speaking, Polygon PoS consists of a three-layer architecture, including staking management smart contracts on Ethereum, Heimdall layer, and Bor layer (see Figure 2).
Heimdall is the PoS layer of Polygon, which is responsible for validating transactions and producing new blocks. It is a decentralized network of PoS validators that maintain the PoS consensus for Polygon. Validators in Heimdall stake their native MATIC tokens as collateral and participate in the consensus by proposing and voting on blocks.
Bor is the block producer layer of Polygon, which is responsible for producing blocks and maintaining the block history. It acts as a bridge between the Heimdall PoS layer and the execution environments, such as EVM side chains or other Layer 2 approaches. Bor ensures the security and integrity of the Polygon network by creating and validating blocks according to the PoS consensus rules.
Figure 2 – Polygon multilayer architecture [10]
Scalability
Polygon is a blockchain platform that aims to address scalability challenges by providing Layer 2 scaling solutions. Polygon uses sidechains, specifically Plasma-enabled sidechains, to offload computation from the main Ethereum blockchain and achieve higher transaction throughput. This allows for fast, low-cost and secure transactions compared to the Ethereum mainnet, making Polygon a scalable solution for decentralized applications (dApps) and user functionalities [5]. For example, in the case of Ethereum, the transaction speed is 15 transactions per second (TPS), rather than 7000 TPS for Polygon.
However, Hedera uses a novel paradigm for achieving best metrics for different user experiences. Asynchronous communication between nodes, historical order of events in DAG layout, gossip protocol and virtual voting are some of the factors that allow for parallel processing of transactions, faster consensus and efficient utilization of network resources. Moreover, the Hashgraph consensus algorithm ensures that smart contracts are executed quickly and securely [11]. All features mentioned above lead to high transaction throughput and a strong potential for scalability.
Smart contract support
Polygon supports many services for testing, compiling, debugging, and deploying smart contracts on the Polygon Network. Polygon prides itself in being the ultimate Layer 2 scaling solution for Ethereum. There is no need to worry about the underlying architecture while moving or deploying your dApps to the Polygon Network as long as it is EVM-compatible. Therefore smart contracts written in Solidity and Vyper languages are also valid for deployment on Polygon chain.
The Hedera network allows building decentralized applications and protocols that scale with Solidity smart contracts. The Hedera Smart Contract service is EVM compatible to run Solidity, unchanged, on the Hedera network [12].
The integration of the Hedera Service with smart contracts makes possible to directly interact with Hedera transactions within Solidity contracts. By importing the appropriate Solidity libraries into contract, you can begin interacting with other Hedera Services. Currently, the Hedera Service integration specifically supports Hedera Token Service transactions. This integration empowers interaction with tokens on the Hedera network through smart contract, including transactions for token association, dissociation, minting, burning, and transferring [13].
Specifics of smart contract deployment
The typical process for deploying contracts on the Polygon network is similar with Ethereum one, which involves compiling the smart contract code, creating a transaction to deploy the contract with the specified constructor parameters, signing the transaction using the private key of the deploying account, and broadcasting it to the Polygon network for processing. Once the transaction is mined and confirmed, the contract is deployed on the network and becomes accessible for user interaction.
Hedera supports contract deployment either by using Ethereum tooling, such as Web3JS, Truffle, Ethers, Hardhat (see Table 2 for compatibility analysis), or Hashgraph SDK, which offers sufficient instruments for building decentralized ecosystems.
If you are using Ethereum tools, the deployment setup includes creation of an ECDSA-based account with an alias and setting JSON-RPC Relay. The usage of this relay by developers enhances the usability of the Hedera platform, allowing for seamless integration with popular Ethereum developer tools and providing greater convenience for building on hashgraph architectures. The corresponding URLs for connection to specific relay (mainnet, testnet) can be found on HashIO [14].
Table 2 – Ethereum tool compatibility with Hedera [14]
After setting up the initial environment, further development processes are very similar to the classical steps for Ethereum based development on Hardhat, Truffle or Web3JS.
In case of using Hashgraph SDK, the flow is slightly different. An additional transaction is required for creating and storing the compiled contracts, and their hex encoded bytecode in a separate location on the network, resulting in a unique bytecode file ID. Only after this step, the contract can be created on Hedera by specifying constructor parameters and referencing the received ID. It’s important to set gas values high enough during this process to avoid receiving insufficient gas response [15].
Token standards
Currently, Polygon allows for a wide range of tokens based on various standards such as ERC20, ERC721, ERC1155, and more. These tokens can be easily transferred between the Ethereum and Polygon chains using the PoS (Proof of Stake) bridge. It is recommended to create assets directly on the Polygon chain, as it is a simpler and more convenient approach. These assets, known as Polygon mintable assets, can be moved to the Ethereum chain when needed [16].
However, Hedera has implemented a unique mechanism for the creation and management of tokens known as Hedera Token Service. This service allows users to create, mint, and transfer custom fungible or non-fungible tokens. There are two methods to create a token on Hedera: using the Hedera SDK or a Solidity Smart Contract.
Using purely SDK, this can be done by sending a token create transaction for producing a specific token. Some of the main parameters are listed below:
- Name
- Symbol
- Treasury Account
- Initial Supply
- Decimals
- Auto-renew Account Id
- Auto-renew Period
- Max Transaction Fee
You have to specify Auto-renew Account ID because you’ll need to pay an auto-renewal fee for entities to persist on the Hedera Network [17].
It is also possible to interact with Hedera Token Service (HTS) by utilizing precompiled Hedera contracts, which enable you to associate a token with an account and transfer tokens to the associated account. The HTS contract has specific functions that facilitate token association, transfer, and dissociation from a Hedera account.
To write a contract using HTS, it is necessary to add the HTS Solidity support libraries to your project and import them into your contract. They include:
- HederaTokenService.sol
- HederaResponseCodes.sol
- IHederaTokenService.sol
Obtained contracts can be compiled and deployed either using Hashgraph SDK or Ethereum based tools with JSON-RPC Relay [18].
Case Study: Implementing a Uniswap V2-based AMM on the Hedera Blockchain Using HTS
Decentralized exchanges (DEXs) are an essential component of the DeFi ecosystem, providing a platform for traders to swap cryptocurrencies without the need for a centralized authority. The Hedera network has emerged as a promising alternative to Ethereum for DeFi applications, boasting faster transaction times, lower fees, and increased scalability. As a result, there has been a growing interest in developing DEXs on the Hedera network.
An example of implementation of a custom AMM on the Hedera network using Solidity can be found on Syndika GitHub. It utilizes two important services, the Hedera Token Service (HTS) and Smart Contract Service (HSCS).
The HTS provides a hassle-free method for creating and managing tokens on the network, without the need for complex smart contracts, unlike the traditional ERC-20 tokens. By eliminating the dependency on smart contracts, HTS simplifies the process for end-users.
In order to write token transactions natively in Solidity smart contracts, a few Solidity source files were used from HTS/HSCS contract suite:
- HederaResponseCodes.sol
- HederaTokenService.sol
- IHederaTokenService.sol
- KeyHelper.sol
These files can be also easily grabbed from official Hedera repo [21]. Additionally was created a wrapper contract SafeHederaTokenService.sol around the HTS interface that eliminates the need to handle response code return values. In general, the smart contract architecture resides on a UniswapV2 style, the only difference is on how tokens are handled when adding/removing liquidity to the pools, minting of tokens, association and transfer of them, asset swapping, etc.
By using these dependencies and the combination of HTS and HSCS, the exchange of fungible tokens on Hedera is incredibly fast and cost-effective, with transaction finality achieved in mere seconds, in contrast to the minutes taken by traditional blockchain networks.
Transaction costs and gas fees
When compared to Ethereum, Polygon has significantly lower gas prices and transaction fees. This can be attributed, in part, to Polygon’s PoS consensus algorithm, which reduces both network energy consumption and associated costs. Additionally, Polygon provides various Layer 2 scaling solutions that facilitate fast and cost-effective transactions.
Hedera Hashgraph’s consensus algorithm enables high throughput, allowing for a large number of transactions to be processed per second. This efficient network architecture helps to reduce transaction congestion and keep transaction fees low.
Due to improved architecture, transaction fees on Hedera mainnet are significantly lower than Polygon’s (see Table 1), but again, it’s important to note that transaction fees can still vary depending on network conditions and demand for resources.
Decentralized apps examples
In Table 3 and Table 4 are enumerated, some of the most popular decentralized applications deployed on Hedera mainnet and Polygon mainnet, respectively.
Table 3 – Top Hedera dApps [19]
Table 4 – Top Polygon dApps [20]
Conclusions
When comparing Hedera and Polygon, two prominent decentralized ledger technologies, it becomes evident that they offer unique features and advantages. Hedera Hashgraph boasts its patented consensus mechanism, gossip about gossip with virtual voting, which offers high scalability, fast transactions, and low fees. On the other hand, Polygon stands out with its Layer 2 scaling solution, utilizing sidechains and a hybrid PoS and Plasma-enabled architecture, providing interoperability with Ethereum and other basechains. Ultimately, the choice between Hedera and Polygon depends on the specific needs and requirements of a given use case or application. Both platforms offer innovative solutions for different use cases and have their respective strengths, making them promising options for blockchain developers and businesses alike.
References
1. Frankenfield, J., Distributed Ledger Technology (DLT): Definition and How It Works [online], 2023. [accessed 06.04.2023]. Available: https://www.investopedia.com/terms/d/distributed-ledger-technology-dlt.asp
2. Solana Vs. Polygon Vs. Ethereum – The Ultimate Comparison [online], [accessed 06.04.2023].
Available: https://www.blockchain-council.org/blockchain/solana-vs-polygon-vs-ethereum/
3. CertiK, The Blockchain Trilemma: Decentralized, Scalable, and Secure? [online], 2019. [accessed 07.04.2023].
Available: https://medium.com/certik/the-blockchain-trilemma-decentralized-scalable-and-secure-e9d8c41a87b3
4. Quai Network, Breaking The Blockchain Trilemma [online], [accessed 07.04.2023].
Available: https://blog.qu.ai/breaking-the-trilemma-8afc28c96ed2
5. What is Polygon? [online], [accessed 07.04.2023].
Available: https://wiki.polygon.technology/docs/home/polygon-basics/what-is-polygon
6. Kaul, A., Borate, B., Meet India’s first crypto billionaires [online], [accessed 10.04.2023]. Available: https://www.livemint.com/companies/people/meet-india-s-first-crypto-billionaires-11622112486971.html
7. Proof of Stake (PoS) [online], [accessed 07.04.2023]. Available: https://wiki.polygon.technology/docs/home/polygon-basics/what-is-proof-of-stake
8. Frankenfield, J., Hashgraph Consensus [online], 2022. [accessed 09.04.2023].
Available: https://www.investopedia.com/terms/h/hashgraph-consensus-mechanism.asp
9. Musienko, Y., What is the difference between Hedera Hashgraph vs blockchain vs Tangle [online], [accessed 09.04.2023]. Available: https://merehead.com/blog/difference-hedera-hashgraph-vs-blockchain-vs-tangle/
10. Polygon PoS Architecture [online], [accessed 09.04.2023].
Available: https://wiki.polygon.technology/docs/home/architecture/polygon-architecture
11. Virtual Voting [online], [accessed 09.04.2023].
Available: https://docs.hedera.com/hedera/core-concepts/hashgraph-consensus-algorithms/virtual-voting
12. Hedera Smart Contract Service [online], [accessed 09.04.2023]. Available: https://hedera.com/smart-contract
13. Hedera Services Integration with Smart Contracts [online], [accessed 08.04.2023]. Available: https://docs.hedera.com/hedera/core-concepts/smart-contracts/hedera-services-integration-with-smart-contracts
14. Castro, A., Deploy By Leveraging Ethereum Developer Tools On Hedera [online], [accessed 11.04.2023].
Available: https://docs.hedera.com/hedera/tutorials/smart-contracts/deploy-by-leveraging-ethereum-developer-tools-on-hedera
15. Hunjan, S., Deploy Your First Smart Contract [online], [accessed 11.04.2023].
Available: https://docs.hedera.com/hedera/tutorials/smart-contracts/deploy-your-first-smart-contract
16. Mintable PoS Assets [online], [accessed 11.04.2023].
Available: https://wiki.polygon.technology/docs/develop/ethereum-polygon/mintable-assets/
17. Coacci, F., How to Create Hedera Tokens Using SDKs and Smart Contract – Part 1: Fungible Tokens [online], [accessed 11.04.2023].
Available: https://hedera.com/blog/how-to-create-hedera-tokens-part-1-fungible-tokens#:~:text=The%20Hedera%20Token%20Service%20enables,using%20a%20Solidity%20Smart%20Contract
18. Hunjan, S., Deploy a Contract Using the Hedera Token Service [online], [accessed 11.04.2023]. Available: https://docs.hedera.com/hedera/tutorials/smart-contracts/deploy-a-contract-using-the-hedera-token-service
19. https://dappradar.com/rankings/protocol/hedera (data collected on 08.04.2023)
20. https://dappradar.com/rankings/protocol/polygon (data collected on 08.04.2023)
21. Hedera Service Solidity Libraries [online]. [accessed 5/4/2023].
Available: https://github.com/hashgraph/hedera-smart-contracts/tree/main/contracts/hts-precompile
Unlock Your Potential
Want to take your business to the next level? Look no further! Get in touch with us today