Advertise with us (we do not endorse any site advertised)

Author Topic: How to find out the sender address?  (Read 9708 times)

0 Members and 1 Guest are viewing this topic.

Offline makler12Topic starter

  • Newbie
  • Joined: Jun 2012
  • Posts: 6
  • Karma: +0/-0
    • View Profile
How to find out the sender address?
« on: June 24, 2012, 07:55:50 PM »
Hi,
I'd like to know how (from which address) send me BTC.
In Windows client in details transaction I have "unknown" at "From" label :(

How to get the information about sender address?

I need to do it from PHP level.



Offline dodoking

  • King of the coins!
  • Sr. Member
  • ***
  • Joined: Dec 2011
  • Location: Underwater
  • Posts: 283
  • Country: 00
  • Karma: +5/-0
  • DDK ALL DAY
    • twitter.com/dodoking1
    • View Profile
    • Under Construction
  • Bitcoin Address: 1AAmdfuC3psSNWgFmUUzqFCdVmCco7ZiRx
Re: How to find out the sender address?
« Reply #1 on: June 24, 2012, 08:22:45 PM »
Try using these pages:

http://blockexplorer.com/q/mytransactions/PutAddressYourReceivedWithHere

example:
http://blockexplorer.com/q/mytransactions/1Cvvr8AsCfbbVQ2xoWiFD1Gb2VRbGsEf28

That will return all the transactions for that address in json format. Then use the hash for each transaction like this:

http://blockexplorer.com/q/hashtoaddress/Hash

example:
http://blockexplorer.com/q/hashtoaddress/5ad984358bd5da0cae3245f49a190306e720d57c7b3e1f30d2ddafe763269c0c

that would give you 1h1diLoJtP3bkiXdYDZoCjcC4ynuv5MefGZVwpkF6eYyyiqJbN

Below is the transaction results for the example. I made the hashes bold.

{
  "5ad984358bd5da0cae3245f49a190306e720d57c7b3e1f30d2ddafe763269c0c":{
    "hash":"5ad984358bd5da0cae3245f49a190306e720d57c7b3e1f30d2ddafe763269c0c",
    "ver":1,
    "vin_sz":1,
    "vout_sz":1,
    "lock_time":0,
    "size":158,
    "in":[
      {
        "prev_out":{
          "hash":"dafaa8f636af875aad504a62d3c861b3d57b65ac512cd8559fe5c170ffdd2938",
          "n":0
        },
        "scriptSig":"304502201af91fad484fc298d68545991c9790b85f4c9238c6c1b14ce18caf646961ad10022100ef496dbf4d770a2ed35d7c3392faa9d8e148784c3d8a85a876e0b9bd55865b0701"
      }
    ],
    "out":[
      {
        "value":"50.00000000",
        "scriptPubKey":"OP_DUP OP_HASH160 82dc60f75788fe0fc4c7a75768ae7e3f8e4e2231 OP_EQUALVERIFY OP_CHECKSIG",
        "address":"1Cvvr8AsCfbbVQ2xoWiFD1Gb2VRbGsEf28"
      }
    ],
    "block":"000000000011b41e68266c7d03d41fe7f89c02c83245d3d86da503ece3bc675e",
    "blocknumber":"90705",
    "time":"2010-11-09 10:40:02"
  },
  "2896fc6674965e35d8ca4a679d4be5b66796e79c9106493c273d568d904b754e":{
    "hash":"2896fc6674965e35d8ca4a679d4be5b66796e79c9106493c273d568d904b754e",
    "ver":1,
    "vin_sz":1,
    "vout_sz":2,
    "lock_time":0,
    "size":257,
    "in":[
      {
        "prev_out":{
          "hash":"832a6ee0c949a3386ad89b212259ac6c19701fb9a9fcad0ea2653bf7ec796b62",
          "n":1
        },
        "scriptSig":"304402201055992c3ef9c9c71086bcd5c3ce3b0ecf54b8cdc843660c274a39c3175f5b69022054dc63a9e1944c909c130ecd9d0bc3c104ff6e7f912a0d5c4201eb64517e757601 040b973dad969fc057de34c42aad6f52856563329d2718ce43715006e8a699c484641e951e0e88c816f187ff4a76b11134bb53efc0a85656b25e2d1967374916ea",
        "address":"148z7zD8SMu6t55kbYi9vpNwSj36qMcbAP"
      }
    ],
    "out":[
      {
        "value":"30.00000000",
        "scriptPubKey":"OP_DUP OP_HASH160 a984b5bb9adcae804bf565c8585af87b236acd8c OP_EQUALVERIFY OP_CHECKSIG",
        "address":"1GTLBGLWRuAiedaU5oEUkGPMx9yCVm64UZ"
      },
      {
        "value":"10.00000000",
        "scriptPubKey":"OP_DUP OP_HASH160 82dc60f75788fe0fc4c7a75768ae7e3f8e4e2231 OP_EQUALVERIFY OP_CHECKSIG",
        "address":"1Cvvr8AsCfbbVQ2xoWiFD1Gb2VRbGsEf28"
      }
    ],
    "block":"000000000004a87abe278025569600f4d3bfd68ac11e0c40cfb4d208f10adc2a",
    "blocknumber":"90880",
    "time":"2010-11-10 10:27:25"
  }
}

Offline dodoking

  • King of the coins!
  • Sr. Member
  • ***
  • Joined: Dec 2011
  • Location: Underwater
  • Posts: 283
  • Country: 00
  • Karma: +5/-0
  • DDK ALL DAY
    • twitter.com/dodoking1
    • View Profile
    • Under Construction
  • Bitcoin Address: 1AAmdfuC3psSNWgFmUUzqFCdVmCco7ZiRx
Re: How to find out the sender address?
« Reply #2 on: June 24, 2012, 08:25:13 PM »
With those pages you can use curl or get_file_contents() and also some json parsing to do it all in php.

Offline dodoking

  • King of the coins!
  • Sr. Member
  • ***
  • Joined: Dec 2011
  • Location: Underwater
  • Posts: 283
  • Country: 00
  • Karma: +5/-0
  • DDK ALL DAY
    • twitter.com/dodoking1
    • View Profile
    • Under Construction
  • Bitcoin Address: 1AAmdfuC3psSNWgFmUUzqFCdVmCco7ZiRx
Re: How to find out the sender address?
« Reply #3 on: June 24, 2012, 08:45:38 PM »
If you dont want to use blockexplorer and want to keep it more local, look into these api functions
  • listtransactions
  • gettransaction
  • listreceivedbyaddress
https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list

Offline makler12Topic starter

  • Newbie
  • Joined: Jun 2012
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to find out the sender address?
« Reply #4 on: June 24, 2012, 08:56:02 PM »
Thanks very much.
I will try :)

