Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: btcjoe99 on October 26, 2020, 08:46:22 PM



Title: Bitcoin getrawtransaction address array in vout
Post by: btcjoe99 on October 26, 2020, 08:46:22 PM
Hi,

While doing some work on a node and playing with the data for a project, I am running into some issues with the multiple addresses in one VOUT of a transaction (addresses array)

It is clear to me (thanks to search function) that this is due to multi-sig transactions and those are the only ones with more than 1 address in 1 output.

How does that work? If a VOUT goes to 2 public keys, are both getting a UTXO to their public key and can spend it or either one of those 2 can spend it?
so if i would like to "follow the money", I would need to track both public keys for further transactions?

If someone could give me some insight, I would be very thankful. Also what if its 4 out of 8 or 2 out of 2. does that make a difference?

Cheers

Joe


Title: Re: Bitcoin getrawtransaction address array in vout
Post by: achow101 on October 26, 2020, 09:38:20 PM
The multiple address output there is misleading and never should have been added in the first place.

The multiple addresses mean that it is a multisig so that txout requires some number (defined by the scriptPubKey) of the specified pubkeys to sign the spending transaction. There are no multiple UTXOs nor does the UTXO magically split for the cosigners. It is a single UTXO that requires multiple people to spend it. It's the same thing as a normal multisig in a P2SH or P2WSH, just that the "redeemScript" is in the scriptPubKey of the output, rather than the hash of it.


Title: Re: Bitcoin getrawtransaction address array in vout
Post by: nc50lc on October 27, 2020, 08:21:53 AM
Also what if its 4 out of 8 or 2 out of 2. does that make a difference?
For both P2MS and P2SH Multisig: the former is the number of required signatures and the latter is the total number of public keys it has.
eg.: 4 out of 8  = 4 signatures / 8 public keys | 2 out of 2 = 2 signatures / 2 public keys.

If it's "of 8", you'll see 8 public keys. (in your case, 8 addresses)
Bitcoin Core wont show those as addresses if you decode the RAW txn BTW.


Title: Re: Bitcoin getrawtransaction address array in vout
Post by: btcjoe99 on November 01, 2020, 12:49:03 PM
The multiple address output there is misleading and never should have been added in the first place.

The multiple addresses mean that it is a multisig so that txout requires some number (defined by the scriptPubKey) of the specified pubkeys to sign the spending transaction. There are no multiple UTXOs nor does the UTXO magically split for the cosigners. It is a single UTXO that requires multiple people to spend it. It's the same thing as a normal multisig in a P2SH or P2WSH, just that the "redeemScript" is in the scriptPubKey of the output, rather than the hash of it.

That is clear to me now. What I don't understand yet is why there is no address in VOUT for a coinbase transaction. I am referring to the getblock rpcapi that is somehow not consistant with getrawtransaction (verbosity 2).

The only place where one can see the output "sent" to is in VOUT in the address array correct? is there any other field containing this information?



Title: Re: Bitcoin getrawtransaction address array in vout
Post by: achow101 on November 01, 2020, 04:02:06 PM
That is clear to me now. What I don't understand yet is why there is no address in VOUT for a coinbase transaction. I am referring to the getblock rpcapi that is somehow not consistant with getrawtransaction (verbosity 2).
The same code is used for address decoding. Not all outputs correspond to addresses, so not all outputs will have an addresses field. This is especially true for old coinbase outputs because those made P2PK outputs and those don't have addresses.

The only place where one can see the output "sent" to is in VOUT in the address array correct? is there any other field containing this information?
Yes.