I have gone through many research articles but couldn't find out what the minimum sizes of a transaction and a block are. Is there any reference where I can find an answer to my question?
1 Answer
There is no minimum size restraint on blocks and transactions. However, due to the nature of blocks and transactions, there is a practical minimum.
The smallest transaction I can think of is 60 bytes. It is a transaction that spends an OP_TRUE anyonecanspend output and creates 1 empty-scriptPubKey (i.e. anyonecanspend) output. The smallest block I can think of is 145 bytes. This is the 60 byte small transaction + 4 bytes for block height in that transaction + 80 byte block header + 1 byte for transaction count.
- Doesn't a block require a coinbase transaction? :)2017-06-19 18:36:51 +00:00Commented Jun 19, 2017 at 18:36
- 2Yes. The coinbase would be a 65 byte coinbase tx. The only output in that coinbase is an OP_TRUE anyonecanspend.2017-06-19 18:38:50 +00:00Commented Jun 19, 2017 at 18:38
- 1) What about the number of transactions in a block? Doesn't that contribute a byte? 2) Doesn't it take 5 bytes to encode a number bigger than 2^16? en.bitcoin.it/wiki/…Nick ODell– Nick ODell2017-06-19 20:21:27 +00:00Commented Jun 19, 2017 at 20:21
- 1) Oh, yes. I forgot about that. 2) Not for the block height. It's just a pushdata (1 byte) and the block height in little endian (3 bytes). It doesn't follow any of the standard integer sizes so it doesn't have zero padding. See bitcoin.org/en/developer-reference#coinbase2017-06-19 20:27:49 +00:00Commented Jun 19, 2017 at 20:27
- 2@amaclin coinbase transactions must have the outpoint. The txid of the outpoint must be all 0x00's, and the vout must be all 0xff's. The scriptsig must be at least 4 bytes for the block height (see bip 30). Then 4 bytes for the sequence, 4 bytes for version, 1 byte for input count, 1 byte for input length, 1 byte for output coint, 8 bytes for output value, 1 byte for script length, 1 byte for the output script, and 4 bytes for locktime. That's 32+4+4+4+4+1+1+1+8+1+1+4=652017-06-20 06:02:16 +00:00Commented Jun 20, 2017 at 6:02