> 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/check-has-key.md).

# check\_has\_key

Public, read-only queries against the Directory contract. No authentication required — works with a standard `Web3` instance.

## Signatures

```python
# check_has_key
def check_has_key(w3: Web3, address: ChecksumAddress) -> bool
async def async_check_has_key(w3: AsyncWeb3, address: ChecksumAddress) -> bool

# get_key_hash
def get_key_hash(w3: Web3, address: ChecksumAddress) -> bytes
async def async_get_key_hash(w3: AsyncWeb3, address: ChecksumAddress) -> bytes
```

## Parameters

| Parameter | Type                 | Description                                            |
| --------- | -------------------- | ------------------------------------------------------ |
| `w3`      | `Web3` / `AsyncWeb3` | Standard Web3 instance (no Seismic namespace required) |
| `address` | `ChecksumAddress`    | Address to query                                       |

## Returns

* **`check_has_key`** — `True` if the address has a registered viewing key
* **`get_key_hash`** — 32-byte `keccak256` hash of the viewing key (zero bytes if no key registered)

## Example

```python
from web3 import Web3
from seismic_web3.src20 import check_has_key, get_key_hash

w3 = Web3(Web3.HTTPProvider("https://testnet-1.seismictest.net/rpc"))
address = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"

if check_has_key(w3, address):
    key_hash = get_key_hash(w3, address)
    print(f"Key hash: {key_hash.hex()}")
```

## Notes

* Both use plain `eth_call` — no gas cost, no encryption needed
* The key hash is used as the 4th topic in SRC20 Transfer and Approval events for filtering

## See Also

* [register\_viewing\_key](/clients/python/src20/intelligence-providers/register-viewing-key.md) — Register a viewing key
* [get\_viewing\_key](/clients/python/src20/intelligence-providers/get-viewing-key.md) — Fetch your viewing key (authenticated)


---

# 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/check-has-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.
