Author

Topic: How do you get the SENDING address with PHP? (Read 2966 times)

sr. member
Activity: 266
Merit: 250
LitecoinTalk
September 25, 2012, 09:08:04 AM
#14
What you're saying makes a lot of sense and explains why I couldn't locate an easy answer. So, how do places like BitLotto operate? From what I can tell, a person sends Bitlotto a BitLotto-generated address for a particular draw. If the person wins, how would BitLotto know who to pay? BitLotto (and other online transaction sites) must have some way of knowing the source of funds.

Its not hard, its just not easy.
Some devs loathe Satoshidice and wrongly call it blockchain spam (as if increased use is a bad thing).
So there is a fair bit of misinformation and obfuscation of how to achieve this.

Writing a gambling site hey ? Smiley
We are seeing more and more of these instant payout games.

Satoshidice being the most popular currently (uses ABE i suspect).
SatoshiRoulette did a clean room implementation (apparently) of satoshidices payment system.
FlipBitcoin - Same system.
BitcoinLotto Same system (may still use ABE).
BTCDice is another but I cannot endorse them currently.

Im not sure if they would help the competition but it would not hurt dropping them an email Wink

I believe SD and Bitcoinlotto previously used a local copy of ABE, but as you can now achieve the same using api calls Id expect they would drop the heavy ABE in favor of much lighter API calls.

I am obviously biased on this topic, but here is my stance regardless:

  • If increased commerce is a bad thing, bitcoin has already failed.
  • If bitcoin cannot scale, it has already failed.
  • Any team that releases a code base to the public domain then starts making demands of the public on how it is used will be universally ignored.
  • The very nature of bitcoin means there is no central control, so dont listen to some negative people who dont like your service - they would never use it anyway. This is the greatest feature of bitcoin, outspoken individuals have very little power. Whats best for the network is decided by the network

LTCDice.net is using perl to read the blockchain from litecoind ( have also abe setup as a second read database if litecoind crash )
the perl script read ALL Tx that come thu litecoind, and if it see one of the LTCDIce addy in the tx it read it to find the sender addy to give the payout
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
September 25, 2012, 02:24:32 AM
#13
The more I learn about Bitcoin, the more I am impressed with its genius. This is an amazing system: transparent and verifiable, yet anonymous to a large degree if so wanted; pretty much cheat-proof; mathematically sound...I could go on but I'm pretty tired.

This presents some challenges for me, but I think I can still do what I need to do by invoking some programming kung-fu. We'll see. I love a good puzzle/challenge.

Thanks to all for their input  Smiley

All the info you need is on the wiki, study this page:
https://en.bitcoin.it/wiki/Transaction

If anyone is interested I can sell my coinflip.pl code I wrote several months ago Wink pm me offers.
It does senders address look up ala SD style.
hero member
Activity: 850
Merit: 1000
September 25, 2012, 01:46:20 AM
#12
The more I learn about Bitcoin, the more I am impressed with its genius. This is an amazing system: transparent and verifiable, yet anonymous to a large degree if so wanted; pretty much cheat-proof; mathematically sound...I could go on but I'm pretty tired.

This presents some challenges for me, but I think I can still do what I need to do by invoking some programming kung-fu. We'll see. I love a good puzzle/challenge.

Thanks to all for their input  Smiley
mem
hero member
Activity: 644
Merit: 501
Herp Derp PTY LTD
September 25, 2012, 12:45:45 AM
#11
What you're saying makes a lot of sense and explains why I couldn't locate an easy answer. So, how do places like BitLotto operate? From what I can tell, a person sends Bitlotto a BitLotto-generated address for a particular draw. If the person wins, how would BitLotto know who to pay? BitLotto (and other online transaction sites) must have some way of knowing the source of funds.

Its not hard, its just not easy.
Some devs loathe Satoshidice and wrongly call it blockchain spam (as if increased use is a bad thing).
So there is a fair bit of misinformation and obfuscation of how to achieve this.

Writing a gambling site hey ? Smiley
We are seeing more and more of these instant payout games.

Satoshidice being the most popular currently (uses ABE i suspect).
SatoshiRoulette did a clean room implementation (apparently) of satoshidices payment system.
FlipBitcoin - Same system.
BitcoinLotto Same system (may still use ABE).
BTCDice is another but I cannot endorse them currently.

