Segwit Usage chart example : https://p2sh.info/dashboard/db/segwit-usage?orgId=1

I Would like to verify by checking tx if it's Segwit Transaction or not.

Is there any simple method to do this?

  • legacy -> P2SH tx (Is this Segwit Transaction?)
  • P2SH -> legacy tx (Is this Segwit Transaction?)
  • bech32 -> legacy tx (Is this Segwit Transaction?)

What about when many types of addresses are set as inputs and outputs?

1 Answer 1


A transaction is a segwit tx if at least one of the inputs contain a witness. Or if you are inspecting the raw tx then you check the 5th byte (the input count) and if it is 0x00 then it is a segwit tx.

Example: tx1


is not a segwit tx because the input count is 0x05 = 5



is a segwit tx because the input count is 0x00 = 0


  • Transactions spending P2PKH inputs (address starting with 1) cannot be segwit.
  • Transactions spending P2SH inputs will be segwit if they are nested P2SH, otherwise not.
  • Transactions spending P2WPKH or P2WSH (starting with bc1) will be segwit.

In your example:

legacy -> P2SH

This cannot be a segwit tx because it spends inputs from a legacy address

P2SH -> legacy

This can be a segwit tx if the address is P2SH-P2WPKH or P2SH-P2WSH (nested segwit into P2SH). You wouldn't know if it is nested if it's not your's unless someone has already spent from it (in which case you inspect the spending tx).

bech32 -> legacy

This is always a segwit tx


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.