9
How is the blocksize currently calculated in Bitcoin Core? I'm specifically asking about how it's done for the purposes of enforcing the 1MB limit. If it's done by calculating the serialization length, what serialization format is used?
9
How is the blocksize currently calculated in Bitcoin Core? I'm specifically asking about how it's done for the purposes of enforcing the 1MB limit. If it's done by calculating the serialization length, what serialization format is used?
7
The block size is the combination of the block header and the list of transactions. Specifically, the block header has these fields:
So the total bytes for a block header is 4 + 32 + 32 + 4 + 4 + 4 = 80 bytes
After the block header is the list of transactions which is
Transactions can vary greatly in terms of the number of bytes, but the general serialization of a single transaction is:
Each tx in has these fields:
Each tx out has these fields:
The sum total of all these things in a block determine the size, which currently has to be less than 1 MB.
1 – Josh Cincinnati – 2015-11-03T01:50:46.700
Don't know the exact answer, but these code snippets from bitcoin-core might help:
https://github.com/bitcoin/bitcoin/blob/master/src/consensus/consensus.h#L10
https://github.com/bitcoin/bitcoin/blob/master/src/main.cpp#L2640
https://github.com/bitcoin/bitcoin/blob/master/src/serialize.h