- 05/02/2025
- Autor: admin
- in: CRYPTOCURRENCY
How to get Bitcoin transaction data for a specific address
In this article, we will explore how to retrieve the list of transactions for a specific Bitcoin address in JSON format using various methods and tools.
Method 1: Using Blockchain.info
Blockchain.info is one of the most popular blockchain explorers and provides access to a large amount of transaction data. You can search for a Bitcoin address on their website and view its transaction history in JSON format.
Here’s how:
- Go to [Blockchair.com]( (not Blockchain.info).
- Enter the Bitcoin address for which you want to retrieve transactions.
- Click “Get Transaction History” under the “Transactions” tab.
- Select the “JSON” output format.
- 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 view its transaction history in JSON format.
Here’s how:
- Go to [Blockchair.com](
- Enter the Bitcoin address you want to retrieve transactions for.
- Click “Get Transaction History” under the “Transactions” tab.
- Select the “JSON” output format.
- 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 retrieve Bitcoin transaction data for a specific address in JSON format. Here is an example:
import requests
def get_transactions(address, output_format):
url = f"
params = {"format": output_format}
response = requests. get(url, params=params)
data = response. json()
returns data
Get transactions for a specific addressaddress = "bc1...your-bc1-addr-here"
output_format = "json"
transactions = get_transactions(address, output_format)
for transaction in transactions:
print(transaction["txid"], transaction["index"], transaction["blockhash"])
This script sends a GET request to the Ethereum blockchain API with the address and the specified output 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-addr-here";
async 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. It then logs each transaction in JSON format.
Example Output
Regardless of which method you choose, here is an example 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.