2014-02-11

Gantlets of new cryptocoins - The Block Bloater

A lot of people are eager to jump onto the bandwagon and create new cryptocoins. Everyone is eager to promote their coin as being the best out there. However, there are many gantlets to cross for each aspiring new currency before it can be considered stable. The one I will be looking at today I call "The Block Bloater".

The size of each block in a blockchain is traditionally limited to around 1MB. This means there is a limited number of transactions that can go into a block, and that up to 1MB of data will be stored in the blockchain files of everyone running a full client per block. If blocks are generated every 10 minutes like in Bitcoin, that amounts to a limit of about 144MB of block data per day and about 53GB of data per year. If blocks are generated more often, more and more data needs to be stored per given time frame.

Tragedy of the commons


Using the blockchain is similar to the concept of "tragedy of the commons" - individuals that act in their self-interest by depleting a common resource is acting against group's long-term best interests. For example, if everyone is grazing their animals on a shared pasture, a way for me to maximize the value I am getting would be to graze as many animals there as I can. However, if everyone is acting this way, the pasture quickly gets grazed to the ground and everyone suffers as a result.

For many people in the Bitcoin world the tragedy of the commons is not a new thing. The process of mining is a good example of this principle in action. In theory, everyone could be mining on CPUs and not waste as much electricity as a dedicated mining farm. However, it is in the best interest of each individual miner to mine with the most powerful machines out there to maximize their profit. This creates an arms race to get the best hardware and keep profitable in the long run.

The blockchain


Lets go back to the topic at hand however. The blockchain is a common resource. If everyone would only use it for essential transactions, it would keep nice and lean for a long while. However, there are some entities that benefit from using the blockchain disproportionally.

Historically, SatoshiDice was a really good gantlet for the Bitcoin network to adopt to a high transaction volume. The serviced provided gambling through the blockchain in a form of transactions being sent back and forth. Every time one sent a transaction to a special address owned by SatoshiDice, they would get a transaction back indicating a win or loss (denoted by a return of 1 satoshi to the player). A lot of people criticized the service for creating a lot of small "dust transactions" and bloating up the blockchain. This bloat forced tighter enforcement of transaction fees, which can be both a good thing (fees will need to be replacing the block rewards over time) and a bad thing (one couldn't count on getting a free transaction into a block quickly).

The second type of people that would want to bloat the blockchain would not be benefiting from the transactions directly, but would create a lot of them nonetheless. You could call them "hackers" for a lack of better word, and just as hackers go, split them into black hats and white hats. Black hats would want to bloat up a blockchain of a currency rival to their own in order to make it unappealing to use (larger blockchain downloads, slower confirmation times, more bandwidth needs, etc). White hats would bloat the blockchain to bring more attention to the problem early on and let the developers fix the problem before it becomes too big.

How hard would it be to bloat a blockchain? As it turns out, it's pretty easy.

The Block Bloater



I created a small program called "The Block Bloater". It essentially creates a large number of transactions each having 0 fees and just moving a bunch of random coins around. Since each transaction has no fees attached to it, an attacker using such a program would not run out of money spamming the blockchain.



After the transactions are created, they propagate through the network bloating up the chain. Above we can see that block 180970 had only 1 transaction and its size was 0.19kB. The block that was attacked - 180978, had 76 transactions and was over 100 times bigger.

If such a program was run for an extended period of time, it could take ages to clear all the transactions from the client's cache.

So, which coins are the most vulnerable? Generally, the ones with:

  • Fast block confirmation times - more transactions can get into the blockchain per unit of time
  • Pools that put any transactions into the blocks - if pools don't discriminate against spam, people will have to eat that spam
  • Clients that don't enforce minimum transaction fees - if spam moves, it will clog up the network sooner or later
  • Developers that are slow to react - if a network is vulnerable to this attack and the code is not patched quickly the network will bear bigger burden for a long time in a form of a bloated chain

Conclusions

In conclusion, the path from creating a new cryptocoin to its maturity is not a walk in the park, but a gantlet of new problems appearing out of nowhere. Only the coins that can survive these trials will be worthy of their place in the future. One of the first issues a cryptocoin has to face is the issue of the blockchain getting bloated with spam and dust.