<blockquote>
<p>I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.</p>
</blockquote>
<p>This is not a problem that occurs. Unconfirmed transactions (ones not yet in blocks, or kept in the mempool) are indexed by their txid, and the witness data is stored along with the transaction. When a node needs to find the witness data for a given txid, it just looks in its index.</p>

CC BY-SA 4.0
2023-09-07T17:25:28.443Z
Understood, your time is much appreciated - thank you.
Nicholas Sandomeno
CC BY-SA 4.0
2023-09-07T17:22:42.510Z
2023-09-07T17:22:42.510Z
Pieter Wuille
<p>I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.</p>
<p>I see that eventually a witness TXID is calculated and included in a Merkle Tree of all SegWit transactions for a block but I'm unsure if:</p>
<p>(a) this creates the link I'm looking for or...</p>
<p>(b) how you would do so before that Merkle Tree of SegWit transactions is appended to the block.</p>

<segregated-witness><witness-data>
What mechanism is used by nodes to link Witness data to its Transaction?
Nicholas Sandomeno
# What mechanism is used by nodes to link Witness data to its Transaction?

(Asked by: username_0 on 2023-09-07)

I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.

I see that eventually a witness TXID is calculated and included in a Merkle Tree of all SegWit transactions for a block but I'm unsure if:

(a) this creates the link I'm looking for or...

(b) how you would do so before that Merkle Tree of SegWit transactions is appended to the block.

**Tags:** segregated-witness, witness-data


---

## 1 answers

### Answer by username_1 on 2023-09-07. Score: 0 | Accepted answer

> I am stuck in developing an understanding of how a node could go from SegWit TXID to lookup Witness data, or vice-versa.

This is not a problem that occurs. Unconfirmed transactions (ones not yet in blocks, or kept in the mempool) are indexed by their txid, and the witness data is stored along with the transaction. When a node needs to find the witness data for a given txid, it just looks in its index.

> **Comments:**
> **username_0**: Understood, your time is much appreciated - thank you.  

---

