3

I need to prevent empty blocks from being added to my blockchain.

This is for a very small scale chain, in which 99.99884% of blocks are empty, so not adding empty blocks will dramatically reduce the size of the chain.

Simply increasing the block time doesn't solve this for me as the transactions still need to be finalized quickly.

If there are no transactions, no blocks should be produced.

I can't seem to find where I could do this. Thanks.

7
  • 6
    guess a customized consensus like instant seal is what you actually need
    – Ron
    Apr 10, 2022 at 10:15
  • 3
    Epoch-based consensus algorithms such as babe and aura require to periodically produce blocks in order to allow to trigger some events at the end of each epoch (e.g. for babe => authorities set and rand seed change). This information is embedded within the block using the so called Digest entry. Apr 10, 2022 at 11:27
  • Assuming that there is an implementation of some consensus algorithm that is safe if validators don't produce blocks, there should be some high-level runtime logic that panics (making the block invalid) if there are no transactions.
    – rob
    Apr 10, 2022 at 20:04
  • @Ron awesome. Seems like a great starting point for what I need. I'll take a deeper look at that. Apr 11, 2022 at 2:00
  • 1
    @rob For my particular use case, something simple similar to instant seal should work fine, but for reference, Avalanche consensus doesn't need to produce blocks when there are no transactions. medium.com/avalancheavax/avalanche-consensus-101-99c68a3e3159 It's more than what I need, but if anyone wants to implement this for substrate, I'd be happy to collaborate. Apr 11, 2022 at 2:16

1 Answer 1

-1

Using On finalized could you blow up the block's weight if there were no transactions in it so that it then skips that block? ( Do `on_finalized` and `on_initialize` impact block weight budget? )

That said if it created overweight blocks all the time then probably the networking code might start to shun your collator...?

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