sign_message()

Use agent.sign_message() to cryptographically sign messages on EVM networks. Supports both EIP-191 (simple text messages) and EIP-712 (typed structured data) signing standards. Returns signature components (v, r, s) and a formatted signature string. Commonly used for authentication, off-chain orders, and proving wallet ownership.

Signature

agent.sign_message(
    request: {
        messageType: "eip191" | "eip712",
        chainId: int,
        data: dict
    }
) -> EvmMessageSignResponse

Parameters

Param
Type
Description

request

dict

Message signing configuration

request.messageType

str

Signing standard to use; 'eip191' | 'eip712'

request.chainId

int

Ethereum Chain ID

request.data

dict

Message data (see formats below)

EIP-191 Data Format

For simple message signing

EIP-712 Data Format

For typed structured data

Returns

  • EvmMessageSignResponse

Examples

EIP-191 (Simple Message)

EIP-712 (Typed Data)

Common Errors

Error
Cause
Solution

"Invalid chain ID"

Chain ID doesn't match network

Ensure chainId matches network (e.g., mainnet is 1, or ethereum:1)

"Invalid EIP-712 data"

Malformed typed data structure

Validate domain, types, primaryType, and message format

"Invalid message"

Empty or malformed message for EIP-191

Ensure data.message is a non-empty string

Last updated