Author

Topic: Bitcoin-cli output addresses (Read 221 times)

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
January 20, 2020, 01:16:24 AM
#9
The hash of the transaction is: cbcd522e4452a059c414d4a74bc2779b6b0b238fbb473b5d12d1244cada648fb
Code:
         {
                "value": 0.0001,
                "n": 0,
                "scriptPubKey": {
                    "asm": "03fdf5a3fce8db7dee89724e706059c32e5aa3f233a6b6cc256fea337f05e3dbf7 OP_CHECKSIG",
                    "hex": "2103fdf5a3fce8db7dee89724e706059c32e5aa3f233a6b6cc256fea337f05e3dbf7ac",
                    "reqSigs": 1,
                    "type": "pubkey",  <--------THIS
                }
            },
Those outputs are P2PK and the result shows the pubkey not the pubkeyhash. There's no derived address which it should be.

Chainquery somehow displays an address for those type of outputs, maybe because it uses BitcoinCore Version 0.18.0.
0.19.0.1 have this in the changelog:
Quote
#16725 Don?t show addresses or P2PK in decoderawtransaction (NicolasDorier)
But it's for decoderawtransaction.
Is it because getrawtransaction verbose "true", decodes the raw transaction result like decoderawtransaction?

Off-topic: Those transactions looks like used for something else though.
I can't read anything from the OP_Return of the transactions that spent the outputs.
newbie
Activity: 16
Merit: 1
January 19, 2020, 09:30:02 AM
#8
Thank you for your answers. Now I have stumbled upon a different peculiar situation that is related to output addresses so I did not want to create another thread.

My bitcoin-cli returned to me an output of a transaction, that has no "address" attribute, but when I checked the bitcoin-cli hosted on the internet, there is the "address" attribute. Why are these two different? I downloaded the whole blockchain twice and the situation is the same. I guess bitcoin-cli would throw an error, if there was a corrupted chunk of data. Here is the screenshot: https://imgur.com/a/X0NkIeE

The hash of the transaction is: cbcd522e4452a059c414d4a74bc2779b6b0b238fbb473b5d12d1244cada648fb

legendary
Activity: 2534
Merit: 6080
Self-proclaimed Genius
January 14, 2020, 11:17:59 AM
#7
So let's say, that there is a multisig transaction, where on the output are 2 addresses. Who can then spend this output? Either one of those two?
Depends on what's indicated by the script, to check, use the JSON object result from 'getrawtransaction':

Check if it has "reqSigs", that's the number of required signature in order to spend that output.
If '1' and there are two addresses, then either one of those.

Or if there's no "reqSigs"(in some non-standard p2ms scripts), check the output's "asm": The first digit separated by space is the required signature, then the public key(s), the digit after another space indicates how many public keys are included.
sr. member
Activity: 279
Merit: 435
January 14, 2020, 04:55:55 AM
#6
Hi,

Oh, I see.

So let's say, that there is a multisig transaction, where on the output are 2 addresses. Who can then spend this output? Either one of those two?

No you need to create a transaction (`createrawtransaction`) and sign it with both of the corresponding public keys. Here is a step-by-step that might be useful for you.
newbie
Activity: 16
Merit: 1
January 14, 2020, 04:45:27 AM
#5
Oh, I see.

So let's say, that there is a multisig transaction, where on the output are 2 addresses. Who can then spend this output? Either one of those two?
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
January 14, 2020, 04:22:25 AM
#4
OK. Sorry.
That other array is for multisig transactions. I had to research myself and one example is https://bitcoin.stackexchange.com/questions/25767/why-is-it-possible-to-have-multiples-addresses-in-an-output-of-a-transaction

Edit: fun fact, even the page I initially linked doesn't know how to handle multisig
newbie
Activity: 16
Merit: 1
January 14, 2020, 04:15:27 AM
#3
Yes. I get why a single transaction has more outputs. But I am asking something a little bit different. https://imgur.com/a/fcr3ies

On the image, there is a crop of a bitcoin core API documentation. It returns array of vout objects, which corresponds to a number of outputs. I understand that. But I marked a part, where a single output has array of addresses. That is the thing I don't understand.
legendary
Activity: 3668
Merit: 6382
Looking for campaign manager? Contact icopress!
January 14, 2020, 04:04:14 AM
#2
You can do a test with https://chainquery.com/bitcoin-cli/getrawtransaction
Just enter the hash b90df5b2583c5be0caeac08aa6f19e9572eb946abface8dcb98a37c029d3aff4
And don't forget to put verbose = true
Also you can see it in explorer: https://btc.com/b90df5b2583c5be0caeac08aa6f19e9572eb946abface8dcb98a37c029d3aff4
It was a random tx from the last block, you can just pick any other tx.


Now for your question: a proper transaction will almost always send some coins to destination and some change to a change address in the sender's wallet. That's already 2 outputs.
newbie
Activity: 16
Merit: 1
January 14, 2020, 03:53:23 AM
#1
Hello.

I was looking at the specification of bitcoin-cli API, and I found, that the command "getrawtransaction" returns array of addresses on the output. When I was looking at various blockchain explorers, single output of the transaction had always exactly one address in it. What does it mean, when there are more addresses on the output in the bitcoin-cli?
Jump to: