2 Seconds Block Finality on Harmony Mainnet

Rongjian Lan
Harmony
5 min readDec 9, 2020

--

In the age of digital business and fast-paced economy, online applications need to provide users with the best experience to retain them. One important aspect is how fast the apps respond to users’ actions. A slow website will test users’ short patience and eventually lose them. The same rule applies to decentralized applications where only a fast and responsive experience leads to high user satisfaction and retention rate.

With this in mind and after significant performance optimization and protocol improvement, we are launching 2 seconds block time on Harmony mainnet to allow Dapps to provide even faster blockchain experience. With 2 seconds block time, block finality is also shortened to within 2 seconds. In fact, transactions sent to Harmony mainnet will be confirmed generally in around 1 second and at most 2 seconds. With such a significant reduction in transaction latency, Dapps built on Harmony will find it easier to keep the users engaged and achieve high user satisfaction.

The Faster The Better

UX designers found that 47% of users expect a web page to load within 2 seconds and 40% will abandon a website that takes more than 3 seconds to load. We believe this rule also applies to blockchain applications. Waiting for tens of seconds or even minutes to confirm a transaction is the last thing we want for mass adoption of Web 3.0 applications.

Slow applications involving financial transactions also reduces the usage and activities, hindering the growth of the application. A study showed that a 1-second lag in Amazon’s website could cost them $1.6 billion in sales. In the world of Defi, more users and total locked value (TVL) could have been obtained if our existing blockchain infrastructure can confirm transactions a lot faster.

Without learning the lesson from the past 20 years of the internet revolution, it will be laughable to talk about building the decentralized Amazon, Google or Facebook. Harmony knows this by heart and has been focused on building the fastest and secure blockchain to make the Dapp experience as smooth as Web 2.0 applications. Besides high transaction throughput (TPS) which we achieved with sharding, we believe an extremely low transaction latency is also the key to bring mass adoption to the decentralized economy. Harmony’s 2 seconds block time and sub-2 seconds transaction finality make it possible to build revolutionary decentralized applications with great usability and performance that matches existing online applications.

How 2s Block Time is Achieved

Since achieving 5 seconds block time and finality in August this year, we’ve spent more time in figuring out how to further speed them up. After squeezing out all the performance gain in code efficiency, we needed to come up with protocol-level improvements to go below 5 seconds. The two key ingredients for 2s block time/finality are validator signature aggregation and block proposal pipelining.

Validator Signature Aggregation

Validators in Harmony mainnet can have multiple BLS keys in the same node (an individual machine connected to the network). Previously, such a node would sign a BLS signature and send as a p2p message for each of its BLS keys in every round of consensus. These messages will be received by the leader node which needs to verify each BLS signature separately. On Harmony mainnet, each shard contains 250 validator slots (BLS keys), which means the leader needs to receive 250 p2p messages and verify 250 BLS signatures for each round of consensus. This is a significant burden on the leader in both network usage and CPU power, which slows down the consensus process, thus the block time and finality.

We’ve implemented the feature to allow validators with multiple BLS keys to aggregate all the signatures into a single aggregated signature (BLS signature aggregation) and send as a single p2p message. This setup significantly reduces the number of p2p messages passed around in the network, resulting in 50%+ reduction on network usage. It also significantly reduces the leader’s CPU usage from 60% to 20% since the leader now processes less number of p2p messages in each consensus round.

Block Proposal Pipelining

Block proposal process involves transaction selection and processing, which could take hundreds of milliseconds. Previously the leader only starts proposing the new block after it finishes collecting most or all validator signatures for the previous block, and the new consensus won’t start before the new block is proposed. The time to propose a new block is slowing down the block time because during that time consensus doesn’t make any progress.

To avoid wasting this hundreds of milliseconds in the block proposal, we employed pipelining technique where the leader starts proposing a new block immediately after collecting 2/3 of the signatures (the minimum quorum achieved). Basically, the new block proposal process and the collection of the rest of the signatures (from 2/3 to 100%) now happen concurrently. This makes sure that the time to confirm a block (block finality) is constrained by nothing but only the network speed and the consensus message processing speed.

2 seconds block time and finality open up all the possibilities for Dapp developers to build the fastest and highly usable applications to prepare for real adoption. We welcome all Dapp developers to participate in this blockchain revolution with Harmony’s low-cost, low-latency and highly scalable blockchain infrastructure.

To learn more about Block Time, Block Finality, and the potential implications on the user, for developers, and companies, we created this educational video:

Developers can build on Harmony today, a fast and open blockchain for decentralized applications, suited to handle DeFi and cross-border finance. Harmony Mainnet supports state sharding with instant finality. Our staking mechanism reduces centralization while supporting delegation and slashing.

We ❤️ Developers.

Telegram | Twitter | Discord | Youtube | Medium | Facebook | LinkedIn | Reddit | Instagram

Want to build on Harmony? We have grants available. 👉 Apply HERE 👈

--

--