0
I see two ways:
Txid + index
Txid + script hash
Pros of the txid + index:
- Simple and short
Cons of txid + index:
- It relies on array iteration being deterministic and all third party services using the same iteration method.
Txid + script hash does not rely on iteration order and since script hashes are stored on the blockchain they are not malleable after 6 confirmations.
Which would be the preferred way to go?
3What if there are two outputs of the same transaction with the same scriptPubKey, but different amount? Also why would index not be deterministic? Transactions have a well defined order of their outputs. It's also not a question, as the Bitcoin protocol requires referring to the output being spent using txid+index. – Pieter Wuille – 2019-03-02T18:02:33.050
@PieterWuille Great points, didn't consider multiple identical scripts having different amounts. That completely excludes that option. I will rely on txid+index like bitcoin then. Thanks a lot! – Soggiorno – 2019-03-02T18:16:37.227