hashgraph

What is Hashgraph? Is It The “Blockchain Killer”?

Blockchains have been one of the greatest technological revolutions of the past century. Using this wonderful innovation, cryptocurrencies and software platforms like Bitcoin and Ethereum have truly disrupted the financial and software development sector. However, this new technology has come up which may challenge Blockchain for the throne. It is called “Hashgraph” and in this article we will explore this fascinating technology.

What Is Hashgraph?

Hashgraph is the consensus algorithm used by Swirlds. It was conceptualized by Swirlds co-founder Leemon Baird. This is how Swirlds describe themselves:

“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.”

It has been described as “blockchain on steroids”.

Hashgraph is said to have the following properties:

  • Speed: It can compute 250,000+ transactions per second.
  • Fair: It uses consensus time-stamping which makes the system fair.
  • Secure: It is an asynchronous Byzantine Fault Tolerant system. Meaning it can still work even if some of its nodes aren’t participating properly.

So, How Does Hashgraph Work?

Hashgraph uses two special features to achieve its fast, fair and secure transactions:

  • Gossip about gossip.
  • Virtual Voting.

Gossip About Gossip

Gossip about gossip or the gossip protocol is a very well-known concept in networking. Think of how gossip spreads in real life. Alice says something to Bob and then Bob says it to Charlie and Charlie says it to Dave and so on and so forth. Gossip about gossip roughly works on the same principle. Each “gossip” basically includes a piece of information attached to the hashes of the last two people talked to.

Every node in Hashgraph can spread signed information (called events) on newly-created transactions and transactions received from others, to its randomly chosen neighbors.

The neighboring nodes then amalgamate these new events with the information obtained from other nodes into a new event and then send it forward to more neighbors who are randomly chosen. This goes on until all the nodes are aware of the information.

Let’s see an example of this.

NOTE: All the diagrams are taken from “HASHGRAPH CONSENSUS: DETAILED EXAMPLES”

This is an example of a hashgraph, it grows upwards over time.

The participating nodes are Alice, Bob, Charlie and Dave represented by A, B, C and D.

Each member starts by creating an event which is denoted by the small grey circle. Each event contains 0 or more transactions.

So, now the gossip protocol starts.

Suppose, Bob randomly decides to gossip with Dave.

By interacting with Dave, Bob basically gives Dave all the events that Dave doesn’t know yet. As of right now, it is just the first event that Bob has created. Dave acknowledges this by creating a new event on top of his old event. This event is connected to Dave’s first event and Bob’s first event.

Let’s look at the anatomy of the said event.

An event consists of:

  • A timestamp of when Dave created the event.
  • The transactions that Dave may want to send to the network.
  • The hash of the self-parent which is, in this case, Dave’s first event.
  • The hash of the other-parent which is, in this case, Bob’s first event.

Now suppose Dave wants to randomly interact with Bob again.

Bob now receives three events, the first events of both Bob and Dave and the new event that Dave had created.

This goes on and on and the hashgraph eventually looks something like this:

Virtual Voting

The way that each node determines whether a transaction is valid or not is by virtual voting. If a transaction has 2/3rd of the node in the network as witness, then it is considered valid. Remember, hashgraph was designed to be Byzantine Fault Tolerant, hence this algorithm allows the system to work even if a third of the nodes turn Byzantine.

The voting happens over a lot of rounds. In this example we have divided the hashgraph into a 4 rounds. The important thing to note is that 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.

Now we are going to see what are the first events of each round created by each node.

Checkout Charlie’s column. His first events on each round are: C1, C2 and C3. He doesn’t have an event in the 4th round yet but he will get one as the hashgraph goes forward in time. These first events are also called witnesses. Which means, Charlie’s witnesses are: C1, C2 and C3.

For each witness, we will have to determine if it’s a “famous witness”. We do that by considering the votes of the witnesses in the round next to the round containing the witness.

