> 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/api-reference/eip712/struct-hash.md).

# struct\_hash

Compute EIP-712 struct hash for an `UnsignedSeismicTx`.

## Signature

```python
def struct_hash(tx: UnsignedSeismicTx) -> bytes
```

## Parameters

| Parameter | Type                                                                                          | Required | Description                      |
| --------- | --------------------------------------------------------------------------------------------- | -------- | -------------------------------- |
| `tx`      | [`UnsignedSeismicTx`](/clients/python/api-reference/transaction-types/unsigned-seismic-tx.md) | Yes      | The unsigned Seismic transaction |

## Returns

| Type    | Description                                  |
| ------- | -------------------------------------------- |
| `bytes` | 32-byte keccak256 hash of the encoded struct |

## How it works

```
keccak256(
    TX_SEISMIC_TYPE_HASH
    ‖ encode(chain_id)
    ‖ encode(nonce)
    ‖ encode(gas_price)
    ‖ encode(gas)
    ‖ encode(to)
    ‖ encode(value)
    ‖ keccak256(data)              // dynamic type
    ‖ keccak256(encryption_pubkey) // dynamic type
    ‖ encode(encryption_nonce)
    ‖ encode(message_version)
    ‖ recent_block_hash            // already 32 bytes
    ‖ encode(expires_at_block)
    ‖ encode(signed_read)
)
```

## Encoding details

* Static fields are left-padded to 32 bytes
* Dynamic `bytes` fields (`tx.data`, `tx.seismic.encryption_pubkey`) are hashed with `keccak256` before inclusion
* `encryption_nonce` is converted from 12 bytes to a `uint96` integer via `int.from_bytes(…, "big")`
* `to` becomes 32 zero bytes when `tx.to is None`

## See Also

* [eip712\_signing\_hash](/clients/python/api-reference/eip712/eip712-signing-hash.md) — uses struct hash
* [domain\_separator](/clients/python/api-reference/eip712/domain-separator.md) — the other component of the signing hash
* [build\_seismic\_typed\_data](/clients/python/api-reference/eip712/build-seismic-typed-data.md) — builds full typed data


---

# 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/api-reference/eip712/struct-hash.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.
