<p>You can use <a href="https://www.blockchain.com/api/blockchain_api" rel="nofollow noreferrer">api</a> provided by blockchain.info.</p>

<p>For example use <code>https://blockchain.info/rawaddr/$bitcoin_address</code> to get all the transactions for an address in JSON format.</p>

CC BY-SA 4.0
2023-06-20T07:14:41.467Z
How to detect status of transactions?
reza_khalafi
CC BY-SA 4.0
2018-08-29T08:03:09.690Z
2018-08-29T08:03:09.690Z
Abhishek Sinha
<p>As answered above you can use blockchain.info for extracting the results. Here I would like to add to the solution provided by m1xolyd1an, his code works fine but it extracts only latest 50 results/transactions made by the address that you are trying to retrieve the data for. </p>

<p>In order to extract the complete details of the transaction right from the beginning, some minor tweaks have to be made to the code. Below is my solution</p>

<pre><code>&lt;?php
$address = $_POST['Address'];
$url = "https://blockchain.info/address/".$address."?format=json&amp;offset=0";
$json = json_decode(file_get_contents($url), true);

$totalTxs = $json["n_tx"];
echo "Total transaction : $totalTxs";
for($ex=0;$ex&lt;$totalTxs;$ex+=50){
//$address = "1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v";
$url = "https://blockchain.info/address/".$address."?format=json&amp;offset=$ex";
$json = json_decode(file_get_contents($url), true);

//total transactions
$totalTxs = $json["n_tx"];
//final balance
$balanceSatoshis = $json["final_balance"];
$balanceBitcoins = $balanceSatoshis / 100000000;
$balanceBitcoins = number_format($balanceBitcoins, 8);

//loop through each transaction and display all inputs and outs
for($i=0;$i&lt;50;$i++){

echo "&lt;table&gt;&lt;tr&gt;&lt;td&gt;";
echo "HASH OF TX:&lt;/br&gt;";
$hash=$json["txs"][$i]["hash"];
echo "&amp;nbsp;".$hash;

echo "&lt;/td&gt;&lt;td width='550'&gt;SENT FROM:&lt;br&gt;";
$n_inputs = count($json["txs"][$i]["inputs"]);  

for($ii = 0; $ii &lt; $n_inputs; $ii++){   
    $inValue = $json["txs"][$i]["inputs"][$ii]["prev_out"]["value"];    
    $inValueCalc = $inValue / 100000000;    
    $inAddy = $json["txs"][$i]["inputs"][$ii]["prev_out"]["addr"];  
    echo "&amp;nbsp;". rtrim(number_format($inValueCalc, 8), '0') ."&amp;nbsp;". $inAddy ."&amp;nbsp;"; 
    echo "&lt;br&gt;";
    }   

echo "&lt;/td&gt;&lt;td&gt;SENT TO:&lt;br&gt;";
$n_outputs = count($json["txs"][$i]["out"]);    

for($io = 0; $io &lt; $n_outputs; $io++){  
    $outValue = $json["txs"][$i]["out"][$io]["value"];  
    $outValueCalc = $outValue / 100000000;  
    $outAddy = $json["txs"][$i]["out"][$io]["addr"];    
    echo "&amp;nbsp;". rtrim(number_format($outValueCalc, 8), '0') ."&amp;nbsp;". $outAddy ."&amp;nbsp;";   
    echo "&lt;br&gt;";    
    }   
echo "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
}
}
?&gt;
</code></pre>

