Building with HashGraph Part 1: Introduction

Charlie Crisp
Jul 16, 2018 · 6 min read
Image for post
Image for post
A diagram illustrating a gossip based protocol. Each node represents a gossip event being sent/received.

The HashGraph is a super cool technology that claims to be the next generation of distributed ledger technology, i.e. ‘Blockchain 2.0’. First conceptualised by Leemon Baird in 2015, HashGraph is still a very young technology but it’s been gaining a lot of attention in the last few years. Using the concept of ‘gossip’, the HashGraph promises superior performance, security, stability and fairness. Additionally, the Hedera HashGraph is an in-development platform that leverages HashGraph technology to create a virtual community with a native cryptocurrency, distributed applications, smart contracts and ‘fair’ governance. Whilst there’s been a lot of criticism of the patents that restrict the use of the HashGraph, there is an SDK which is available for developers to play around with and the potential for HashGraph applications in the future is huge. In the next two blog posts I will give an introduction to the HashGraph and then work through the SDK so you can start playing around with your own toy HashGraph applications.

If you’d like to skip ahead, here’s a link to Part 2: SDK workthrough.

How HashGraph works

Warning: I’m about to present some pretty crazy ideas but I’m not going to dive into them in massive detail. If you get scared at any point while reading this then don’t worry — it’s absolutely fine to skip this post and go straight into the ‘Properties’ section or even the next blog post. It’s more important to know the properties that HashGraph guarantees than how it guarantees them.

HashGraph works on a gossip based protocol which is fundamentally not a new idea. In gossip based systems, nodes communicate with each other and tell each other information that they know. For instance, this could be a history of transactions which each node recognises. In this case, nodes that want to add transactions will put them in their local history and randomly ‘gossip’ to multiple other nodes in the network. Upon receiving this gossip, these nodes will then gossip this information out to other nodes, and so on. Ultimately, information spreads to an exponentially increasing number of nodes and even if a few adversarial nodes choose not to gossip, they cannot prevent the exponential spread of information by the good nodes.

The innovative idea that distinguishes HashGraph from traditional gossip systems, is that rather than just gossiping arbitrary data, nodes gossip about gossip. I.e. the data structure in the image on the left is stored in memory and sent to others. Intuitively, if you imagine each node in the diagram to represent a new transaction being added to the graph, then rather than just sending that node, when a host gossips, they will send a whole tree of nodes starting from the new one.

So how can we achieve consensus? Usually in systems, if two nodes add a transaction at the same time, then we have a ‘collision’. Often the ordering of the transactions in a collision is decided by a complex scheme of voting (cf. Paxos or Raft). Unfortunately this requires complex combinations of node states with high network traffic too. Alternatively Bitcoin uses Proof of Work and sidesteps this issue by making sure that blocks are added very seldom so such collisions are unlikely and when they do happen, the community will choose a block arbitrarily, prune the other block and move on. HashGraph achieves consensus by running a process called virtual voting where a node can decide whether or not a transaction is agreed upon by voting on behalf of all the other nodes. In a network with participants Alice and Bob, Alice never asks Bob to send her a vote because she will work out his vote for him. This is possible because all nodes know what other nodes know and can therefore speculate what the node would have voted for without actually transferring a single packet over the network. This not only eliminates the network traffic of voting but it makes it impossible for nodes to vote adversarially because they never actually vote!

Like I said before, there are some pretty crazy ideas here and it will take some time to wrap your head around them, so you now have one of two options:

Whatever you’ve chosen to do, hopefully I still have your attention so now we can move on to discussing the properties of the HashGraph and what makes them so special.

Properties of the HashGraph

So what properties can the HashGraph guarantee that something like Paxos or Proof-of-Work+Blockchain can’t?

Performance

HashGraph has shown some outstanding performance statistics in some of the current tests. Evaluating a distributed system is hard and there is no single number that can be used to assess a systems performance so for a detailed breakdown of performance you should see the whitepaper. If that seems a bit tedious to you then suffice to say that HashGraph can achieve throughputs of up to 1m transactions per second and latencies of less than 10s which is extremely impressive. In contrast, Bitcoin has latencies of at least 10 minutes and throughputs of around 7 transactions per second and Ethereum has latencies of around 15s and throughputs of around 15 transactions per second.

So how is this performance achieved? HashGraph is able to achieve superior performance because it eliminates a lot of the sources of wasted work that you see in other consensus schemes such as proof of work:

Security

Fairness

Summary

In summary, HashGraph is a gossip based protocol that transmits ‘gossip about gossip’ to allow nodes to run virtual voting without ever sending voting messages over the network. This simple scheme can guarantee security, fairness and high performance. In the next post I will be showing how you can get started with the HashGraph SDK. Knowing how the HashGraph works will be helpful for this, but not necessary.

Here’s the link to Part 2…

Hackers at Cambridge

We are a student-run technology society, promoting a…

Thanks to Patrick Ferris and Eliot Lim

Charlie Crisp

Written by

I’m a recent Computer Science Graduate and I’m interested in networking and distributed systems — www.charliecrisp.com

Hackers at Cambridge

We are a student-run technology society, promoting a culture of creators and innovators by organising workshops and events for any student who wants to take part. This blog is a platform to spread the thoughts, opinions and projects of the tech-enthusiasts who write for it.

Charlie Crisp

Written by

I’m a recent Computer Science Graduate and I’m interested in networking and distributed systems — www.charliecrisp.com

Hackers at Cambridge

We are a student-run technology society, promoting a culture of creators and innovators by organising workshops and events for any student who wants to take part. This blog is a platform to spread the thoughts, opinions and projects of the tech-enthusiasts who write for it.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store