<p>If you call the address API i.e. </p>

<p><code>https://blockchain.info/address/$hash_160?format=json</code> you will get a list of transactions.</p>

<p>They all have a time attribute which is the time in unix format. <a href="https://en.wikipedia.org/wiki/Unix_time" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Unix_time</a></p>

CC BY-SA 3.0
2017-01-11T15:34:17.320Z
2017-01-11T15:34:17.320Z
Ian Purton
<p>This is an ambiguous question as we don't know what your environment is.
If you are using bitcoind, a call to <code>gettransaction</code> will give you a time field which is when the transaction has been seen.</p>

<p>Perhaps if you elaborate a bit more we would be able to answer the question more specifically.</p>

CC BY-SA 3.0
2017-01-11T10:22:40.893Z
2017-01-11T10:22:40.893Z
Alex
<p>import requests
import time</p>
<p>def check_address_last_transaction_dates(filename):
with open(filename, 'r') as file:
address_list = [line.strip() for line in file]</p>
<pre><code>for address in address_list:
    url = f&quot;https://blockchain.info/address/{address}?format=json&quot;
    response = requests.get(url)
    
    if response.status_code == 200:
        data = response.json()

        if &quot;txs&quot; in data:
            # Find the most recent transaction in the list of transactions
            transactions = data[&quot;txs&quot;]
            if transactions:
                most_recent_tx = max(transactions, key=lambda x: x[&quot;time&quot;])
                last_tx_date = most_recent_tx[&quot;time&quot;]
                last_tx_date_formatted = format_timestamp_to_month_year(last_tx_date)
                print(f&quot;Address: {address}, Last Transaction Date: {last_tx_date_formatted}\n&quot;)
            else:
                print(f&quot;Address: {address}, No last transaction data available\n&quot;)
        else:
            print(f&quot;Address: {address}, No transaction data available\n&quot;)
    else:
        print(f&quot;Address: {address}, Error fetching data\n&quot;)
    
    # Introduce a 1-second delay between checking addresses
    time.sleep(1)
</code></pre>
<p>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(&quot;%B %Y&quot;)</p>
<h1>Specify the filename containing the list of Bitcoin addresses</h1>
<p>filename = &quot;btc500.txt&quot;</p>
<p>check_address_last_transaction_dates(filename)</p>
<p>with this code you can check last transaction date/year only no other information.....replace your btc address list file with btc500.txt</p>

CC BY-SA 4.0
2023-10-31T06:15:06.640Z
2023-10-31T06:15:06.640Z
workonly for
<p>Is there a way to request the date of last transaction via API? I run a request to see balance of my addresses and need to request the date of the last transaction, how would I do that?</p>

CC BY-SA 3.0
2017-01-11T14:28:54.477Z
Hey, I assume that you are using the blockchain.info api, and thus edited the question accordingly.
Murch
<api><blockchain.info>
How can I get the date of the last transaction from the blockchain.info API?
Mccallum
# How can I get the date of the last transaction from the blockchain.info API?

(Asked by: username_0 on 2017-01-11)

Is there a way to request the date of last transaction via API? I run a request to see balance of my addresses and need to request the date of the last transaction, how would I do that?

**Tags:** api, blockchain.info

> **Comments:**
> **username_1**: Hey, I assume that you are using the blockchain.info api, and thus edited the question accordingly.  

---

## 3 answers

### Answer by username_2 on 2017-01-11. Score: 0

If you call the address API i.e.

`https://blockchain.info/address/$hash_160?format=json` you will get a list of transactions.

They all have a time attribute which is the time in unix format. <https://en.wikipedia.org/wiki/Unix_time>


---

### Answer by username_3 on 2017-01-11. Score: 0

This is an ambiguous question as we don't know what your environment is.
If you are using bitcoind, a call to `gettransaction` will give you a time field which is when the transaction has been seen.

Perhaps if you elaborate a bit more we would be able to answer the question more specifically.


---

### Answer by username_4 on 2023-10-31. Score: 0

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")

# Specify the filename containing the list of Bitcoin addresses

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


---

