# Witness data

The witness is the part of a SegWit transaction holding signatures and unlocking data. It sits outside the txid and is discounted. Learn how it works.

Canonical page: https://mybitcoinexplorer.com/learn/witness-data
Topic: Bitcoin Script
Published: 2026-10-29
Updated: 2026-10-30


## What's in it
For each input, the witness holds a list of items: the data needed to satisfy that input's lock.

| Spending | Typical witness items |
|---|---|
| P2WPKH | signature, public key |
| P2WSH multisig | empty item, signatures, the witness script |
| Taproot key path | one 64-byte signature |
| Taproot script path | script inputs, the script, a control block |

## Where it sits
In serialized transactions, the witness comes after the outputs and before the locktime. See [Anatomy of a raw transaction](https://mybitcoinexplorer.com/learn/anatomy-of-a-raw-transaction).

> Diagram: Witness data sits outside the part used for the txid — Version:4,Inputs:var,Outputs:var,Witness:var,Locktime:4

## Committed separately
Because the [txid](https://mybitcoinexplorer.com/learn/transaction-id-txid) excludes the witness, blocks need another way to commit to it. The [The coinbase transaction](https://mybitcoinexplorer.com/learn/coinbase-transaction) includes a **witness commitment**: an [OP_RETURN data outputs](https://mybitcoinexplorer.com/learn/op-return) output holding the merkle root of every transaction's **wtxid** (the hash that includes witness data).

## Discounted
Witness bytes count as 1 weight unit instead of 4. See [Transaction size, weight and vbytes](https://mybitcoinexplorer.com/learn/transaction-size-and-weight).

> Taproot script paths allow larger witness data, which is how inscriptions are stored. Policy and debate around large witness data continue in the Bitcoin community.


## Reading a witness on MyBitcoinExplorer
Open any SegWit transaction and look at the raw data: after the outputs comes a witness stack for each input. For a typical bc1q spend it holds two items: a signature (about 71 bytes) and a public key (33 bytes).

## Why witness data could be discounted
Witness data is needed to validate a transaction once, but it doesn't change the UTXO set nodes must keep. Discounting it rewards transactions that put less long-term burden on every node.


## Key takeaways

- The witness carries each input's unlocking data.
- It's excluded from the txid but committed via the coinbase witness commitment.
- Witness bytes are discounted to a quarter weight.

## Common questions

### Do legacy transactions have witness data?

No. Their unlocking data is in the scriptSig inside each input.

### What is a wtxid?

A hash of the full transaction including witness data.

### Is witness data stored forever?

It is part of each block, so archival nodes keep it; pruned nodes eventually delete old blocks including witnesses.

### Do legacy inputs have witnesses?

No. Their unlocking data is inside the input's scriptSig.

## Related lessons

- [Segregated Witness (SegWit)](https://mybitcoinexplorer.com/learn/segwit)
- [Transaction size, weight and vbytes](https://mybitcoinexplorer.com/learn/transaction-size-and-weight)
- [Transaction IDs (txid)](https://mybitcoinexplorer.com/learn/transaction-id-txid)
- [Taproot](https://mybitcoinexplorer.com/learn/taproot)
