import requests
import time
def check_address_last_transaction_dates(filename):
with open(filename, ‘r’) as file:
address_list = [line.strip() for line in file]
for address in address_list:
url = f"https://blockchain.info/address/{address}?format=json"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
if "txs" in data:
# Find the most recent transaction in the list of transactions
transactions = data["txs"]
if transactions:
most_recent_tx = max(transactions, key=lambda x: x["time"])
last_tx_date = most_recent_tx["time"]
last_tx_date_formatted = format_timestamp_to_month_year(last_tx_date)
print(f"Address: {address}, Last Transaction Date: {last_tx_date_formatted}\n")
else:
print(f"Address: {address}, No last transaction data available\n")
else:
print(f"Address: {address}, No transaction data available\n")
else:
print(f"Address: {address}, Error fetching data\n")
# Introduce a 1-second delay between checking addresses
time.sleep(1)
def format_timestamp_to_month_year(timestamp):
# Convert UNIX timestamp to month/year format
from datetime import datetime
date = datetime.utcfromtimestamp(timestamp)
return date.strftime(“%B %Y”)
filename = “btc500.txt”
check_address_last_transaction_dates(filename)
with this code you can check last transaction date/year only no other information…..replace your btc address list file with btc500.txt