A Deep Dive into Mochimo — Part V: The Pseudo Block — A Block Unlike the Others
This is the fifth part of a series of articles about the Mochimo blockchain, a 100% original, no-ICO, no-presale crypto currency project.
Follow us on Twitter, Discord, Reddit
If you haven’t already, read our previous article A Deep Dive into Mochimo — Part IV: Consensus, Split and Orphan — The States of the Chain
The dynamic of the difficulty in a Proof of Work blockchain
Proof of Work (or PoW) is an implementation of the blockchain in which blocks are considered valid if they contain the solution to a cryptographic puzzle defined by the state of the chain.
In Bitcoin, the puzzle is represented by the hash of the block and its solution by the number of leading zeros of the hash. A block is valid if there are enough zeros leading the hash so that it equals or exceeds the current difficulty.
In Mochimo, we use more poetic approach through our custom PoW algorithm called Peach. A block is valid if it translates into a Haiku with a vibe good enough for the current difficulty.
Both approaches are similar except that we get to create beautiful Haiku every block :-)
Where Mochimo really differs from Bitcoin and other crypto currencies is in the way the difficulty is handled. As more miners join a network, the difficulty needs to be dynamically adjusted in order to maintain the target block time. When a block is mined within a timeframe that is shorter than the target, the difficulty is raised. When a block is mined within a timeframe that is longer than the target, the difficulty is lowered. In Bitcoin, the difficulty is adjusted every 2016 blocks (2 weeks). In Mochimo, the difficulty is adjusted every block and even between blocks if necessary.
Why does it matter ? Let’s look at some numbers.
The target block time of the Mochimo network is 337.5 seconds (5 minutes 37.5 seconds). If you lower the difficulty by one, assuming the total hash power stays the same, the expected time to solve the block drops to 337.5 / 2 = 168.75 seconds . Similarly, if you raise the difficulty by one, all else equals, the expected time to solve the block increase to 337.5 * 2 = 675 seconds.
Let’s explorer an extreme scenario where we lose 90% of our computation power from one minute to the next:
Right after the collapsing to 10% of our hashing power, we are not expected to mine a block for 2430 seconds (40 minutes), after which the difficulty would decrease by one (since it is adjusted every block) and the next block will be expected in 20 minutes, then 10 minutes, and finally back to the target of 5 minutes 37.5 seconds. With this pacing, it should take about 40min + 20min +10min = 1h10min to recover. Pretty good, right ?
Well actually, we would recover even faster than that.
The Mochimo development team has created a unique feature called the pseudo block to add some pep to the recovery process. Pseudo blocks are generated by all nodes of the networks when the time to solve a block exceed 949 seconds (15 minutes). A pseudo block contains deterministic data (making it identical across all nodes) and does not validate any transactions. It’s sole purpose is to reduce the difficulty. Going back to our example, after the first 15 minutes, a pseudo block would be generated and the new expected time to solve the block would be 20 minutes. Another 15 minutes later (before reaching the expected solve time), a second pseudo block would be generated, and the block would be solved within 10 minutes, before a third pseudo block would trigger. To recap the flow:
- Pseudo block #1 after 15 minutes
- Pseudo block #2 after 15 minutes
- Block solve in 10 minutes, after which the expected solve time is back to the target time of 5 minutes 37 seconds.
That means 15min + 15min + 10min = 40min to recover from a 90% drop in hashing power.
Lets compare that to Bitcoin.
The target block time of Bitcoin is 10 minutes. When you lower the difficulty by one, assuming the total hash power stays the same, the expected time to solve the block drops to 5 minutes. If you raise the difficulty by one, all else equals, the expected time to solve the block climbs to 20 minutes.
What would happen to Bitcoin in our scenario ?
After the drop, the expected block time is now 72 minutes. Since Bitcoin only adjusts the difficulty every 2016 blocks, we can expect the Bitcoin network to mine a block every 1 hour 12 minutes for the next 51 days (1008 (statically expected number of blocks before difficulty adjustment) * 1h12m = 51 days).
Ortis.
Edited by Kashmyr
About the author: I am a contributor to the Mochimo project and a founder of the mining pool illamanudi.
Twitter, GitHub