CC BY-SA 3.0
2017-07-05T05:09:32.433Z
what was the trick you used to bypass the 50 limit?
Patoshi パトシ
CC BY-SA 3.0
2017-07-05T06:34:19.493Z
"https://blockchain.info/address/".$address."?format=json&offset=0". I used the offset to get the desired results. As in when the offset is set to "0" it would fetch you latest 50 results. If you go on increasing the offset by 50, then subsequently you would be getting previous results from the earlier transactions. Blockchain.info sends you the results of first page when you query with offset "0". When you query with offset ="50" it would send you the results from second page and so on. So what I basically did was iterating over the offset till I reach the end or total no of transactions.
Nikhil Jain
CC BY-SA 3.0
2017-07-04T22:58:04.853Z
2017-07-04T22:58:04.853Z
Nikhil Jain
<p>You can use <a href="http://blockr.io/documentation/api" rel="nofollow noreferrer">blockr</a> API. </p>

<pre><code>http://btc.blockr.io/api/v1/address/txs/the_address 
</code></pre>

<p>Where <code>the_address</code> is the address you are looking information about. </p>

<p>However, this is limited to the 200 most recent transactions. </p>

<p>Here you have a <strong>simple Python example</strong> that does so:</p>

<pre><code>from json import loads
from requests import get

url = 'http://btc.blockr.io/api/v1/address/txs/'
btc_addr = '36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6'

r = get(url + btc_addr)
data = loads(r.content)['data']

print data
</code></pre>

<p>Where <code>36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6</code> is a random picked address. The result wil be:</p>

<pre><code>{u'txs':[
   {u'time_utc': u'2017-03-03T08:22:57Z', u'amount': 5,  u'confirmations': 4, u'amount_multisig': 0, 
     u'tx': u'fc8bd6d4bff2c5c07f82939cbf798f4442226f39b607353fe8355cf3170d67b7'}, 
   {u'time_utc': u'2017-01-03T17:14:19Z', u'amount': -10, u'confirmations': 9084, u'amount_multisig': 0, 
     u'tx': u'daa9f8c25ce09240a02df1ac56122bb014eb9f6abe5a22bbfe04ee4fa1afb9cc'}, 
   {u'time_utc': u'2017-01-03T11:10:21Z', u'amount': 10, u'confirmations': 9129, u'amount_multisig': 0, 
     u'tx': u'13362f7a746cfe6481e08155d778bba69c8db706673b99239762f5dca14f18f4'}
], u'limit_txs': 200, u'nb_txs': 3, u'nb_txs_displayed': 3, u'address': u'36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6'}
</code></pre>

CC BY-SA 3.0
2017-10-21T09:15:10.263Z
the link to blockr is redirecting to coinbase.
Kaizoku Gambare
CC BY-SA 3.0
2017-10-21T19:07:57.810Z
blockr.io have shutdown their server recently.
sr_gi
CC BY-SA 3.0
2017-03-02T22:28:05.167Z
2017-03-03T08:59:07.023Z
2017-03-03T08:59:07.023Z
sr_gi
<p>Your question is tagged with <strong>blockchain.info</strong> so you can just use the endpoint <code>https://blockchain.info/address/1ADDRESSTOLOOKUPGOESHERE?format=json</code></p>

<p>The output will provide an initial summary on the address, followed by each transaction in the <code>txs[]</code> array with all inputs and outputs. You also requested an example so below is a snippet response. </p>

<pre><code>{
    "hash160":"eaad40023319c547321b63f8adc6cc5a11759c61",
    "address":"1NPrfWgJfkANmd1jt88A141PjhiarT8d9U",
    "n_tx":159,
    "total_received":261352990,
    "total_sent":259703473,
    "final_balance":1649517,
    "txs":[

{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":221676260,
            "type":0,
            "addr":"19hNEoHRGb2wDpxWGgDEDwaoHdEfKjZwWx",
            "value":3214191,
            "n":20,
            "script":"76a9145f635f8cf8ad279cd74eb24a44cd128973e00a0e88ac"
         },
         "script":"47304402207edc4373fbb9a01ac6e07eb88f91c7008e2ed951603a3ce03393d2bf7e99bcbd022060963067a9559cc8b140136dc4f78819731260151ed9d81c19c25ffd8df42b7a01410497e0923c9b2ea5261733f81fa83333d25373db3feae91e15ae42f5347e8f65080c90b33cba4470e5eabec06db30a57b4017ad3588a26722e36249eb5c6679a39"
      }
   ],
   "block_height":454724,
   "relayed_by":"87.128.111.190",
   "out":[
      {
         "addr_tag_link":"http:\/\/wearechange.org\/donate\/",
         "addr_tag":"wearechange.org",
         "spent":false,
         "tx_index":225606846,
         "type":0,
         "addr":"12HdLgeeuA87t2JU8m4tbRo247Yj5u2TVP",
         "value":166948,
         "n":0,
         "script":"76a9140e1d1da1fc5bb5165a54a4d9ecefbc8458bae3d388ac"
      }
   ],
