<p>Generally the definitions are as follows:</p>

<p>A Segwit transaction is any transaction which contains witnesses. This means that the transaction has at least one input which spends from a segwit output (P2WPKH, P2WSH, P2SH wrapped versions of those two).</p>

<p>A Segwit transaction does not have to produce any segwit outputs.</p>

<p>A transaction which produces segwit outputs but spends non-segwit outputs as inputs (so it does not have any witnesses) is not considered a segwit transaction.</p>

CC BY-SA 4.0
2018-06-08T22:56:42.570Z
Correct me if my understanding is wrong. A Tx is segwit or non-segwit is all about how you structure the data. I mean if you separate your signatures from inputs and place them as a witness, it becomes segwit. When consuming non-segwit outputs as inputs what prevents me from adding a witness to that new TX?
lch
CC BY-SA 4.0
2018-06-08T23:29:23.473Z
A transaction which consumes only non-segwit outputs is not allowed to have a witness. Doing so would result in a `wtxid` which differs from the `txid` which is not allowed for transactions which only spend non-segwit outputs.
Ava Chow
CC BY-SA 4.0
2018-06-08T22:44:18.190Z
2018-06-08T22:44:18.190Z
Ava Chow
<p>Which one is a segwit tx? A Tx that send outputs to a segwit address or A Tx that create inputs along with witness part? Which one?</p>

<p>should segwit tx necessarily produce outputs of type <code>witness_v0_keyhash</code>.</p>

<p>What about a Tx that has witness and send outputs of type pay-to-pubkey or pubkeyhash</p>

<segregated-witness>
What are segwit txs?
lch
# What are segwit txs?

(Asked by: username_0 on 2018-06-08)

Which one is a segwit tx? A Tx that send outputs to a segwit address or A Tx that create inputs along with witness part? Which one?

should segwit tx necessarily produce outputs of type `witness_v0_keyhash`.

What about a Tx that has witness and send outputs of type pay-to-pubkey or pubkeyhash

**Tags:** segregated-witness


---

## 1 answers

### Answer by username_1 on 2018-06-08. Score: 1 | Accepted answer

Generally the definitions are as follows:

A Segwit transaction is any transaction which contains witnesses. This means that the transaction has at least one input which spends from a segwit output (P2WPKH, P2WSH, P2SH wrapped versions of those two).

A Segwit transaction does not have to produce any segwit outputs.

A transaction which produces segwit outputs but spends non-segwit outputs as inputs (so it does not have any witnesses) is not considered a segwit transaction.

> **Comments:**
> **username_0**: Correct me if my understanding is wrong. A Tx is segwit or non-segwit is all about how you structure the data. I mean if you separate your signatures from inputs and place them as a witness, it becomes segwit. When consuming non-segwit outputs as inputs what prevents me from adding a witness to that new TX?  
> **username_1**: A transaction which consumes only non-segwit outputs is not allowed to have a witness. Doing so would result in a `wtxid` which differs from the `txid` which is not allowed for transactions which only spend non-segwit outputs.  

---

