03
Mar
20

Hashgraph vs Blockchain – Hedera Hashgraph (HBAR) explained

Created by Leemon Baird, a hashgraph is a patented algorithm that provides the benefits of a distributed ledger system without compromising on scalability and speed. Described as a “blockchain on steroids.” the hashgraph is owned by the Swirlds Corporation, which was founded by Baird himself. This is how Swirlds describes itself on its website:

 

Swirlds is a software platform designed to build fully-distributed applications that harness the power of the cloud without servers. Now you can develop applications with fairness in decision making, speed, trust and reliability, at a fraction of the cost of traditional server-based platforms.

 

Ideally, the hashgraph should have the following properties:
 

  • Compute over 250,000 transactions per second.
  • Maintain a fair system using consensus time-stamping.
  • It is always available since even if some of the nodes aren’t participating correctly, it will still work.
  •  

    Hashgraph isn’t exactly a closed ecosystem Developers can use its SDK Library to experiment and play around with the protocol. The SDK Library has the following:
     

  • Several simple demo apps along with the source codes.
  • Documentation for the platform.
  • Guidelines and resources to help learn how to build apps on hashgraph.
  •  

    The two features of Hashgraph’s algorithm

     

    The Hashgraph algorithm has two special features:

     

  • Gossip about gossip.
  • Virtual Voting.
  •  

    Gossip about Gossip

     

    If you are somewhat familiar with networking, then you must have heard about “gossip about gossip” or the gossip protocol. The gossip protocol works similarly to how gossip works in real-life, human interaction. Suppose we have four friends, Alice, Bob, Charlie, Dave.

     

     

    So, we have these four friends hanging out with each other in the form of a hashgraph, which grows upwards over time.

     

     

    Suppose, Bob decides to randomly gossip with Dave. This gossip is marked on the hashgraph by an entity called an event.

     

     

    This event has the following data:
     

  • The time at which the interaction happened aka timestamp.
  • The interaction involved within this event or the transaction details.
  • The hashes of the two parties involved in the gossip (in this case are Bob and Dave).
  •  

     

    Now, consider this situation. Dave wants to interact with Bob all over again to talk about what they earlier talked about. In the process, a new event is created on Bob, which includes all the events that preceded before it – Bob’s first event, Dave’s first event, and the first gossip sessions between Bob and Dave.

     

    This random gossip will go on and on until the hashgraph eventually looks something like this:

     

     

    All four of these friends have gossiped with each other about everything. That’s pretty much how The nodes in hashgraph’s network relay information, such as transaction details, throughout the whole system.

     

    Virtual Voting

     

    Virtual voting will help determine if a transaction is valid or not. Every transaction needs to have at least 2/3rd of the nodes supporting it as a witness for it to be considered valid.

     

    The voting process happens over multiple rounds. To show how it works, we will divide the hashgraph into four rounds.

     

     

    Whenever a new event is created, we immediately know which round it belongs to. By dividing this up into rounds, we can make the calculations much faster.

     

     

    After the rounds have been clearly demarcated, we will point out the first event created on each node’s timeline. In the diagram above, Bob, aka B, has the events – B1, B2, B3, and B4. These are the first event recorded by B in rounds 1, 2, 3, and 4, respectively, and are also called “witness.”

     
    Determining the famous witness
     

    For each witness, we will have to determine if it’s a “famous witness.” These famous witnesses are considered by the votes made by the witnesses in the next round. Trust us, that isn’t gibberish. Recheck the diagram given below:

     

     

    Suppose we want to see if B2 is a famous witness or not. In this case, we will need to receive votes from the witnesses of the next round. In this situation, they are A3, B3, C3, and D3. So, how does the voting process works? Let’s take a look.

     
    Part 1: The Voting
     

     

    Witnesses in the third round will check if they are directly derived or descended from B2 or not.

     

     

    As you can see above, A3 can directly link up with B2 making it a direct descendant. A3 will hence give its approval to qualify B2 as a famous witness.

     

     

    B2 can also be directly linked to B3, C3, and D3 as well. So, all the four witnesses have given their vote and approval for B2 being a famous witness. Now that the votes have been cast, they need to be counted. The vote-counting process is done by the witnesses present in the round next to the round containing the voting witnesses i.e., A4 and B4.

     
    Part 2: The Vote Counting
     

     

    These witnesses will send over their votes to A4 and B4 and check if they can “strongly see” these witnesses. The condition of strongly seeing is as follows:

     

  • There must be multiple paths that B4 can take to reach each of the witness nodes.
  • The path needs to pass more than 2/3rd of the population to achieve a supermajority. In this case, since the total number of nodes is 4, the supermajority is 3.
  •  

     

    In the case above, B4 can strongly see the witnesses mentioned in the third round. Following this, B2 is declared a famous witness.

     

     

    The code behind Hashgraph

     

    LISP and Java languages were used to create the core of hashgraph.

     

  • LISP: A high-level programming language that was invented by John McCarthy in 1958. It can effectively process symbolic information and is best-suited for artificial intelligence and any data science programs. It provides high-level debugging, can be extended for a specific implementation, is machine-independent and offers a wide range of data types such as structures, lists, objects, hash-tables, etc.
  • Java: A general-purpose programming language, which is fast, reliable, and secure. It allows programmers to develop and run applications and offers automatic memory management, which reduces memory corruption and vulnerabilities. Java provides the Java Virtual Machine (JVM), which uses the same code and works in exactly the same manner.
  •  

    Speaking of the applications running on top of it, Hedera hashgraph is compatible with solidity. Hence solidity-based dApps can easily be ported to hashgraph.

     

    Blockchain vs Hashgraph

     

    There are two big advantages that hashgraphs have over blockchains:

     

  • Transaction speed.
  • Greater degree of fairness.
  •  

    Transaction Speed

     

    Hashgraph currently operates on a permissioned, private-based network. A blockchain network falls under the two categories:

     
    Public Network
     

    Cryptocurrencies like Bitcoin and Ethereum are hosted on a public network since they are open ecosystems. It has a built-in incentive mechanism that rewards participants for working in the interest of the system. As you may already know, Bitcoin and Ethereum use the proof-of-work consensus mechanism to mine blocks. This process requires a lot of computational resources and, in return, they get rewarded with a “block reward” for successfully mining a block. This mining process itself is very inefficient and slow.

     

    Plus, anyone can join a public network, which in itself is another detriment. Enterprises deal with a lot of sensitive data, which is why they will not want to join a public network.

     
    Private Network
     

    As the name suggests, private networks aren’t open to everyone. As a result, people who want to participate in a private network must gain permission beforehand. This is the reason why private networks are also called “permissioned networks.”

     

    Because of this, there are restrictions on the kind of people who can actually take part in the consensus. Access for new participants could be given by the following:

     

  • The existing participants who are taking part in the ecosystem.
  • A regulated authority.
  • A consortium.
  •  
    These private networks have been specifically designed for enterprise needs and offer a lot of features like:
     

  • Fast transactions
  • Privacy
  • High security
  •  

    This also explains the lower cost in contrast to public networks. Performance is much better, making it possible to conduct more than 1,000 transactions per second. This type of network is suitable for financial institutions and large companies because they can build large systems and reduce costs while improving efficiency.

     

    Hedera hashgraph has a private, permissioned network.

     

    Greater Degree of Fairness

     

    Transactions in blockchain-based cryptocurrencies are not really fair. A transaction goes through only after a miner picks it up from the mempool and puts it inside the blocks that they are mining. Miners will always choose transactions that favor them financially.

     

    Each transaction has a certain amount of transaction fee attached to them. However, many times, most users will pay extra transaction fees to get a special preference for their transactions.

     

    Hasghgraph mitigates this via consensus time-stamping. Simply put, the moment a transaction receives validation from 2/3rd of the network, it will reach consensus. It is simple first-come-first-serve and keeps the network as fair as possible.

     

    Hedera DApps

     

    Hedera has gained a lot of traction and has around 100 dApps committed to building on top of its platform. More than 5000 developers are actively interacting in the Discord Channel to discuss the platform and the implications of the applications being built on top of it. So, let’s look at the five more promising Hedera dApps.

     

    #1 Sagewise

     

     

    Sagewise is creating an SDK that will allow smart contracts to be stopped in the event of a dispute. A smart contract creator can include Sagewise’s SDK in the smart contracts. The moment something goes wrong, the contracting parties can trigger dispute resolution mode to pause the contract until it’s resolved. Sagewise’s Solidity Virtual Machine, SDK can be easily integrated with Hedera Hashgraph. Hashgraph’s scalability and its support for solidity smart contracts make it an ideal platform for Sagewise.

     

    #2 Hearo.fm

     

     

    Hearo.fm is a global marketplace based on the Hedera hashgraph, which allows music artists to sell and showcase their music directly to fans. As per Andrew Antar, founder of Hearo.fm, Hedera Hashgraph is the best and only technology that enables the use of micropayments for streaming music.

     

    There are plenty of reasons why hearo.fm is using the hashgraph:

     

  • It will help in creating a global music distribution by building a music economy with micropayments for listeners and artists. Usually, factors like bank fees and credit card processing can make micropayments impossible. Plus, it takes around two and a half years to transfer compensation for music played.
  • The global music platform, based on Hedera Hashgraph, also plans to leverage its solidity compatibility to utilize the existing Solidity smart contracts code to simplify it for the developers to launch Hearo.fm in the market.
  •  

    #3 Alto.io

     

     

    Alto.io is a decentralized gaming platform that allows users to mint, sell and use crypto items on Hedera Hashgraph. The games running on this platform can create and use non-fungible and ownable items to generate revenue. The items generated are interoperable as they can be sold and used across various games and users. The platform has two primary users – players and item creators.

     

  • The players can use the items generated to play multiple games.
  • The item creators can earn commission fees every time an item that they have crate is being owned by a player.
  •  

    Here is why Alto.io plans on using the hashgraph:

     

  • Hashgraph’s consistency and modern UX design lead to better developer experience and low fees.
  • Hashgraph provides high scalability and speed, which is vital in delivering an excellent user experience.
  • Smart contracts written in solidity can be easily ported to Hedera hashgraph with minimal or no code changes.
  •  

    #4 Carbon

     

     

    Carbon is a stablecoin that aims to create an inclusive and efficient global economy that closely relates to USD. After investigating several smart contract platforms, Carbon selected the Hedera Hashgraph since its high speed and security can provide a reliable base for operations.

     

    #5 Cryptotask

     

     

    A decentralized task marketplace for freelancers, Cryptotask solves the problem of centralized marketplaces like restrictions on high-value tasks, slow dispute resolution, and high fees. Cryptotask users can be rewarded for tasks such as “review writing.” Users can also share job posts. Freelancers can apply for those jobs and reviewers can be selected to be part of a review panel proportional to their stake. Presently, Cryptotask is running on the Ethereum mainnet, but they have since migrated to Hedera Hashgraph. They feel that the lower transaction fees and higher speed and security will help them in achieving their goals.

     

    Conclusion

     

    Not only has the Hedera hashgraph provided a very viable alternative to the blockchain, but several developers have already created some promising applications on top of its platform. Its compatibility with solidity can help attract Ethereum’s considerable developer community who might be looking for a faster and more secure platform. The native token HBAR is listed on several popular exchanges like Bittrex and OKEx.

    Rajarshi Mitra
    Blockchain Researcher