2
1
The 'decoderawtransaction' RPC method of the Bitcoin-QT client gives a JSON object with an array of addresses in each UTXO. For example, when I run:
decoderawtransaction "01000000010fb72b5d299f095c3d3abc2130f20ce59d0ed08d56b3f247d6ae554f200eb561010000006a473044022073717edfcde0200f8aca33b6ff4f60a4aa84c6692cd1713876d94f3f19013f6d022057610074eef8285082cb9943913040031869cc98bc71642a3dc5e085a19a1805012103f071bc0f54b95e9049ba515f19cbfb647605a9f1d2f002b4e70ec548af5fbf5bffffffff02b02bc37d010000001976a9148037b2fd4114347070236b37f792966ade2bc4a688acd0ce4101000000001976a914336e5078d05a350fb5e6cdf8fc15d826e625423888ac00000000"
I get back the following JSON:
{
...
"vout":[
{
"value":64.04910000,
"n":0,
"scriptPubKey":{
"asm":"OP_DUP OP_HASH160 8037b2fd4114347070236b37f792966ade2bc4a6 OP_EQUALVERIFY OP_CHECKSIG",
"hex":"76a9148037b2fd4114347070236b37f792966ade2bc4a688ac",
"reqSigs":1,
"type":"pubkeyhash",
"addresses":[
"1CgxDbrb9d18DFvQn6DW8ij3c6ARpipehU"
]
}
}
]
...
}
You can see here that "addresses" is an array. Why is this an array? Can one UTXO send to multiple addresses? I know P2SH addresses can pay to an address that can be redeemed by the use of multiple addresses, but I'm wondering about sending to multiple addresses without the use of P2SH addressses. What would be the format of the scriptSig/scriptPubKey for doing so?
Also, if you only have the P2SH address, then can you determine what the requirements for redeeming from that address are?
Thanks!
Interesting, thank you Pieter. So, this list seems to be just a list of all the addresses that were used in the 'scriptPubKey', right?. And if there is only one address used then the coins can be thought of as crediting the balance of that address. But if more than one address used in the script (like in a raw multisig transaction without P2SH), then the script does not correspond to a particular address and cannot be thought of as crediting the balance of any of the included addresses. Does this all sound right? – morsecoder – 2014-09-10T16:34:32.637
Crediting the balance of (some aggregate of the included keys). The 'addresses' listed are not really addresses - just keys formatted as the address it would be if that were the only key. – Pieter Wuille – 2014-09-10T17:41:27.490
Thank you, Pieter. Do you know of any examples of a transaction that would have multiple addresses (keys) returned in the "addresses" JSON array? I'm looking for a link to a transaction in a block explorer that uses raw multisig like this, but can't find one. – morsecoder – 2014-10-16T16:55:20.170
I found one here. But when I decode this transaction using my own QT wallet (debug console), the scriptPubKey "type" is just non-standard, and there isn't an addresses array. Will it ever be the case that there is more than one address in the "addresses" array? I can't find a case with more than one. Outputs that pay to P2SH addresses also just have a single address in the "addresses" array.
– morsecoder – 2014-10-16T18:23:52.903I just found this transaction, which illuminates things for me. If it's an n of m raw multisig address, all m addresses are given in the scriptPubKey array.
– morsecoder – 2014-10-16T21:07:49.530