> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bloklake.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wallet activity

> Everything a set of wallets sent and received: transactions and token transfers, in one request.

A wallet's history has two parts:

* **Transactions** it sent (`from`) or received (`to`): ETH transfers and contract calls.
* **Token transfers** in and out, which live in logs (`Transfer` events) of the token
  contracts, not in the wallet's own transactions. A wallet can receive tokens without ever
  sending a transaction.

One request gets both. With the [Python client](https://docs.bloklake.com/clients.md):

```python theme={null}
from bloklake import Bloklake

bl = Bloklake(chain="eth")
WALLET = "0x55fe002aeff02f77364de339a1292923a15844b8"
TOPIC = "0x" + "00" * 12 + WALLET[2:]  # the wallet as a 32-byte topic
TRANSFER = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"

activity = bl.collect({
    "from_block": 19426000,
    "to_block": 19427499,
    "transactions": [{"from": [WALLET]}, {"to": [WALLET]}],
    "logs": [
        {"topic0": [TRANSFER], "topic1": [TOPIC]},  # tokens sent
        {"topic0": [TRANSFER], "topic2": [TOPIC]},  # tokens received
    ],
    "fields": {
        "transaction": ["block_number", "hash", "from", "to", "value", "status"],
        "log": ["block_number", "address", "topic1", "topic2", "data"],
    },
})
print(len(activity.transactions), "transactions,", len(activity.logs), "token transfers")
received = [log for log in activity.logs if log["topic2"] == TOPIC]
print(len(received), "received; first token:", received[0]["address"])
```

```text theme={null}
366 transactions, 355 token transfers
187 received; first token: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48
```

How the filters combine:

* Two transaction objects: a transaction matches if it's **from or to** the wallet.
* Two log objects: a `Transfer` matches if the wallet is the **sender or the receiver**.
* `address` is not set on the logs, so transfers of **every** token are included. `address` in
  the output tells you which token.

> [!WARNING]
>
> The wallet in a topic must be padded to 32 bytes. `0x` + 24 zeros + the 40 hex characters of the
> address. A 20-byte value in a topic filter is a `400`.

## Many wallets

Put several wallets in each list (`"from": [w1, w2, …]`, `"topic1": [t1, t2, …]`). For
thousands, create two [sets](https://docs.bloklake.com/querying/sets.md): an `address` set for the transaction filters
(`fromSet`, `toSet`) and a `topic` set of the padded wallets for the log filters (`topic1Set`,
`topic2Set`).

## What this doesn't cover

* **Internal ETH transfers** (ETH moved by a contract during a call) aren't transactions or
  logs. Bloklake has no traces, so they aren't visible.
* **Tokens that don't emit standard `Transfer` events**, and native-token movements on L2s that
  use other events. Add their events as more log filter objects.
* **Approvals, NFT transfers (ERC-721/1155)**: add their event signatures. ERC-721 `Transfer`
  shares `topic0` with ERC-20 and is already included; ERC-1155 uses `TransferSingle` and
  `TransferBatch`, where the wallet is in `topic2`/`topic3`.

## Reverted transactions

A reverted transaction still appears in the `transactions` stream with `status = 0`; its logs
don't exist (a revert discards them). Add `"status": 1` to both transaction objects if you only
want successful ones.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.