<p>I've not been able to figure out why I can't relaiably get the senders address using bitcoind 8.1 on the json API with php.</p>

<pre>foreach ($bitcoin->listtransactions() as $transaction) {
 if ($transaction['category'] == 'receive') {
  $info['account'] = $transaction['account'];
  $info['address'] = $transaction['address'];
  $info['amount']  = $transaction['amount'];
  $info['confirmations'] = $transaction['confirmations'];
  $info['time'] = $transaction['timereceived'];
  $info['txid'] = $transaction['txid'];

  $txdetails = $bitcoin->getrawtransaction($transaction['txid'],(int)1);
  foreach ($txdetails['vout'] as $vout) {
    if ($vout['value']  $info['amount']) {
      $info['sender'] = $vout['scriptPubKey']['addresses']['0'];
    }
  }
}
</pre>

<p>The result I get is</p>

<pre>
Array
(
    [account] => Pool
    [address] => n3YgVTznqBCTb5ghWwNUoSmn5z37vfg4VK
    [amount] => 2
    [confirmations] => 7
    [time] => 1368107164
    [txid] => 94a25aac9e26b19cbf3c0afd4e7689047e33f9adbea4bbe9d5bd198cdc918717
    [sender] => mvoiUMUyR5QvX1Z2SYBAqT9eK6rjuQGVCF
)
</pre>

<p>But the address I get in the [address] does not receive anything I send back to it.</p>

<p>What am I missing?</p>

CC BY-SA 3.0
2014-01-06T15:00:09.420Z
I find it weird that the addresses do not start with a 1 or a 3.
Steven Roose
CC BY-SA 3.0
2014-02-24T19:05:21.780Z
@StevenRoose These are testnet addresses
TeAmEr
<bitcoind><json-rpc><php>
Senders Address with Bitcoind in PHP
aBitConfused
# Senders Address with Bitcoind in PHP

(Asked by: username_0 on 2013-05-09)

I've not been able to figure out why I can't relaiably get the senders address using bitcoind 8.1 on the json API with php.
foreach ($bitcoin->listtransactions() as $transaction) {
 if ($transaction['category'] == 'receive') {
  $info['account'] = $transaction['account'];
  $info['address'] = $transaction['address'];
  $info['amount']  = $transaction['amount'];
  $info['confirmations'] = $transaction['confirmations'];
  $info['time'] = $transaction['timereceived'];
  $info['txid'] = $transaction['txid'];

  $txdetails = $bitcoin->getrawtransaction($transaction['txid'],(int)1);
  foreach ($txdetails['vout'] as $vout) {
    if ($vout['value']  $info['amount']) {
      $info['sender'] = $vout['scriptPubKey']['addresses']['0'];
    }
  }
}

The result I get is

Array
(
    [account] => Pool
    [address] => n3YgVTznqBCTb5ghWwNUoSmn5z37vfg4VK
    [amount] => 2
    [confirmations] => 7
    [time] => 1368107164
    [txid] => 94a25aac9e26b19cbf3c0afd4e7689047e33f9adbea4bbe9d5bd198cdc918717
    [sender] => mvoiUMUyR5QvX1Z2SYBAqT9eK6rjuQGVCF
)

But the address I get in the [address] does not receive anything I send back to it.
What am I missing?

**Tags:** bitcoind, json-rpc, php

> **Comments:**
> **username_1**: I find it weird that the addresses do not start with a 1 or a 3.  
> **username_2**: @StevenRoose These are testnet addresses  

---

## 0 answers