Im not sure if they would help the competition but it would not hurt dropping them an email Wink

I believe SD and Bitcoinlotto previously used a local copy of ABE, but as you can now achieve the same using api calls Id expect they would drop the heavy ABE in favor of much lighter API calls.

I am obviously biased on this topic, but here is my stance regardless:

  • If increased commerce is a bad thing, bitcoin has already failed.
  • If bitcoin cannot scale, it has already failed.
  • Any team that releases a code base to the public domain then starts making demands of the public on how it is used will be universally ignored.
  • The very nature of bitcoin means there is no central control, so dont listen to some negative people who dont like your service - they would never use it anyway. This is the greatest feature of bitcoin, outspoken individuals have very little power. Whats best for the network is decided by the network
kjj
legendary
Activity: 1302
Merit: 1026
September 24, 2012, 11:23:16 PM
#10
What you're saying makes a lot of sense and explains why I couldn't locate an easy answer. So, how do places like BitLotto operate? From what I can tell, a person sends Bitlotto a BitLotto-generated address for a particular draw. If the person wins, how would BitLotto know who to pay? BitLotto (and other online transaction sites) must have some way of knowing the source of funds.

They are probably doing something like what you are doing (more likely by reading the block chain directly, instead of making a ton of RPC calls).  But please don't.
hero member
Activity: 850
Merit: 1000
September 24, 2012, 10:58:00 PM
#9
What you're saying makes a lot of sense and explains why I couldn't locate an easy answer. So, how do places like BitLotto operate? From what I can tell, a person sends Bitlotto a BitLotto-generated address for a particular draw. If the person wins, how would BitLotto know who to pay? BitLotto (and other online transaction sites) must have some way of knowing the source of funds.
kjj
legendary
Activity: 1302
Merit: 1026
September 24, 2012, 07:59:32 PM
#8
Your call to getrawtransaction just returns a huge hex string.  You can feed that back into the decoderawtransaction RPC call to decode it.

From there, you have an array of transaction objects in vin.  Each vin object has a member named txid, those are the transaction IDs of the transactions that were redeemed.  You can take each of them and run them through getrawtransaction and then decoderawtransaction.  That should give you the last address that had control of (some of) the coins that were sent to you.

Please note that there is absolutely positively no such concept of "sending address" in bitcoin.  If you use the addresses that you coax out of the raw transaction API and send money to them, you are doing it wrong, and you will surely be sending coins to random people before long.
hero member
Activity: 850
Merit: 1000
September 24, 2012, 06:40:06 PM
#7
Some helpful tips so far, but if anyone knows of a way to get the sender's address of a payment that I've received, using PHP, I'd love to see it.
hero member
Activity: 850
Merit: 1000
September 24, 2012, 02:28:08 PM
#6
Hmmm. Would it be ok to msg you the full output, and if you can show me the sending address (the txid will be supplied), I'll send you 0.1BTC?
hero member
Activity: 850
Merit: 1000
September 24, 2012, 01:53:32 PM
#5
No errors. Now I get a paragraph of output, starting with:

Quote
array(10) { ["hex"]=> string(678)
"01000000024b32b25694be1b455df8bb4d565696effa1
  ...and so on.

I don't see the sending address in it. Do you know the name of the key I should be looking for?

Thanks for your help!
hero member
Activity: 850
Merit: 1000
September 24, 2012, 12:12:43 AM
#4
Using 0.7 version of bitcoind, and the JSON-RPC PHP API.
hero member
Activity: 850
Merit: 1000
September 23, 2012, 10:30:05 PM
#3
I must be doing something wrong. I can't see the sending address, which is known to me, anywhere.

$txid   is the transaction id, which is known.

Quote
$txfr = $bitcoin->getrawtransaction($txid,1);
print_r(array_values($txfr));
legendary
Activity: 2506
Merit: 1010
September 23, 2012, 10:09:00 PM
#2
I've been using the guide at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list, which has been very helpful, but it says nothing about getting the sending address.

It is in there ... getrawtransaction   

 - http://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list

 - http://en.bitcoin.it/wiki/Raw_Transactions
hero member
Activity: 850
Merit: 1000
September 23, 2012, 09:59:24 PM
#1
I've been using the guide at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list, which has been very helpful, but it says nothing about getting the sending address.
Jump to: