TL;DR. Changing all Numbers to CompactSize can effectively clean up 3.5%-5.5% (up to 50 KB) of wasted block sizes and open up room for additional transactions.
Ever since I saw this
irrelevant question I have been working on this theory that transactions are wasting some space the way they are.
For instance, the
first field is
Version which is wasting 3 bytes where it only needs 1 byte. Ever since the first transaction in 2009 version was 1 and any change will not shoot it up to 253 (the first value which needs 3 bytes in CompactSize)
The same goes for the following:
- Version: for the past 7 years version was 1
- lock_time: Almost all transactions are using 0
- index (in Outpoint): Most transactions are 0 and are less than 253
- Block version: Blocks start with 2
And the thing is that these numbers can be defined as a
CompactSize Unsigned Integers freeing up those extra bytes.
I ran some statistical analysis on some random blocks between 440300 and 441300 heights and medium results are as follows:
Note: These numbers of average of about 20 random blocks.
Tx Count: 2,298
Average TxSize: 541 (bytes)
Clean Up Size: 46501 (bytes)
Clean Up %: 4.16%
Additional Tx that can be added after clean up: 94
NOTE: This is not limited to current block size but it is applicable to now and the possible future and the bigger the block size the bigger the effect of this change.
DOWNSIDE: I believe it requires a hardfork which will also be not-backforward-compatible.p.s. I have created this topic to get some feedback on this opinion before I go ahead and increase the number of blocks I analyze. Each block is 2 MB raw data
p.p.s. I can also share the code I used for this whole Analysis and Changing.Coded in C♯
https://github.com/Coding-Enthusiast/BitcoinBlockSizeChange