Eg. suppose we are checking whether B2 is a famous witness or not, the witnesses in the next rounds are A3, B3, C3 and D3. Let’s see how the voting works.

Part 1: The Voting

Now, each of those witnesses will vote in an election to find out whether B2 is famous or not.

The way they do that is by checking whether they can “see” B2 or not. Basically, they are going to check if they are descendants of B2 or not.

A3 can directly see B2. Meaning it is a descendant of B2 hence A3 approves.

Similarly, B3, C3 and D3 can all trace their lineage back to B2 and can see it as well. So all 4 witnesses have counted YES. However, these are just the votes that have been cast, they need to be counted right now. The vote counting is done by the witnesses in the round next to the round containing the voting witnesses i.e. A4 and B4.

Part 2: The Vote Counting

B4 will now collect votes from the witnesses, in order to do so it needs to strongly see each witness. The condition of “strongly seeing” is as follows:

  • There must be multiple paths that go from the B4 to one of the witness nodes.
  • The path needs to pass a supermajority. A supermajority is any number that is more than 2/3rd of the population. In this case since the population is 4 the supermajority is 3.

As you can see, B4 can strongly see A3 and this remains the case all the way till D3.

Since the witnesses that voted “yes” gets strongly seen by B4 and gain a supermajority, B2 is declared a famous witness.

So the conditions for B4 to approve of the election are:

  • B4 strongly sees all witnesses and they all approve.
  • B4 strongly sees all witnesses and 3 approve and one disapproves. Since supermajority is achieved the result would still have been “Yes”.
  • B4 strongly sees 3 witnesses and they all say “Yes” and can’t strongly see the fourth witness. Even in this case the result would have been yes since supermajority has been achieved.

Blockchain Vs Hashgraph

The two biggest problems that the blockchain is facing are:

  • Speed of transactions
  • Fairness of transactions.

Let’s see how the hashgraph matches up against that.

Speed of Transactions

Bitcoin right now manages 7 transactions per second, Ethereum fairs slightly better at 15 per second. Hashgraph claims to be doing 250.000+ transactions per second. So, what’s the catch?

Hashgraph currently operates on a permissioned, private-based network. What this means is that the number and identity of the nodes participating is known beforehand. This is why it is unfair to compare it to a blockchain like Ethereum which is public and non-permissioned, meaning there are no fixed number of nodes. As of writing, there is still no public and non-permissioned version of the Hashgraph available.

Fairness of Transactions

One of the most annoying problems of blockchain based currencies is the lack of fairness in transaction validation. Since the miners themselves manually put the transactions into their blocks, they will always choose transactions which favours them financially.

Each transaction has a certain amount of transaction fee attached to them. However, many times, most users will pay extra transaction fees in order to get special preference for their transactions and “cut in line” so to speak.

This is the median waiting time for transactions to go through in Bitcoin:

Image Credit: Blockchain.info

As you can see, people have had to wait upto 29 mins to get their transactions confirmed!

Hasghgraph mitigates this via consensus time-stamping.

If one transaction reaches 2/3rd consensus before the other transaction, then it is validated first. It is simple first-come-first-serve and keeps the network as fair as possible.

My Video on Hashgraph

Conclusion

As of right now, it is too early and sensationalistic to say that Hashgraph is the “blockchain killer”. What can be said though is that the technology behind Hashgraph is extremely intriguing. It remains to be seen how effective the public, non-permissioned version of this technology looks like.


Join our #telegram, #twitter, and #facebook communities.

Draft White paper: here

Read all our articles related to Blockchain Technology

Springworks Team

Building products and tools to simplify the life of an org's HR function in terms of recruiting, onboarding & retention!

Lightning Protocol & The Raiden Network
Previous Story

Lightning Protocol & The Raiden Network: A Beginner’s Guide

CryptoKitties
Next Story

CryptoKitties: The Tech Behind The Craze

Latest from Blockchain Technology