Offline makler12Topic starter

  • Newbie
  • Joined: Jun 2012
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to find out the sender address?
« Reply #5 on: June 25, 2012, 09:07:49 AM »
Hi,

I don't have any problem with e.g. getbalance() funcion, but if I try use gettransaction(txid), I have an error.

Code:
$b = $Client->gettransaction(b57e65161a13b985c5344c6db6c2b42ec43290638937032e933bd85bb4ca073d
);
echo $b;

Error:
Notice: Use of undefined constant b57e65161a13b985c5344c6db6c2b42ec43290638937032e933bd85bb4ca073d - assumed 'b57e65161a13b985c5344c6db6c2b42ec43290638937032e933bd85bb4ca073d' in C:\wamp\www\btc\inc\page_allbets.inc on line 14

Array 


So my questions:
1) what to use in argument (a used an ID transaction from my bitcoin client)?
2) how to get to the array from gettransation function?
Maybe:
echo $b[1];
??

Thanks for future answers.

Offline dodoking

  • King of the coins!
  • Sr. Member
  • ***
  • Joined: Dec 2011
  • Location: Underwater
  • Posts: 283
  • Country: 00
  • Karma: +5/-0
  • DDK ALL DAY
    • twitter.com/dodoking1
    • View Profile
    • Under Construction
  • Bitcoin Address: 1AAmdfuC3psSNWgFmUUzqFCdVmCco7ZiRx
Re: How to find out the sender address?
« Reply #6 on: June 26, 2012, 12:36:58 AM »
Note the quotes and print_r(); It is returning your data but it is in an array...

Code: [Select]
$b = $Client->gettransaction('b57e65161a13b985c5344c6db6c2b42ec43290638937032e933bd85bb4ca073d');
print_r($b);

