Can a microblock be empty?

I found this block in my node mh_DB8TVjH4cEzsogAT54fLHAzEejJXqZESGD3qvwe875EC8TCxf
that has no transations. My middleware got stuck on it and I had to add a trap for this. I thought it was not possible to get an empty microblock. Is this expected?

1 Like

Nothing in the protocol forbids empty microblocks as far as I know.

The nodes will not normally produce empty microblocks; if there are no transactions in the mempool it will do nothing. It could be that if there is only invalid transactions in the mempool it could be tricked into producing an empty microblock - but I haven’t checked.

2 Likes

Interesting, I would think that an empty microblock would not happen if there are no transactions to be added, it certainly has not happened before. Why would there be only invalid transactions in the mempool? and, would those transactions produce more empty microblocks in subsequent blocks if there is not a single valid transaction to add to them?

1 Like

No, if there are no transactions there won’t be a microblock.

Invalid transactions can happen for many reasons, for example someone could have pushed a tx with a slightly too high nonce, or someone could have posted a couple of Txs and then can’t afford the fee for the last one etc…

In order for the miner not to try invalid Txs in vain it keeps a local list of invalid Txs, but this list is reset when a new keyblock is mined (the Txs might have become valid during the last generation!) So what I think happened is that when the miner produced the key block it had a bunch of invalid transactions in its mempool, but no valid ones, thus it got a candidate list with just invalid transactions and promptly produced an empty microblock. This won’t be very common, but I doubt it was the first time it happened - but I can’t be arsed to check :slight_smile:

3 Likes

Don’t worry, I can be arsed to check, and I have. I had a check in my middleware that literally goes and fetches all transactions from every microblock it finds, and after it has fetched all the microblock’s transactions it counts them. If there is a Block with One microblock (just the one) and it has no transactions my program would have thought this was incorrect and it would have failed making it unable to move forward. This exact case has happened exactly once after indexing the blockchain from start at the release of 5.5.4.

Though I can’t tell you this very moment if there were any other microblocks with no transactions (thought it shouldn’t be too hard as I have a table with all those indexed already and I just have to write the query itself). So, I am almost 99.999% this is the first time that a block has a single microblock that had no transactions.

---- EDIT ----
I ran the index, and I made the query, I found the first empty microblock to be mh_2FRJHNu9YhxK7iE9FWQ2AXHHA7fyTCe7RzbyDNM52bvUR5H3mA

however, as I said, the first microblock to be empty and the sole microblock inside a block is mh_DB8TVjH4cEzsogAT54fLHAzEejJXqZESGD3qvwe875EC8TCxf

I am doing some verification but I have a list of 875 microblocks that seem to be empty.

2 Likes

Great! That would match my intuition, there are some empty microblocks but not very many, and generations with just a single empty microblock should be really uncommon (but not impossible)
:slight_smile:

1 Like