# How does block time depend on number of transactions and block size?

I've been browsing http://moneroblocks.info while waiting for my transaction to get through and noticed what seems to be a strong correlation between number of transactions in a block and block time:

I looked at the 50 blocks from height 1120832 to 1120881. If I counted correctly, out of the 12 blocks in that interval containing 5 or more transactions (according to that block explorer), 10 blocks took more than 5 minutes, and only 2 blocks less than 5 minutes, while the targeted average block time is 2 minutes.

My uneducated guess now would be that dynamic block size adaptation somehow kicks in here, but I have no idea how the underlying mechanism causes block time increase.

Right now, it's basically a 1:1 relationship in the long term for a very basic reason. According to moneroblocks.info, there have been roughly 8100 transactions in the past week. Since there are 10080 minutes in a week, that means there have been approximately 8 transactions every 10 minutes.

I'm going to go out on a limb and say this have been a higher-volume week due to the big price spike and news, and use a smaller number of 5 transactions every 10 minutes for the rest of my answer. Why 5 every 10? Because for a two minute block size, that means 1 transaction every block on average.

The on average bit is important. Monero has a two minute block time, but blocks aren't always exactly 2 minutes... they just aim to average to be 2 minutes. Sometimes a block takes 10 seconds, other times it takes 10 minutes. And this is the whole crux of why longer blocks seem to have more transactions.

Basically, if we see a transaction on average every 2 minutes, and we get a number of 10 minute blocks, we should see approximately an average of 5 transactions in those long blocks. Likewise, if we see a number of 1 minute blocks, we should see approximately an average of 0.5 transactions per block.

Disclaimer

This is all based on the assumption that transactions are basically included in blocks right away. At very heavy usage times, we could see a backlog of transactions like Bitcoin has at times experienced, and as a result see a bunch of blocks in a row that all have similar large numbers of transactions regardless of how much time has passed. This gets muddied by the variable block limits in Monero, but is beyond the scope of this question.

I think you would need a larger sampling than 50 blocks to see if that pattern is true. There are many patterns that I've "seen" in Monero, but they've just turned out to be anomalies.