user61173: 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

user48884: 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.

61173: <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>
 48884: <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>
