A Deep Dive into Mochimo — Part VIII: Anti Bloat Protection — A Sanctuary for the Ledger

Ortis
Mochimo Official
Published in
4 min readDec 10, 2019

This is the eighth 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 VII: Dissecting Transactions

Accounts for everyone!

Separate bank accounts make it easier to manage our finances. Individuals will use different accounts for household expenses, school tuition, retirement, and so on. We can observe the same practice in crypto currencies, reinforced by the fact that the cost of creating and maintaining an account is close to zero (unlike the outrageous “account maintenance fee” charged by traditional banks). However, this can result in a major issue: since every account is registered in the ledger and the cost for the user to create and maintain such an account is close to zero, the blockchain is therefore open to a bloating attack.

In others words, it is possible for an attacker to creates millions of new addresses that hold the minimum amount of coin, thereby inducing a significant increase of the size of the ledger, resulting in an upsurge in the amount of resources required to run a node on the network.

For now, this kind of attack is mitigated by the cost incurred via transaction fee and the minimal “smallest amount unit of a coin” being set high enough. But these are not long-term solutions.

Oprah making it rain accounts

Spring cleaning the Ledger

The Mochimo development team has created a feature called Sanctuary. By activating the sanctuary flag, a node is signaling the network that it will trim the ledger on a specific future Neo Genesis block. If a large enough group of miners reaches consensus on the call for Sanctuary (agreeing on both block number and minimum balance), the ledger will be pruned of all address where the balance is below the target amount when the target Neo Genesis block is reached. The size of the ledger will then be reduced proportionally to the number of address removed by the process.

The result would be similar to the numerous Bitcoin forks that have happened over the years (except for all the drama). Before those scheduled forks, nodes/miners were signaling whether or not they intended to support a change. Thankfully, activating Sanctuary is much smoother than a fork: it is an on-chain event that does not require any change of code, only a consensus number miners. Although we do not expect it to be required for several years, the Sanctuary feature is necessary to protect the long-term stability and viability of the blockchain.

Scheduling a Sanctuary event

In order to schedule a Sanctuary event, a Mochimo node must be started with the flag “-Sanctuary=N,Lastday” where N is the balance amount below which an address will be trimmed from the ledger and Lastday is the block number that will trigger the event. Note that there is some limitation in the code to cap the balance amount to a maximum of 4.294967296 MCM.

Once the node has started, it will respond to the OP_IDENTIFY request with the parameters of the scheduled Sanctuary event. Doing so makes it convenient to aggregate all the pending events and each miner can decide to support an event by activating it with the same parameters.

Since this mechanism is independent of the type of the event, it will be easy to add more event types in the future, should we need them.

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

--

--