Skip to main content
2 of 2
added 271 characters in body

How do I determine whether an input or output is segwit?

I'm trying to go through the transactions in a block and determine how many segwit inputs or outputs there are.

I've noticed in getrawtransaction that segwit inputs seem to have a 'txinwitness' field. Is that a good way to classify them?

For outputs I know I can't just look at the 3* address because not all p2sh are segwit. So what's the best way there?

EDIT: I just found this page about 3* addresses. Difference between a SegWit address and a P2SH address

Am I correct in interpreting this to say that you can't determine whether an output is segwit? Only an input?