</code></pre>

<p>So let's say you're using PHP and you want to fetch and display all the transactions for a particular address. You'd call the API then loop through each in the array. </p>

<p><a href="http://phpfiddle.org/main/code/e4jy-rrqt" rel="nofollow noreferrer">http://phpfiddle.org/main/code/e4jy-rrqt</a></p>

<pre><code>&lt;?php

$address = "1NPrfWgJfkANmd1jt88A141PjhiarT8d9U";
$url = "https://blockchain.info/address/".$address."?format=json";
$json = json_decode(file_get_contents($url), true);

//total transactions
$totalTxs = $json["n_tx"];
//final balance
$balanceSatoshis = $json["final_balance"];
$balanceBitcoins = $balanceSatoshis / 100000000;
$balanceBitcoins = number_format($balanceBitcoins, 8);

//loop through each transaction and display all inputs and outs
for($i=0;$i&lt;$totalTxs;$i++){

    echo "&lt;table&gt;&lt;tr&gt;&lt;td width='550'&gt;";
    echo "SENT FROM:&lt;br&gt;";
    $n_inputs = count($json["txs"][$i]["inputs"]);  

    for($ii = 0; $ii &lt; $n_inputs; $ii++){   
        $inValue = $json["txs"][$i]["inputs"][$ii]["prev_out"]["value"];    
        $inValueCalc = $inValue / 100000000;    
        $inAddy = $json["txs"][$i]["inputs"][$ii]["prev_out"]["addr"];  
        echo "&lt;button style='background-color:red;'&gt;". rtrim(number_format($inValueCalc, 8), '0') ."&lt;/button&gt;&lt;a href='#'&gt;". $inAddy ."&lt;/a&gt;";    
        echo "&lt;br&gt;";
        }   
    echo "&lt;/td&gt;&lt;td&gt;SENT TO:&lt;br&gt;";
    $n_outputs = count($json["txs"][$i]["out"]);    

    for($io = 0; $io &lt; $n_outputs; $io++){  
        $outValue = $json["txs"][$i]["out"][$io]["value"];  
        $outValueCalc = $outValue / 100000000;  
        $outAddy = $json["txs"][$i]["out"][$io]["addr"];    
        echo "&lt;button style='background-color:green;'&gt;". rtrim(number_format($outValueCalc, 8), '0') ."&lt;/button&gt;&lt;a href='#'&gt;". $outAddy ."&lt;/a&gt;";    
        echo "&lt;br&gt;";    
        }   
    echo "&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;";
}


?&gt;
</code></pre>

CC BY-SA 4.0
2023-06-20T06:22:35.263Z
How to get status of transactions in these data?
reza_khalafi
CC BY-SA 3.0
2017-03-03T01:44:23.800Z
2017-03-03T01:44:23.800Z
m1xolyd1an
<pre><code>bicoin api - listreceivedbyaddress(minconf,include_empty,include_watchonly,address_filter)
return json:
[
  {
    address: '37ngGpLcqbgU3Bov8hjMSzgqBKfLyB3f9r',
    amount: 0.0003039,
    confirmations: 92,
    label: '',
    txids: [
      '76acd9e2b7b79f68c9a4a3a4a5cce3528ee8ae6d383aed069bf03d5e95408ec7'
    ]
  }
]
</code></pre>

