6
3
I am implementing a library for tracking wallet balance of given bitcoin addresses.
How should the transaction output script be parsed to find if the output belongs to the given address?
Is it dirty if I just match pay-to-pubkey-hash and pay-to-script-hash transaction by simply matching
OP_DUP OP_HASH160 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx OP_EQUALVERIFY OP_CHECKSIG
and
OP_HASH160 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx OP_EQUAL
or should I implement more sophisticated script parser which can detect "non-standard" scripts as well?
1You have forgot about bare multisig outputs – amaclin – 2015-01-14T10:42:28.433
Isn't multisig also wrapped inside P2SH? – Jus12 – 2017-12-31T14:19:02.053
@Jus12 Conventionally, but there's no protocol rule requiring that. – Nick ODell – 2017-12-31T20:08:21.840