☀️ solarchive beta

Home Learn Community Support RSS

How to Find All Transactions for a Wallet

● Beginner ⏱ 10 min

One of the most common questions when working with blockchain data is: "What transactions has this wallet address been involved in?" This guide shows you how to query SolArchive data to find all transactions for a specific wallet.

Prerequisites: This guide assumes you've already downloaded SolArchive data. If you haven't, start with How to Download SolArchive Data first. You'll need the txs (transactions) dataset.

Table of Contents

Understanding Account Keys

Every Solana transaction includes an account_keys array containing all wallet addresses involved in the transaction. This includes:

To find all transactions for a wallet, we search for transactions where the wallet address appears anywhere in the account_keys array.

Note: A wallet appearing in account_keys doesn't necessarily mean it sent or received tokens. It could be involved in other ways (program interactions, account rent, etc). To specifically track token transfers, see the section below.

Basic Wallet Query

Here's how to find all transactions involving a specific wallet address:

-- Find all transactions for a wallet
SELECT 
    block_timestamp,
    signature,
    fee / 1e9 as fee_sol,
    status
FROM read_parquet('data/txs/**/*.parquet')
WHERE list_contains(account_keys, 'YOUR_WALLET_ADDRESS_HERE')
ORDER BY block_timestamp DESC
LIMIT 100;

This query uses list_contains() to check if your wallet address appears in the account_keys array. The results show:

Finding Token Transfers

To specifically find token transfers (sends and receives), we need to check the pre_token_balances and post_token_balances arrays:

-- Find transactions with token transfers for a wallet
SELECT 
    t.block_timestamp,
    t.signature,
    tok.symbol,
    tok.name,
    (post.amount - pre.amount) / POW(10, pre.decimals) as amount_change,
    CASE 
        WHEN post.amount > pre.amount THEN 'received'
        ELSE 'sent'
    END as direction
FROM read_parquet('data/txs/**/*.parquet') as t,
    UNNEST(t.pre_token_balances) as pre,
    UNNEST(t.post_token_balances) as post
LEFT JOIN read_parquet('data/tokens/**/*.parquet') as tok
    ON pre.mint = tok.mint
WHERE list_contains(t.account_keys, 'YOUR_WALLET_ADDRESS_HERE')
  AND pre.mint = post.mint
  AND pre.account_index = post.account_index
  AND pre.amount != post.amount
  AND t.status = 'Success'
  AND tok.symbol IS NOT NULL
ORDER BY t.block_timestamp DESC
LIMIT 50;

This query shows:

Wallet Statistics

Want to see overall statistics for a wallet? This query calculates totals:

-- Transaction statistics for a wallet
SELECT 
    COUNT(*) as total_transactions,
    COUNT(CASE WHEN status = 'Success' THEN 1 END) as successful,
    COUNT(CASE WHEN status != 'Success' THEN 1 END) as failed,
    SUM(fee) / 1e9 as total_fees_sol,
    MIN(block_timestamp) as first_transaction,
    MAX(block_timestamp) as latest_transaction
FROM read_parquet('data/txs/**/*.parquet')
WHERE list_contains(account_keys, 'YOUR_WALLET_ADDRESS_HERE');

This gives you:

Complete Python Script

Here's a complete Python script that ties it all together:

import duckdb

# Your wallet address
WALLET_ADDRESS = "YOUR_WALLET_ADDRESS_HERE"

con = duckdb.connect()

# Find all transactions for the wallet
query = f"""
SELECT 
    block_timestamp,
    signature,
    fee / 1e9 as fee_sol,
    status,
    list_count(account_keys) as num_accounts
FROM read_parquet('data/txs/**/*.parquet')
WHERE list_contains(account_keys, '{WALLET_ADDRESS}')
ORDER BY block_timestamp DESC
LIMIT 100
"""

result = con.execute(query).fetchdf()
print(f"\nFound {len(result)} transactions for wallet {WALLET_ADDRESS[:8]}...\n")
print(result.to_string())

# Get statistics
stats_query = f"""
SELECT 
    COUNT(*) as total_transactions,
    COUNT(CASE WHEN status = 'Success' THEN 1 END) as successful,
    COUNT(CASE WHEN status != 'Success' THEN 1 END) as failed,
    SUM(fee) / 1e9 as total_fees_sol,
    MIN(block_timestamp) as first_transaction,
    MAX(block_timestamp) as latest_transaction
FROM read_parquet('data/txs/**/*.parquet')
WHERE list_contains(account_keys, '{WALLET_ADDRESS}')
"""

stats = con.execute(stats_query).fetchdf()
print("\n=== Wallet Statistics ===")
print(stats.to_string())

con.close()

Run it with:

uv run find_wallet_txs.py

Example Output

You'll see output like:

Found 1,247 transactions for wallet 8NN9ZVVa...

   block_timestamp          signature                    fee_sol    status
0  2025-12-01 23:59:58     5J9Kf2h8Ld3m9pQ7sR...       0.000005   Success
1  2025-12-01 18:32:15     3nF4sK8Lm3pQ9tY2v...       0.000005   Success
2  2025-12-01 12:08:42     7kP3mN8Lp2sR9wX5t...       0.000005   Success
...

=== Wallet Statistics ===
   total_transactions  successful  failed  total_fees_sol  first_transaction    latest_transaction
0  1247               1243        4       0.006235        2024-03-15 08:22:11  2025-12-01 23:59:58

Next Steps

Now that you can find wallet transactions, you might want to: