1

I want to implement this, so does anyone have a formula for adaptive blocksize?

I only found this:

if(average size of last 4096 blocks*4>maxblocksize && 
   median size of last 4096 blocks *8>maxblocksize)
        maxblocksize = (average size of last 4096 blocks*4)
3

You must have read this article and are looking to implement dynamic block size limits. You should know that it's not just a simple formula though that only affects one piece of code, it's more complicated than that.

I know of a few coins that have done this. Monero, Cryptonote, and ziftrCOIN. The latter is the one I am the most familiar with, so I'll explain how the solution works.

First, the block size and chain size is added to the block index. Then, whenever the tip of the chain is updated, the code checks, once every 3 months, to see if both:

  • The average block size is greater than 2/3 of the current limit.
  • The median block size is greater than 1/2 of the current limit.

If both are true, then it allows the maximum block size to increase by 10%. If this happened regularly for 2 years, the maximum block size would approximately double.

3
  • Be careful with solutions like that, it sounds easily manipulated, and the problems introduced could be worse than the ones it is trying to solve :p Just kidding, thanks I will use the Ziftr code! – Muis Mar 20 '15 at 21:13
  • @Muis, Haha, that's good advice :P One of the main arguments I've heard against dynamic block sizes limit is that miners could form these 'cartels' and block other miners from participating by forcing extremely large block sizes. But a few pool operators could do this anyway by colluding to only mine on top of each others blocks. – morsecoder Mar 20 '15 at 21:49
  • Why does ZiftrCOIN check both the average and median? It seems like in all circumstances where the average is greater than 2/3 the limit, the median is also greater than 1/2 the limit. – Nick ODell Mar 20 '15 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.