struct_hash
Compute TxSeismic EIP-712 struct hash
Compute EIP-712 struct hash for an UnsignedSeismicTx.
Signature
def struct_hash(tx: UnsignedSeismicTx) -> bytesParameters
Parameter
Type
Required
Description
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
bytesfields (tx.data,tx.seismic.encryption_pubkey) are hashed withkeccak256before inclusionencryption_nonceis converted from 12 bytes to auint96integer viaint.from_bytes(…, "big")tobecomes 32 zero bytes whentx.to is None
See Also
eip712_signing_hash — uses struct hash
domain_separator — the other component of the signing hash
build_seismic_typed_data — builds full typed data
Last updated