CC BY-SA 4.0
2020-05-09T06:28:20.113Z
2020-05-09T06:28:20.113Z
user3209882
<p>I couldn't get the transactions AND the total BTC that came in per transaction using the advice on pages like <a href="https://bitcoin.stackexchange.com/questions/51794/how-to-get-the-list-of-transactions-of-input-outputs-for-a-bitcoin-address-in-js">this</a>. Luckily I stumbled upon <a href="https://tangleskills.com/get-bitcoin-address-details-and-transaction-list-in-php/" rel="nofollow noreferrer">this</a> which solves it beautifully:</p>
<pre><code>$address = 'YOUR BTC ADDRESS';

    $transaction_list=array();
    $satoshi=100000000;
    $txnlist=file_get_contents(&quot;https://blockchain.info/rawaddr/&quot;.$address);
    if($txnlist)
    {
      $txnlist=json_decode($txnlist,true);
      if($txnlist &amp;&amp; isset($txnlist['txs']) &amp;&amp; $txnlist['txs'])
      {
        $txns=$txnlist['txs'];
        foreach($txns as $txn)
         {
           $amount=$txn['result']/$satoshi;
           $time=$txn['time'];
           $hash=$txn['hash'];
           $transaction_list[]=array(
             'amount'=&gt;$amount,
             'hash'=&gt;$hash,
             'time'=&gt;$time
           );
         }
        }
     $data['address']=$txnlist['address'];
     $data['total_txn']=$txnlist['n_tx'];
     $data['total_received']=$txnlist['total_received']/$satoshi;
     $data['total_sent']=$txnlist['total_sent']/$satoshi;
     $data['final_balance']=$txnlist['final_balance']/$satoshi;
     $data['transaction_list']=$transaction_list;
    }
    print '&lt;pre&gt;';
    print_r($data);
    die();
</code></pre>
<p>The result:</p>
<pre><code>(
    [address] =&gt; XXXXXXXX
    [total_txn] =&gt; 2
    [total_received] =&gt; 0.00917981
    [total_sent] =&gt; 0
    [final_balance] =&gt; 0.00917981
    [transaction_list] =&gt; Array
        (
            [0] =&gt; Array
                (
                    [amount] =&gt; 0.00298651
                    [hash] =&gt; XXXXXXX
                    [time] =&gt; 1235576379
                )

            [1] =&gt; Array
                (
                    [amount] =&gt; 0.0061933
                    [hash] =&gt; XXXXXXXXXX
                    [time] =&gt; 1632561967
                )
        )
)
</code></pre>

CC BY-SA 4.0
2021-11-01T06:23:40.990Z
2021-11-01T06:23:40.990Z
rockstardev
<p>Is there an <strong>example</strong> of how to get all the transaction data for a bitcoin address in json format? </p>

<transactions><blockchain.info><api>
How to get the list of transactions of input/outputs for a bitcoin address in JSON format?
Patoshi パトシ
# How to get the list of transactions of input/outputs for a bitcoin address in JSON format?

(Asked by: username_0 on 2017-03-02)

Is there an **example** of how to get all the transaction data for a bitcoin address in json format?

**Tags:** transactions, blockchain.info, api


---

## 6 answers

### Answer by username_1 on 2018-08-29. Score: 3 | Accepted answer

You can use [api](https://www.blockchain.com/api/blockchain_api) provided by blockchain.info.

For example use `https://blockchain.info/rawaddr/$bitcoin_address` to get all the transactions for an address in JSON format.

> **Comments:**
> **username_2**: How to detect status of transactions?  

---

### Answer by username_3 on 2017-07-04. Score: 2

As answered above you can use blockchain.info for extracting the results. Here I would like to add to the solution provided by username_6, his code works fine but it extracts only latest 50 results/transactions made by the address that you are trying to retrieve the data for.

In order to extract the complete details of the transaction right from the beginning, some minor tweaks have to be made to the code. Below is my solution

```
<?php
$address = $_POST['Address'];
$url = "https://blockchain.info/address/".$address."?format=json&offset=0";
$json = json_decode(file_get_contents($url), true);

$totalTxs = $json["n_tx"];
echo "Total transaction : $totalTxs";
for($ex=0;$ex<$totalTxs;$ex+=50){
//$address = "1HB5XMLmzFVj8ALj6mfBsbifRoD4miY36v";
$url = "https://blockchain.info/address/".$address."?format=json&offset=$ex";
$json = json_decode(file_get_contents($url), true);

//total transactions
$totalTxs = $json["n_tx"];
//final balance
$balanceSatoshis = $json["final_balance"];
$balanceBitcoins = $balanceSatoshis / 100000000;
$balanceBitcoins = number_format($balanceBitcoins, 8);

//loop through each transaction and display all inputs and outs
for($i=0;$i<50;$i++){

echo "<table><tr><td>";
echo "HASH OF TX:</br>";
$hash=$json["txs"][$i]["hash"];
echo "&nbsp;".$hash;

echo "</td><td width='550'>SENT FROM:<br>";
$n_inputs = count($json["txs"][$i]["inputs"]);  

for($ii = 0; $ii < $n_inputs; $ii++){   
    $inValue = $json["txs"][$i]["inputs"][$ii]["prev_out"]["value"];    
    $inValueCalc = $inValue / 100000000;    
    $inAddy = $json["txs"][$i]["inputs"][$ii]["prev_out"]["addr"];  
    echo "&nbsp;". rtrim(number_format($inValueCalc, 8), '0') ."&nbsp;". $inAddy ."&nbsp;"; 
    echo "<br>";
    }   

echo "</td><td>SENT TO:<br>";
$n_outputs = count($json["txs"][$i]["out"]);    

for($io = 0; $io < $n_outputs; $io++){  
    $outValue = $json["txs"][$i]["out"][$io]["value"];  
    $outValueCalc = $outValue / 100000000;  
    $outAddy = $json["txs"][$i]["out"][$io]["addr"];    
    echo "&nbsp;". rtrim(number_format($outValueCalc, 8), '0') ."&nbsp;". $outAddy ."&nbsp;";   
    echo "<br>";    
    }   
echo "</td></tr></table>";
}
}
?>

```

> **Comments:**
> **username_0**: what was the trick you used to bypass the 50 limit?  
> **username_3**: "https://blockchain.info/address/".$address."?format=json&offset=0". I used the offset to get the desired results. As in when the offset is set to "0" it would fetch you latest 50 results. If you go on increasing the offset by 50, then subsequently you would be getting previous results from the earlier transactions. Blockchain.info sends you the results of first page when you query with offset "0". When you query with offset ="50" it would send you the results from second page and so on. So what I basically did was iterating over the offset till I reach the end or total no of transactions.  

---

### Answer by username_4 on 2017-03-02. Score: 0

You can use [blockr](http://blockr.io/documentation/api) API.

```
http://btc.blockr.io/api/v1/address/txs/the_address 

```

Where `the_address` is the address you are looking information about.

However, this is limited to the 200 most recent transactions.

Here you have a **simple Python example** that does so:

```
from json import loads
from requests import get

url = 'http://btc.blockr.io/api/v1/address/txs/'
btc_addr = '36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6'

r = get(url + btc_addr)
data = loads(r.content)['data']

print data

```

Where `36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6` is a random picked address. The result wil be:

```
{u'txs':[
   {u'time_utc': u'2017-03-03T08:22:57Z', u'amount': 5,  u'confirmations': 4, u'amount_multisig': 0, 
     u'tx': u'fc8bd6d4bff2c5c07f82939cbf798f4442226f39b607353fe8355cf3170d67b7'}, 
   {u'time_utc': u'2017-01-03T17:14:19Z', u'amount': -10, u'confirmations': 9084, u'amount_multisig': 0, 
     u'tx': u'daa9f8c25ce09240a02df1ac56122bb014eb9f6abe5a22bbfe04ee4fa1afb9cc'}, 
   {u'time_utc': u'2017-01-03T11:10:21Z', u'amount': 10, u'confirmations': 9129, u'amount_multisig': 0, 
     u'tx': u'13362f7a746cfe6481e08155d778bba69c8db706673b99239762f5dca14f18f4'}
], u'limit_txs': 200, u'nb_txs': 3, u'nb_txs_displayed': 3, u'address': u'36YKytAqTfq5FbjrBqMwnEdS62eZjB7DV6'}

```

> **Comments:**
> **username_5**: the link to blockr is redirecting to coinbase.  
> **username_4**: blockr.io have shutdown their server recently.  

---

### Answer by username_6 on 2017-03-03. Score: 0

Your question is tagged with **blockchain.info** so you can just use the endpoint `https://blockchain.info/address/1ADDRESSTOLOOKUPGOESHERE?format=json`

The output will provide an initial summary on the address, followed by each transaction in the `txs[]` array with all inputs and outputs. You also requested an example so below is a snippet response.

```
{
    "hash160":"eaad40023319c547321b63f8adc6cc5a11759c61",
    "address":"1NPrfWgJfkANmd1jt88A141PjhiarT8d9U",
    "n_tx":159,
    "total_received":261352990,
    "total_sent":259703473,
    "final_balance":1649517,
    "txs":[

{
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":221676260,
            "type":0,
            "addr":"19hNEoHRGb2wDpxWGgDEDwaoHdEfKjZwWx",
            "value":3214191,
            "n":20,
            "script":"76a9145f635f8cf8ad279cd74eb24a44cd128973e00a0e88ac"
         },
         "script":"47304402207edc4373fbb9a01ac6e07eb88f91c7008e2ed951603a3ce03393d2bf7e99bcbd022060963067a9559cc8b140136dc4f78819731260151ed9d81c19c25ffd8df42b7a01410497e0923c9b2ea5261733f81fa83333d25373db3feae91e15ae42f5347e8f65080c90b33cba4470e5eabec06db30a57b4017ad3588a26722e36249eb5c6679a39"
      }
   ],
   "block_height":454724,
   "relayed_by":"87.128.111.190",
   "out":[
      {
         "addr_tag_link":"http:\/\/wearechange.org\/donate\/",
         "addr_tag":"wearechange.org",
         "spent":false,
         "tx_index":225606846,
         "type":0,
         "addr":"12HdLgeeuA87t2JU8m4tbRo247Yj5u2TVP",
         "value":166948,
         "n":0,
         "script":"76a9140e1d1da1fc5bb5165a54a4d9ecefbc8458bae3d388ac"
      }
   ],

```

So let's say you're using PHP and you want to fetch and display all the transactions for a particular address. You'd call the API then loop through each in the array.

<http://phpfiddle.org/main/code/e4jy-rrqt>

```
<?php

$address = "1NPrfWgJfkANmd1jt88A141PjhiarT8d9U";
$url = "https://blockchain.info/address/".$address."?format=json";
$json = json_decode(file_get_contents($url), true);

//total transactions
$totalTxs = $json["n_tx"];
//final balance
$balanceSatoshis = $json["final_balance"];
$balanceBitcoins = $balanceSatoshis / 100000000;
$balanceBitcoins = number_format($balanceBitcoins, 8);

//loop through each transaction and display all inputs and outs
for($i=0;$i<$totalTxs;$i++){

    echo "<table><tr><td width='550'>";
    echo "SENT FROM:<br>";
    $n_inputs = count($json["txs"][$i]["inputs"]);  

    for($ii = 0; $ii < $n_inputs; $ii++){   
        $inValue = $json["txs"][$i]["inputs"][$ii]["prev_out"]["value"];    
        $inValueCalc = $inValue / 100000000;    
        $inAddy = $json["txs"][$i]["inputs"][$ii]["prev_out"]["addr"];  
        echo "<button style='background-color:red;'>". rtrim(number_format($inValueCalc, 8), '0') ."</button><a href='#'>". $inAddy ."</a>";    
        echo "<br>";
        }   
    echo "</td><td>SENT TO:<br>";
    $n_outputs = count($json["txs"][$i]["out"]);    

    for($io = 0; $io < $n_outputs; $io++){  
        $outValue = $json["txs"][$i]["out"][$io]["value"];  
        $outValueCalc = $outValue / 100000000;  
        $outAddy = $json["txs"][$i]["out"][$io]["addr"];    
        echo "<button style='background-color:green;'>". rtrim(number_format($outValueCalc, 8), '0') ."</button><a href='#'>". $outAddy ."</a>";    
        echo "<br>";    
        }   
    echo "</td></tr></table>";
}

?>

```

> **Comments:**
> **username_2**: How to get status of transactions in these data?  

---

### Answer by username_7 on 2020-05-09. Score: 0

```
bicoin api - listreceivedbyaddress(minconf,include_empty,include_watchonly,address_filter)
return json:
[
  {
    address: '37ngGpLcqbgU3Bov8hjMSzgqBKfLyB3f9r',
    amount: 0.0003039,
    confirmations: 92,
    label: '',
    txids: [
      '76acd9e2b7b79f68c9a4a3a4a5cce3528ee8ae6d383aed069bf03d5e95408ec7'
    ]
  }
]

```


---

### Answer by username_8 on 2021-11-01. Score: 0

I couldn't get the transactions AND the total BTC that came in per transaction using the advice on pages like [this](https://bitcoin.stackexchange.com/questions/51794/how-to-get-the-list-of-transactions-of-input-outputs-for-a-bitcoin-address-in-js). Luckily I stumbled upon [this](https://tangleskills.com/get-bitcoin-address-details-and-transaction-list-in-php/) which solves it beautifully:

```
$address = 'YOUR BTC ADDRESS';

    $transaction_list=array();
    $satoshi=100000000;
    $txnlist=file_get_contents("https://blockchain.info/rawaddr/".$address);
    if($txnlist)
    {
      $txnlist=json_decode($txnlist,true);
      if($txnlist && isset($txnlist['txs']) && $txnlist['txs'])
      {
        $txns=$txnlist['txs'];
        foreach($txns as $txn)
         {
           $amount=$txn['result']/$satoshi;
           $time=$txn['time'];
           $hash=$txn['hash'];
           $transaction_list[]=array(
             'amount'=>$amount,
             'hash'=>$hash,
             'time'=>$time
           );
         }
        }
     $data['address']=$txnlist['address'];
     $data['total_txn']=$txnlist['n_tx'];
     $data['total_received']=$txnlist['total_received']/$satoshi;
     $data['total_sent']=$txnlist['total_sent']/$satoshi;
     $data['final_balance']=$txnlist['final_balance']/$satoshi;
     $data['transaction_list']=$transaction_list;
    }
    print '<pre>';
    print_r($data);
    die();

```

The result:

```
(
    [address] => XXXXXXXX
    [total_txn] => 2
    [total_received] => 0.00917981
    [total_sent] => 0
    [final_balance] => 0.00917981
    [transaction_list] => Array
        (
            [0] => Array
                (
                    [amount] => 0.00298651
                    [hash] => XXXXXXX
                    [time] => 1235576379
                )

            [1] => Array
                (
                    [amount] => 0.0061933
                    [hash] => XXXXXXXXXX
                    [time] => 1632561967
                )
        )
)

```


---

