Retrieving Bitcoin Transaction Data for a Specific Address
In this article, we will explore how to extract a list of transactions for a specific Bitcoin address in JSON format using various methods and tools.
Method 1: Use Blockchain.info
Blockchain.info is one of the most popular blockchain explorers and provides access to a wealth of transaction data. You can search for a Bitcoin address on their website and see its transaction history in JSON format.
Here’s how:
- Go to [Blockchair.com] ( (not Blockchain.info).
- Enter the Bitcoin address whose transactions you want to recover.
- In the “Transactions” tab, click “Get Transaction History”.
- Select the output format as “JSON”.
- Click “Get Data”.
- The transaction data will be displayed in JSON format.
Method 2: Using Blockchain Explorer (ETH)
The Ethereum blockchain explorer [Blockchair.com] ( also provides access to Bitcoin transactions. You can search for a Bitcoin address and see its transaction history in JSON format.
Here’s how:
- Go to [Blockchair.com] (
- Enter the Bitcoin address whose transactions you want to recover.
- In the “Transactions” tab, click “Get Transaction History”.
- Select the output format “JSON”.
- Click “Get Data”.
- The transaction data will be displayed in JSON format.
Method 3: Using a Python script
You can also use a Python script to get Bitcoin transaction data for a specific address in JSON format. Here is an example:
import requests
def get_transactions(address, output_format):
url = f"
parameters = {"format": output_format}
response = requests.get(url, params=params)
data = response.json()
return data
Get transactions for a specific addressaddress = "bc1... your-address-bc1-here"
output_format = "json"
transactions = get_transactions(address, output_format)
for transactions by transactions:
print(transaction["txid"], transaction["index"], transaction["blockhash"])
This script sends a GET request to the Ethereum blockchain API with the specified output address and format. It then returns a list of transactions in JSON format.
Method 4: Using Web3.js
Alternatively, you can use the Web3.js library (available on GitHub) to interact with the Ethereum blockchain and retrieve Bitcoin transaction data for a specific address.
const Web3 = require("web3");
const web3 = new Web3 (new Web3.providers.HttpProvider('
const address = "bc1...your-bc1-address-here";
asynchronous function getTransactions() {
const txs = await web3.eth.getTransactionHistory(address, { includeInBlockHeaders: true });
for (const tx of txs) {
console.log(tx);
}
}
getTransactions();
This script uses the Web3.js library to interact with the Ethereum blockchain and retrieve Bitcoin transaction data for a specific address. Each transaction is then recorded in JSON format.
Sample Output
Regardless of the method chosen, here is a sample output:
[
{
"txid": "00012345",
"index": 1,
"blockhash": "0c56f5d6..."
},
{
"txid": "00067890",
"index": 2,
"blockhash": "0b345df8..."
}
]
This output shows the transaction ID, index, and block hash for each transaction in JSON format.