WARNING: This method can go wrong if the user sent from an exchange account or some other method that the user does not directly control, or if they sent an old-style multisig tx, or a non-standard tx. It is NOT recommended. But you asked.
The basic idea is to look at the first address entry of the vout structure of the first vin of the transaction the user sent to you.
ie: tx.vin[0].vout.addresses[0]
This is a little convoluted to obtain with stock bitcoind, because gettransactions does not include any vout.addresses field.
So we need to do it in two steps.
Step 1.
./bitcoin/src/bitcoin-cli getrawtransaction <txid> 1
Then you will see output like this:
{
"txid" : "...",
"version" : 1,
"locktime" : 0,
"vin" : [
{
"txid" : "<first_vin_txid>",
"vout" : 0,
"scriptSig" : {
"asm" : "...",
"hex" : "..."
},
"sequence" : 0
},
...
}
Notice the vout in this case is 0. So now, let's find the matching vout for <first_vin_txid>.
Step 2.
./bitcoin/src/bitcoin-cli getrawtransaction <first_vin_txid> 1
{
...
"vout" : [
{
"value" : <amount>,
"n" : 0,
"scriptPubKey" : {
"asm" : "...",
"hex" : "...",
"reqSigs" : 1,
"type" : "pubkeyhash",
"addresses" : [
"1GN..."
]
}
},
...
Ok, we find the vout where "n" matches "vout" from the vin we looked at in the orig transaction. In this case "n" and "sequence" are both 0. Therefore 1GN... is the address associated with the first input of the orig transaction. ie, this address contributed <amount> of funds. Note that:
1) There may be one vin or multiple vin in the orig tx. ie, outputs from multiple tx may have been consolidated into one. It should be relatively safe to always choose the first vin.
2) There may be multiple values in the "addresses" field, eg if type = multisig. in this case, you should probably abort.
again, don't do this. ;-)
but luckyb.it too, no need enter wallet..
i think that can get player wallet, but i don't know how..
do you have idea?