1

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?

2
  • I find it weird that the addresses do not start with a 1 or a 3. Commented Jan 6, 2014 at 15:00
  • 1
    @StevenRoose These are testnet addresses
    – TeAmEr
    Commented Feb 24, 2014 at 19:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.