I was playing around with my Bitcoin Node, to try and understand how does Bitcoin Transactions work.
For this purpose, I used the
sendtoaddress API call for bitcoin-cli, to send some XBT to my own Bitcoin Blockchain.Info wallet. The transaction was processed, and I was trying to understand the information that I get from
gettransaction bitcoin-cli command, and the information that the Blockchain.info website shows about the transaction.
So, here is what I did:
I've generated a receiving address for myself in Blockchain.Info (
In my Bitcoin node, I used the following command:
bitcoin-cli sendtoaddress 17tzZwAi722L7V8V27bUGEKwJpRYVNRKVW 0.001
This gave me back a transaction id:
- I then checked the information that the bitcoin node gives about that transaction with:
bitcoin-cli gettransaction 4f299e7313af7e4e091ea519bbf5983526d18fe4765b679ce1827bd9f75dbaff
What I noticed here is that the bitcoin-cli command gave me back the address I sent the money to, the fee it took to get the address, but it didn't tell me from which address the transaction was sent from.
Then I checked the information that Blockchain.info provides about the transaction: https://blockchain.info/tx/4f299e7313af7e4e091ea519bbf5983526d18fe4765b679ce1827bd9f75dbaff
Here, it can be clearly seen that an amount of
0.06611392 BTC was sent from
12bFMAPz7dhKmLxsoipfUqmCCjqENCDzKb XBT address, to two different outputs. One of the output is the address, Blockchain.Info gave me to receive the Bitcoin. The other output is an address unknown to me.
So I started thinking: Am I correct, that when sending a bitcoin transaction, all of the amount from a specific address gets placed in the input, a part of it(the part which I specify) gets sent to the address I wish to send, and the rest gets transfered to a newly created address on the same wallet, from which the send operation was initiated?
Some other questions which arise to me: How is Blockchain.Info able to retrieve information from any kind of Bitcoin Transaction, while I, using a full Bitcoin Node, can only find transactions which was either initiated by the node, or which has a receiving address which is in the nodes wallet?