fingerprinteip712_signing_hash

Compute EIP-712 signing hash for Seismic transaction

Compute the EIP-712 signing hash for a Seismic transaction.

Overview

eip712_signing_hash() computes the 32-byte message hash that gets ECDSA-signed for EIP-712 typed data transactions. This is the hash of the domain separator and struct hash, following the EIP-712 specification.

Signature

def eip712_signing_hash(tx: UnsignedSeismicTx) -> bytes

Parameters

Parameter
Type
Required
Description

tx

Yes

The unsigned Seismic transaction

Returns

Type
Description

bytes

32-byte keccak256 digest to be ECDSA-signed

Examples

Basic Usage

from seismic_web3 import eip712_signing_hash, UnsignedSeismicTx

unsigned_tx = UnsignedSeismicTx(...)

# Compute signing hash
signing_hash = eip712_signing_hash(unsigned_tx)

print(f"Signing hash: {signing_hash.hex()}")
print(f"Length: {len(signing_hash)} bytes")  # Always 32

Manual Signing

Compare with Raw Hash

Verify Against External Signer

How It Works

The function computes:

Where:

Implementation

EIP-712 Structure

The hash encodes:

  1. Domain - Chain ID and verifying contract

  2. Message - All transaction fields (chain ID, nonce, gas, data, Seismic elements)

This provides:

  • Structured hashing - Not just raw bytes

  • Domain separation - Binds to specific chain and contract

  • Human-readable - Wallets can display structured data

Notes

  • Used internally by sign_seismic_tx_eip712

  • Different from raw signing hash (RLP hash of unsigned transaction)

  • Always 32 bytes (keccak256 output)

  • The Seismic node checks message_version to determine which hash to verify

Use Cases

  • Custom signing - Sign with external wallet or HSM

  • Verification - Check signature correctness

  • Testing - Verify hash computation

  • Debugging - Inspect signing process

Warnings

  • Message version - Should be used with message_version == 2

  • Chain ID - Must match the target chain

  • Hash only - This returns the hash, not the signature

See Also

Last updated