List all Transactions in Specific Account?

Hi all,

I was wondering if it is possible to use the Python SDK to access all the transactions for a specific account? More specifically, I am trying to access each individual transaction’s notefield to check if a specific data value exist.

Any guidance would be greatly appreciated!

Hi Dave,

A prerequisite to accessing all transactions is to make sure you’re accessing an archival node with the indexer turned on. Or if you are processing transactions within the last 300 blocks or so you could hit a participation node instead.

You can instantiate an AlgodClient and use the transactions_by_address function:

So something like this:

import base64
from algosdk import algod

client = algod.AlgodClient(nodetoken, nodeaddress)
txs = client.transactions_by_address("XYHHG45LFXGCPPPYWAZBBXULUC6LT2KK4RONPWXN2FEGB2CTA5VBC3QTM4", first=2038000, last=2038665) # don't need first and last if you have an indexer node

# get first transaction if it exists 
if len(txs.get("transactions")) > 0:
    tx0 = txs.get("transactions")[0]
    # read noteb64 field of first transaction
    noteb64 = tx0.get("noteb64")
    # Decode to bytes
    note = base64.b64decode(noteb64)

Here’s what the note looks like in bytes for this specific transaction:

>>> print(note)
b'\x86\xa9author_id\xd9:QMHT3GXE27QUFFDZ4RCSVD36JQCBK5ZXIJGQBCO6HR32CWJFTYHKWV5KPY\xaaauthor_sig\xd9Xyfq+bUi6eJ6m9nepAXkPE3iSapXmNAldnnn6n7Gju3KMQa7JjbXnydXXUlbMp6iphuGb8EQBwGwlkDo0KEiHBA==\xa7content\xb3Once upon a time...\xa6locale\xa2en\xa4page\x01\xa8story_id\xd9@d746481a19a3a923d63c9c90ec439a4f5cdc021c6d2d1fe855be246cb0ea8fca'
1 Like

Thank you so much for your help, Liz! Your response was very insightful and I appreciate your assistance.

1 Like