> 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/sign-seismic-tx-eip712.md).

# sign\_seismic\_tx\_eip712

Sign and serialize a Seismic transaction using EIP-712 typed data hashing. This is the primary signing function for `message_version == 2` transactions.

## Signature

```python
def sign_seismic_tx_eip712(
    tx: UnsignedSeismicTx,
    private_key: PrivateKey,
) -> HexBytes
```

## Parameters

| Parameter     | Type                                                                                          | Required | Description                                                           |
| ------------- | --------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------- |
| `tx`          | [`UnsignedSeismicTx`](/clients/python/api-reference/transaction-types/unsigned-seismic-tx.md) | Yes      | The unsigned Seismic transaction (should have `message_version == 2`) |
| `private_key` | [`PrivateKey`](/clients/python/api-reference/types/private-key.md)                            | Yes      | 32-byte secp256k1 private key                                         |

## Returns

| Type       | Description                                                                            |
| ---------- | -------------------------------------------------------------------------------------- |
| `HexBytes` | Full signed transaction bytes (`0x4a` prefix + RLP) ready for `eth_sendRawTransaction` |

## Steps

1. Compute [`eip712_signing_hash(tx)`](/clients/python/api-reference/eip712/eip712-signing-hash.md)
2. Sign with `eth_keys.PrivateKey.sign_msg_hash()`
3. Serialize with `serialize_signed(tx, sig)` — same RLP as raw signing

The RLP serialization is identical to raw signing mode; only the ECDSA message hash differs. The Seismic node checks `message_version` to determine which verification path to use.

## EIP-712 vs raw signing

| Aspect             | EIP-712 (`message_version=2`)  | Raw (`message_version=0`) |
| ------------------ | ------------------------------ | ------------------------- |
| **Signing hash**   | Structured EIP-712 hash        | RLP hash of unsigned tx   |
| **Wallet support** | Better UX (structured display) | Generic message signing   |
| **RLP output**     | Identical                      | Identical                 |
| **Verification**   | Node uses EIP-712 path         | Node uses raw path        |

## Example

```python
from seismic_web3 import sign_seismic_tx_eip712

signed_tx = sign_seismic_tx_eip712(unsigned_tx, private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx)
```

## Warnings

* The function does not enforce `message_version == 2`; callers should set it appropriately
* Ensure `expires_at_block` hasn't passed before broadcasting

## See Also

* [eip712\_signing\_hash](/clients/python/api-reference/eip712/eip712-signing-hash.md) — computes the signing hash
* [build\_seismic\_typed\_data](/clients/python/api-reference/eip712/build-seismic-typed-data.md) — build typed data dict for external signers
* [UnsignedSeismicTx](/clients/python/api-reference/transaction-types/unsigned-seismic-tx.md) — input transaction type
* [PrivateKey](/clients/python/api-reference/types/private-key.md) — signing key type


---

# 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/sign-seismic-tx-eip712.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.