or this way:

$hash = 'b57e65161a13b985c5344c6db6c2b42ec43290638937032e933bd85bb4ca073d';
$b = $Client->gettransaction($hash);
print_r($b);

you could also have it displayed like
foreach($b as $tx) {

}

or as you said using [-0] on the variables.

the 0 wouldnt show without the minus sign.
ignore the minus siign as it does not belong.
« Last Edit: June 26, 2012, 12:48:50 AM by dodoking »

Offline makler12Topic starter

  • Newbie
  • Joined: Jun 2012
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: How to find out the sender address?
« Reply #7 on: June 26, 2012, 06:56:32 PM »
Thakns very much.
Last night I did it the way like you wrote :)
Now I wanted to write it and I saw your advice.
Now I'm sure I did everything well.
Thakns.

Bye.

Offline spitteler

  • Newbie
  • Joined: Aug 2012
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: How to find out the sender address?
« Reply #8 on: August 01, 2012, 09:55:58 AM »
printing the array got me the following results

Code: newbielink:javascript:void(0); [nonactive]
Array ( [amount] => 0.1 [confirmations] => 11 [blockhash] => 0000000000000641a9151b2400498d209d49e3c08b874a247d4dd5f013212c95 [blockindex] => 26 [txid] => 28a1976b68b6ab4b5bbe723ab7289d4352da9afdedee022b6b47348a57f3f181 [time] => 1343809421 [comment] => [from] => [message] => [to] => [details] => Array ( [0] => Array ( [account] => Initial Funding [address] => 1BCsESGBcxjgKCKbXxHmcht1KZLRBjcQaE [category] => receive [amount] => 0.1 ) ) )
How would i parse  account and category into individual variables? this following did not seem to work

Code: newbielink:javascript:void(0); [nonactive]
$txid = "it's valid i swear!";
$txinfo = $bitcoin->gettransaction($txid);
echo "TransactionID: ".$txid."<br />";
echo "Account: ".$txinfo[2][account]."<br />";
echo "Category: ".$txinfo[2][category]."<br />";
echo "Amount: ".$txinfo[amount]."<br />";
echo "Confirmations: ".$txinfo[confirmations]."<br />";

Also,  that does not actually show the senders address anywhere
« Last Edit: August 01, 2012, 10:44:37 AM by spitteler »

Offline krasaan02

  • Jr. Member
  • *
  • Joined: Jul 2012
  • Location: Balikpapan
  • Posts: 51
  • Country: id
  • Karma: +1/-0
  • Gender: Male
    • View Profile
  • Bitcoin Address: 1LDLzjvkg595Yrp64QzgcSkoMWZYTTKRyN
Re: How to find out the sender address?
« Reply #9 on: August 19, 2012, 06:42:12 AM »
So Helpful...
Two thumbs up for the question and answers.

Offline flaab

  • Newbie
  • Joined: Sep 2012
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: How to find out the sender address?
« Reply #10 on: September 29, 2012, 01:52:37 PM »
Hi :-)

I am a new member of the forum and I am having problems with this very same issue.

I am trying to use blockchain.info API to receive a payment and store the sender's address. However, the API only indicates the transaction hash, not the sender's address. Perhaps this is simply ignorance about the BTC Protocol, but how can I find the sender's address from any given transaction hash?

The two API's I am using:
newbielink:https://blockchain.info/api/api_receive [nonactive]
newbielink:https://blockchain.info/api/blockchain_api [nonactive]

I would really appreaciate an answer :-)
Thanks in advance!


 

Send BTC to bitcoin-QT Sender address

Started by elGranto

Replies: 0
Views: 5014
Last post October 23, 2013, 10:23:13 AM
by elGranto
Use php to get received by address. with and w/o the client.

Started by dodoking

Replies: 0
Views: 4907
Last post May 06, 2012, 07:08:42 PM
by dodoking
Address Checker API

Started by Ru.Bix

Replies: 0
Views: 3285
Last post August 06, 2014, 10:57:46 PM
by Ru.Bix
Sweep to Address

Started by SwannyMatt

Replies: 0
Views: 17782
Last post September 25, 2015, 04:38:00 AM
by SwannyMatt

your ads here