In this post, we will see a Rest API of how to get Bitcoin address details and a Transaction list of any given address. The API is written in PHP but can be used in any language with related changes to that certain language.
Bitcoin is a cryptocurrency invented in 2008 by an unknown person or group of people using the name Satoshi Nakamoto and started in 2009 when its implementation was released as open-source software.
We use “file_get_contents” method to fetch data from the Blockchain database in JSON format and use it accordingly. We format the data properly and show it in this API.
Find the whole code below and use the code as it is wherever you want.
$address='ENTER BITCOIN ADDRESS HERE';
if($txnlist && isset($txnlist['txs']) && $txnlist['txs'])
foreach($txns as $txn)
Sample API Response (You will get array response)
[address] => 'ADDRESS HERE' //Address
[total_txn] => 26 // Number of Transactions
[total_received] => 0.2393291 //Total Amount Received
[total_sent] => 0.19713826 //Total Amount Sent
[final_balance] => 0.04219084 //Final Balance of that amount
[transaction_list] => Array() //Transaction List in array format
This can be modified according to your need. If file_get_contents doesn’t work for you try to enable it on your server using “allow_url_fopen“. Change allow_url_fopen to TRUE (1) if its disabled.
Or you can also use CURL request using above url.