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?
sendfrom
command, 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).