pen-to-squaresign_seismic_tx_eip712

Sign and serialize Seismic transaction using EIP-712

Sign and serialize a Seismic transaction using EIP-712 typed data.

Overview

sign_seismic_tx_eip712() is the primary function for signing Seismic transactions with EIP-712 structured data hashing. It computes the EIP-712 signing hash, applies an ECDSA signature, and returns the complete RLP-serialized transaction bytes ready for broadcast.

Signature

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

Parameters

Parameter
Type
Required
Description

tx

Yes

The unsigned Seismic transaction (should have message_version == 2)

private_key

Yes

32-byte secp256k1 private key for signing

Returns

Type
Description

HexBytes

Full signed transaction bytes (0x4a prefix + RLP-encoded transaction)

Examples

Basic Usage

From Debug Write

Verify Message Version

Inspect Signed Transaction

How It Works

The function performs three steps:

  1. Compute EIP-712 signing hash

  2. Sign with ECDSA

  3. Serialize with signature

The RLP serialization is identical to raw signing; only the message hash differs.

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

Security

Same

Same

RLP output

Identical

Identical

Verification

Node uses EIP-712 path

Node uses raw path

Transaction Format

The returned bytes have this structure:

Notes

  • The transaction's message_version should be 2 for EIP-712 signing

  • The RLP serialization is identical to raw signing mode

  • The Seismic node checks message_version to determine verification path

  • The SDK defaults to EIP-712 for better wallet UX

  • Returned bytes are ready for eth_sendRawTransaction

Warnings

  • Private key security - Never log or expose private keys

  • Message version - Must match signing method (2 for EIP-712)

  • Transaction validity - Ensure expires_at_block hasn't passed

  • Nonce management - Incorrect nonce causes transaction rejection

See Also

Last updated