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!

5

An address is a shortened notation for a particular script. As a transaction output contains exactly one script, it has at most one address (it is possible that the script does not correspond to a particular address, though).

Due to historic reasons, a (normal pay-to-pubkey-hash) address is however also used to refer to keys (by giving the address that would correspond to a script paying to the hash of that key). The array that decoderawtransaction and gettransaction return as 'addresses' is an example of this. For a (non-P2SH) multisig address, if it is a m-of-n multisig script, it will decode the script, and give the keys it pays to (in address notation).

  • 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 Sep 10 '14 at 16:34
  • 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 Sep 10 '14 at 17:41
  • 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 Oct 16 '14 at 16:55
  • 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 Oct 16 '14 at 18:23
  • I 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 Oct 16 '14 at 21:07
0

Can one UTXO send to multiple addresses?

No. UTXO is a destination/address/output/scriptPubKey/...

I know P2SH addresses can pay to multiple address

Wrong. P2SH outputs can be redeemed by holders of several (even none) private keys. P2SH-output is not splitting funds.

P2SH address, then can you determine what the requirements for redeeming from that address are?

Ususaly, no. Sometimes google and other search engines can help. P2SH-address is a hash of unknown script. It is not possible to construct script back from its hash.

  • Thank you, Amaclin. About the multisig addresses, I worded that incorrectly. I meant to say that multisig addresses involve many addresses in the spending from those addresses. Meaning, the reward is given to one address, and multiple private keys are required to formulate a script that can spend the money awarded to that multisig address. Correct? It is good to know that each UTXO rewards exactly one address. Is there any edge case, however, where a custom script could award two addresses in a script. – morsecoder Sep 9 '14 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.