Harmony’s Fast Finality Powers Harmony Puzzle

Alok Kothari
Harmony
Published in
4 min readMay 9, 2019

We recently launched Harmony Puzzle. You can play it here!

Watch the 20 sec intro:

Harmony Puzzle Game 20-sec Intro

The game is simple to play: use your arrow keys (or W,A,S,D for game nerds/H,J,K,L for vim nerds) to move the cursor to adjacent blocks. Once a cursor moves to a block, the number in the block increases by one. The goal is to make the numbers on all 9 blocks equal, so that they are in harmony.

Harmony Puzzle highlights several blockchain features. Before you play, the blockchain needs to ascertain that you have actually bet your tokens. For this,

  1. The transaction needs to be legitimate — your account needs to have the balance to make the transaction. We ensure this by giving you 100 tokens initially.
  2. Your betting transaction needs to be accepted — it needs to be included in a block in the blockchain by a leader in a shard.
  3. The block carrying your transaction needs to be “finalized”.

Let’s look into what that means. In Proof-of-Work chains (like Bitcoin, Ethereum) the miners keep attaching blocks to the blockchain as soon as they can be mined.

With their large networks, competing blockchains may emerge where nodes are attaching blocks to multiple different chains.

The longest chain is supposed to have “won” and is considered the canonical “final” truth. Finality means that the well-formed blocks won’t be revoked once committed to the blockchain and so the transactions in them cannot be reversed.

Longest Chain Rule in Bitcoin

So while your transaction is legitimate and accepted and is part of a block, it might not end up on the chain considered the real/canonical chain. In general, in Proof-of-Work networks finality is never 100%. The probability that your transaction will be on the canonical chain increases as the transactions gets deeper in the blockchain. It’s generally accepted that waiting for 6 block confirmations is advisable, as it would guarantee a 99.8% chance that your transaction will be in the canonical chain. In Bitcoin this would mean 6 blocks*10 mins block time ~ 1 hour of waiting for confirmation. Even for Ethereum, that would mean 6 blocks *15 secs block time ~ 1.5 minutes. (Vitalik and others recommend 10–12 confirmations ~ 3 mins).

Now imagine you are playing the game and have to wait 1.5 minutes to actually start! That won’t make for a fun experience. The good thing about Harmony is we use FBFT for consensus, an improvement on the Practical Byzantine Fault Tolerance (PBFT) algorithm. We guarantee instant finality, i.e. just wait for the next block and your transaction is finalized. By utilizing fast finality we have been able to make the game play smooth.

As you play the game, you are rewarded for finishing a level. The fast finality of Harmony Blockchain lets you go through the levels of the game quickly as well — as you are finishing levels an account created in your name is getting awarded this transactions. Once again if we waited for many blocks to make sure your tokens have actually increased, it won’t make for a smooth game play.

We are very excited as we keep adding features to our Puzzle game and demonstrate the features of our blockchain. We store the moves you made to win a level in the puzzle on our blockchain. This proof is stored in the transaction we rewarded you tokens with!

Transaction Snapshot from Harmony’s blockchain explorer

See the above snap of a transaction from our blockchain explorer.

Level 1 of Harmony Puzzle. RRDD is the winning move!

If you see the “Sequence” field above, it stores the configuration of the first level (“00010..”) and “RRDD” (“Right, Right, Down, Down”) the moves someone did to win the first level! In future we will let you rewatch your own level-play using this stored information.

More interesting changes are coming to the game, stay tuned! Meanwhile play the game and tell us what you think. We would love to get your suggestions!

--

--