> For the complete documentation index, see [llms.txt](https://docs.seismic.systems/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.seismic.systems/clients/python/src20/intelligence-providers/watch-src20-events-with-key.md).

# watch\_src20\_events\_with\_key

Watch SRC20 Transfer and Approval events using an explicit viewing key, without requiring wallet authentication.

## Signatures

```python
def watch_src20_events_with_key(
    w3: Web3,
    *,
    viewing_key: Bytes32,
    token_address: ChecksumAddress | None = None,
    on_transfer: TransferCallback | None = None,
    on_approval: ApprovalCallback | None = None,
    on_error: ErrorCallback | None = None,
    poll_interval: float = 2.0,
    from_block: int | str = "latest",
) -> SRC20EventWatcher

async def async_watch_src20_events_with_key(
    w3: AsyncWeb3,
    *,
    viewing_key: Bytes32,
    ...same keyword args...
) -> AsyncSRC20EventWatcher
```

## Parameters

| Parameter       | Type                                                        | Default    | Description                                          |
| --------------- | ----------------------------------------------------------- | ---------- | ---------------------------------------------------- |
| `w3`            | `Web3` / `AsyncWeb3`                                        |            | Standard Web3 instance (no Seismic namespace needed) |
| `viewing_key`   | [`Bytes32`](/clients/python/api-reference/types/bytes32.md) |            | 32-byte AES-256 viewing key                          |
| `token_address` | `ChecksumAddress \| None`                                   | `None`     | SRC20 contract to filter (`None` = all tokens)       |
| `on_transfer`   | Callback                                                    | `None`     | Invoked for Transfer events                          |
| `on_approval`   | Callback                                                    | `None`     | Invoked for Approval events                          |
| `on_error`      | Callback                                                    | `None`     | Invoked on errors                                    |
| `poll_interval` | `float`                                                     | `2.0`      | Seconds between polls                                |
| `from_block`    | `int \| "latest"`                                           | `"latest"` | Starting block                                       |

## Returns

[`SRC20EventWatcher`](/clients/python/src20/event-watching/src20-event-watcher.md) (sync) or [`AsyncSRC20EventWatcher`](/clients/python/src20/event-watching/async-src20-event-watcher.md) (async) — already started.

## Example

```python
import os
from web3 import Web3
from seismic_web3 import Bytes32
from seismic_web3.src20 import watch_src20_events_with_key

w3 = Web3(Web3.HTTPProvider("https://testnet-1.seismictest.net/rpc"))
viewing_key = Bytes32(bytes.fromhex(os.environ["VIEWING_KEY"].removeprefix("0x")))

watcher = watch_src20_events_with_key(
    w3,
    viewing_key=viewing_key,
    on_transfer=lambda log: print(f"Transfer: {log.decrypted_amount}"),
)

# Later...
watcher.stop()
```

## Notes

* Does **not** require `EncryptionState` or a wallet private key — only a plain `Web3` instance and the viewing key
* No RPC call to Directory (unlike `watch_src20_events` which fetches the key)
* Useful when you have a shared viewing key or want to avoid the signed read

## See Also

* [watch\_src20\_events](/clients/python/src20/event-watching/watch-src20-events.md) — Watch with automatic key fetch from Directory
* [SRC20EventWatcher](/clients/python/src20/event-watching/src20-event-watcher.md) — Underlying sync watcher class
* [get\_viewing\_key](/clients/python/src20/intelligence-providers/get-viewing-key.md) — Fetch a key to pass here


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.seismic.systems/clients/python/src20/intelligence-providers/watch-src20-events-with-key.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
