<p>This seems to be an erratum in that note in BIP152.</p>
<p>The <code>getblocktxn</code> message contains a BlockTransactionRequests, which contains a list of differentially encoded transaction indices (i.e., the difference between the position a given requested transaction has in the block minus the previous requested transaction's position, minus 1).</p>

CC BY-SA 4.0
2023-12-22T16:09:07.110Z
Thanks. About that differentially encoding. Does it mean that if I am sending indexes in `cmpctblock` or `getblocktxn` message for 0, 1, 34, 65, 137 and 258 transaction, I will encode it like 0, 0, 32, 34, 71 and 120?
Cosmos
CC BY-SA 4.0
2023-12-22T16:16:01.820Z
No, as 0, 0, 32, 30, 71, 120.
Pieter Wuille
CC BY-SA 4.0
2023-12-22T16:18:05.180Z
Thanks. I made a mistake while calculating.
Cosmos
CC BY-SA 4.0
2023-12-22T15:19:17.120Z
2023-12-22T15:19:17.120Z
Pieter Wuille
<p>Reading BIP152 I see that the Short Transaction ID is used in the <em>cmpctblock</em> message. Depending on whether the transaction is segwit or non-segwit, WTXID or TXID will be used to calculate its Short Transaction ID. What is not clear to me is whether <em>getblocktxn</em> meesage uses the index of the transaction or this Short Transaction ID?</p>
<p>In the BIP it is written that the getblocktxn message uses the following structure:</p>
<p><a href="https://i.sstatic.net/szwEO.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/szwEO.png" alt="enter image description here" /></a></p>
<p>Based on that structure, indexes are sent.</p>
<p>However, the note for version 2 says the following:</p>
<blockquote>
<p>Short transaction IDs sent to us in cmpctblock messages, and sent by
us in getblocktxn messages, are computed using the same process as in
version 1, but using the wtxid as defined in BIP 141 instead of the
txid.</p>
</blockquote>
<p><strong>It is clear to me about <em>cmpctmessages</em>, but it says that the Short Transaction ID is also used in <em>getblocktxn</em> messages?</strong></p>

<message>
Is index or short transaction ID sent in getblocktxn messages?
Cosmos
# Is index or short transaction ID sent in getblocktxn messages?

(Asked by: username_0 on 2023-12-22)

Reading BIP152 I see that the Short Transaction ID is used in the *cmpctblock* message. Depending on whether the transaction is segwit or non-segwit, WTXID or TXID will be used to calculate its Short Transaction ID. What is not clear to me is whether *getblocktxn* meesage uses the index of the transaction or this Short Transaction ID?

In the BIP it is written that the getblocktxn message uses the following structure:

[![enter image description here](https://i.sstatic.net/szwEO.png)](https://i.sstatic.net/szwEO.png)

Based on that structure, indexes are sent.

However, the note for version 2 says the following:

> Short transaction IDs sent to us in cmpctblock messages, and sent by
> us in getblocktxn messages, are computed using the same process as in
> version 1, but using the wtxid as defined in BIP 141 instead of the
> txid.

**It is clear to me about *cmpctmessages*, but it says that the Short Transaction ID is also used in *getblocktxn* messages?**

**Tags:** message


---

## 1 answers

### Answer by username_1 on 2023-12-22. Score: 1 | Accepted answer

This seems to be an erratum in that note in BIP152.

The `getblocktxn` message contains a BlockTransactionRequests, which contains a list of differentially encoded transaction indices (i.e., the difference between the position a given requested transaction has in the block minus the previous requested transaction's position, minus 1).

> **Comments:**
> **username_0**: Thanks. About that differentially encoding. Does it mean that if I am sending indexes in `cmpctblock` or `getblocktxn` message for 0, 1, 34, 65, 137 and 258 transaction, I will encode it like 0, 0, 32, 34, 71 and 120?  
> **username_1**: No, as 0, 0, 32, 30, 71, 120.  
> **username_0**: Thanks. I made a mistake while calculating.  

---

