Why is the Block Header txn_count field always zero?



According to the Protocol Specification, the txn_count field of a Block Header is always set to 0, why is that? What are the intended future uses of this field?


Posted 2011-12-01T00:16:58.927

Reputation: 42 235



The headers message is sent in response to a getheaders message.

The txn_count is always 0 simply to make the parsing of this packet compatible with the parsing of the block message.

getheaders is designed to be used by a simplified client, however since there is no way to get partial merkle branches using the standard protocol this cannot actually be done.


Posted 2011-12-01T00:16:58.927

Reputation: 56

The author was correct when he wrote this, although it is now possible to get partial headers (using Bloom filters) – Streblo – 2013-05-11T22:50:13.920


Because no transactions are included in the message. I don't think there is any intended future use.


Posted 2011-12-01T00:16:58.927

Reputation: 8 416

You mean transactions (Txs)? One could technically state how many of them there are in the original block, but then it would be a varint and the header would be of variable byte length. – ThePiachu – 2011-12-01T10:12:40.853

Yeah, that's what I meant. I edited it. The protocol specification seems to be in error when it says that blocks normally have varint tx counts (or that headers don't). Headers are standard CBlock objects with the tx vector left empty, so the types are the same. – theymos – 2011-12-01T10:57:41.190