Monday, 13 May 2019

From Blockchain to Hashgraph

Blockchain is a decentralized, distributed and public digital ledger that uses hundred of computers to prove that something, e.g., a transaction or a record, actually happened. Blockchain is a transparent and living digital document of collecting and verifying records.

Blockchain uses smart contracts to incentivize the usage of technology. Smart contracts permit trusted transactions and agreements to be carried out among different, anonymous parties without the need for a central authority, legal system, or external enforcement mechanism. The transactions are traceable, transparent, and irreversible.

In the past, only official entities could verify transactions; nevertheless, the verification process was not transparent, and it could be corrupted easily.
This novel technology has a significant impact on society, and it is turning into a philosophical opening in how we re-arrange society and business.
Several companies, like Maersk or Open, use Blockchain to improve the efficiency of their business.

Maersk manages circa 150 ports around the world, where vessels are continuing deploying containers. One challenging point for the company is to track the containers.

For deploying a container, a vessel requires coordination with several companies and lots of documentation to track the shipment between two ports. By adopting blockchain technology, Maersk achieved with the help of smart contracts, full control over the container interactions while reducing the correspondent operational costs by 10%-15%.

Another company, Open – the first end to end logistic supply platform for commodities (rice, grain, oil, gas, metal), had difficulty in tackling topics around fraud, corruption, and price manipulation, mainly because transactions were not transparent. Again, with the use of smart contracts, this company improved the efficiency of its operations. An end to end logistic process that would originally take weeks to happen would now happen in minutes, while at the same time reducing the number of intermediaries, and, ultimately, cutting the product selling price.

In terms of social impact, Blockchain can be a useful technology for casting, tracking and counting votes. Although there are detractors about the use of this technology for replacing the traditional ballot box due to vulnerabilities, it is true that Blockchain has what is necessary to eliminate voter fraud.
Blockchain voting startups are working to overcome this skepticism. Maybe in the future Blockchain or alternative technology could make this scenario a reality.

There are different types of Blockchain implementations with different properties, as well as, alternative technologies.

One technology that is gaining hype and it is gaining the support of prominent groups is Hashgraph. Groups like Deutsche Telekom and Swisscom have been backing up Hashgraph. As a result, it is expectable that the market will adopt this technology to some extent.

Hedera Hashgraph


Hashgraph is a decentralized, distributed and public ledger that uses hundreds of computers to register and validate transactions. It is considered an alternative to Blockchain, one which tries to tackle the limitations of the technology concerning performance, fairness, cost, and security. There are not many Blockchain applications that can do five transactions per second. In contrast, Hashgraph can do a hundred thousand transactions per second.

Hedera is a company co-founded by Leemon Baird and has the goal to build a trusted and secure digital future. Hedera is governed by a council composed of corporations and organizations from different sectors. Hashgraph offers smart contracts, micro-storage, decentralized storage, and allows micro-transactions.

However, what makes Hashgraph different from Blockchain?

Hashgraph is a patented algorithm that has its data structure and achieves good results of scalability and performance due to two techniques: gossip of gossip and virtual voting.

The gossip of gossips technique broadcasts messages through an existing network of pre-authorized nodes. In Hashgraph, only hosts can read and write to the database and must have a database that is immune Sybil and DDoS attacks.

A Sybil attack occurs when an attacker is hit most of the time by creating several different accounts. As a result, the attacker can approve such transactions as triggering a double expense problem. For Bitcoin, this problem was solved through the work test.

In turn, Hedera what the results were pre-approved by them, are not considered valid or are of interest like no Blockchain.

Hedera Hashgraph is a probabilistic algorithm, that is, a non-deterministic algorithm. As such, it may not be able to reach the odds of being hit, nor the messages that are exchanged, how long does it take to reach a consensus.

Consensus is expected to be reached as time passes.

Structure level, the Block is a blockchain, which comes each block has a hash of its transactions and a pointer to itself and to the previous block. In contrast, Hashgraph stores the projects that are connected in a direct acyclic graph. In Hashgraph, each event contains two pointers for different parents.

We can see in the image below a distinction between a Blockchain event and Hashgraph. The event contains two hashes that point to the parent, a timestamp and a list of transactions. In Blockchain, the indexer in each block contains the address and content of the previous block.

The consensus algorithm in Hashgraph is not proof-of-work or proof-of-stake. It is an asynchronous Byzantine Fault-Tolerant algorithm that is resistant to DDoS and Sybil attacks.
Hashgraph Example

In this example, we have five different nodes in this Hashgraph. Each member starts by creating an event which is a small data structure in memory. Then the community is going to run a gossip protocol. E.g., Bob is going to send all the event that Ed does not know, yet. This could be a single transaction that Bob has made. Ed records the transaction by creating a new event which is the new circle in the image. Now Bob has a connection with Ed. Both Bob and Ed have two connections (From Bob to Bob, and from Bob to Ed. And from Ed to Ed and Ed to Bob). The new connections are represented in the hashes that the new event contains.

We can see in the image below that a Hashgraph event contains two hashes that point to the parent, a timestamp and a list of transactions.
Blockchain vs Hashgraph Event

Then, Ed sends all these events to Carol, and Carol sends the events to Bob. This exchange of events propagates the data. Moreover, because the events contain hashes, it is called Hashgraph. Each event contains the hashes from the previous events, and its creator digitally signs it.

Hashgraph has the notion of round. Hashgraphs contains witnesses that will vote on the validity of the transaction. The first event on each round for a single node will be called a witness. When we have all the witnesses, we have to see if it is a famous witness. A famous witness is one that is used multiple times.

Famous witnesses are chosen in an election. This is done considering the witnesses in the next round. A witness is deemed to be famous if it is seen by many of the witnesses in the next round. To determine if it is a famous witness, all witnesses must vote for it.

The goal of the election is to determine how often a transaction has passed all the nodes. If it is valid, it has been passed a lot. So, the longer the transaction is maintained in the hashgraph, the more trusted it can be.

Hedera is the public version of Hashgraph in the works. It will be governed by a council of leading corporations and organizations across multiple industries, and it will use this council as a Proof of Work to prevent Sybil attacks. Hedera claims to achive four main objectives: to provide smart contracts, micro storage, decentralized storage, and its own cryptocurrency allowing microtransactions.

There are several differences between Blockchain and Hashgraph. Blockchain ensures that data is not stored at a single location, while Hashgraph is a distributed ledger that works on the data structure with a distributed consensus algorithm.

The Hashgraph does not require Proof of Work, and can also deliver low-cost and high performance without a single point of failure. Also, Hashgraph does not need high computation power.

Hashgraph allows hundreds of thousands of transactions per second. In contrast, technologies that use Blockchain have different speed in terms of transactions per second. Bitcoin can make 7-10 transactions in a second, Ethereum has potential to perform 15-20 transactions per second, and Hyperledger can make thousands of transactions in a second.

Hashgraph also proves to be fairer than Blockchain as miners can choose the order of transactions, can delay them or even stop them from entering the block if necessary. However, in Hashgraph, a consensus of a timestamp is used preventing individuals from changing the order of transactions.

Hashgraph is a promising technology, but it also comes with some limitations.

Currently, the technology has only been deployed in private and permission-based network. It is still to be tested and explored in the public network. In gossip of gossips technique, when a node passes information to another node, there are chances that the closest nodes are malicious which may prevent the passage of information to other nodes.

The technology behind the Hedera Hashgraph is exceptionally intriguing, but its real potential and effectiveness are promising.