6

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?

Murch
  • 71,155
  • 33
  • 180
  • 600
DOLLY PATWA
  • 585
  • 2
  • 9
  • 16

1 Answers1

10

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 61 bytes. It is a transaction that spends an OP_TRUE anyonecanspend output and creates 1 OP_TRUE anyonecanspend output. The smallest block I can think of is 146 bytes. This is the 61 byte small transaction + 4 bytes for block height in that transaction + 80 byte block header + 1 byte for transaction count.

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
  • Doesn't a block require a coinbase transaction? :) – Murch Jun 19 '17 at 18:36
  • 2
    Yes. The coinbase would be a 65 byte coinbase tx. The only output in that coinbase is an OP_TRUE anyonecanspend. – Andrew Chow Jun 19 '17 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? https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer – Nick ODell Jun 19 '17 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 https://bitcoin.org/en/developer-reference#coinbase – Andrew Chow Jun 19 '17 at 20:27
  • coinbase transaction can be less than 65 bytes, because it doesn't have scriptSig+input refs.btw, the input/output scripts for regular tx can be 0 byte length, the output script of coinbase can be 0 byte length also – amaclin Jun 20 '17 at 05:56
  • 1
    @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=65 – Andrew Chow Jun 20 '17 at 06:02
  • oups. you are right. but the output script can be empty. https://blockchain.info/tx/3cfc0c04c8d2eec403455cafe4e83977b3da95babd00265271e5520b6958a167 – amaclin Jun 20 '17 at 07:21