0
Reading this thread about determining the sending address of a bitcoin transaction. I'm a bit confused, how do you differentiate between the change address and the "receiving" address of the last transaction?
txid = <relevant transaction id>
addresses = []
raw_tx = decoderawtransaction(getrawtransaction(txid))
for(input in raw_tx['vin']) {
input_raw_tx = decoderawtransaction(getrawtransaction(input['txid']))
addresses.push(input_raw_tx['vout'][input['vout']]['scriptPubKey']['addresses'] [0])
}
Would addresses not include other outputs that are unrelated to the sending address? I'm trying to build a block explorer and I'm uncertain how to determine which address sent coins in each transaction. Is it possible to tell?
Payments are not sent from addresses, they're only sent to addresses. – David Schwartz – 2013-08-04T18:22:33.537
Is that to say there is no way to tell with 100% certainty which address signed a transaction into the network? – bvpx – 2013-08-04T21:30:59.723
1You can tell which address(es) keys were used to sign the transaction, but that doesn't tell you who sent the transaction, only what keys were needed to sign it. – David Schwartz – 2013-08-05T03:07:54.110
Let's say a website has online wallets, and each account is given an address which they can send coins to other addresses on the site from. Considering the site controls every RPC call of all of these addresses, and you always use the
sendfromcommand, is it true that you'd be able to tell which address signed each transaction? Is there any possibility for abuse if the users of the site don't have access to the private keys? (I'm thinking of making a color coin type app, with small transaction amounts, but very long delays between transactions to avoid spam of the network). – bvpx – 2013-08-05T05:14:03.647I can't see how that would work, unless the site sends each transaction twice, first to the source it needs to send them from for the real send. To the extent you can send funds "from" an address, it must be the address those funds were last sent to. Also, I'm not sure this would help -- people wouldn't, in general, know transactions came from this site so even if this site could make the information reliable, people wouldn't know it was reliable and so couldn't rely on it. – David Schwartz – 2013-08-05T06:43:38.947
Could the site not provide a signed message to prove it owns an address? The idea is that the "color coin" within this network of people should not be sent outside of the network and is tracked by the site itself, which validates sending and receiving bits of that color coin amongst users of the site. It's simply using the blockchain to recognize these transactions publicly. – bvpx – 2013-08-05T18:20:16.367
Yeah, but I think that would be an example of an entire class of silly answers to the question you asked. You can be 100% certain that a payment was sent from a specified address if you sent it too. Yes, if some out of band mechanism you trust, assures you of something, then you can be certain of it. – David Schwartz – 2013-08-05T19:26:58.033
possible duplicate of When a transaction is split into two outputs, how does the network "know" you're the owner of the "change" address?
– Stephen Gornick – 2013-08-06T03:57:10.000@Stephen Gornick the questions are entirely different, this is a blockchain data structure question whereas the last question was about the distinction between an address, an account, and the way the private key works in the wallet. They are sort of similar, though. – bvpx – 2013-08-06T16:38:49.850