Skip to main content
1 of 2

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?