skillfed

eip712

eip712: Message classes for typed structured data hashing and signing in Ethereum

eip712 v0.3.3 113.9K downloads/30d#12,323 on PyPI46
Permissive license Apache-2.0 AGING released

What it is and what it does

eip712 is a Python library that wraps EIP-712 message specification into Pydantic-based classes, letting you define strongly-typed Ethereum messages and sign them cryptographically. You define message structures by subclassing EIP712Message and EIP712Type, specify your domain configuration (name, version, contract address, chain ID), and then instantiate and sign messages using eth-account or Ape. The library handles the encoding and hashing required by the EIP-712 standard, so you work with plain Python objects rather than raw bytes.

It's built on pydantic for validation and eth-pydantic-types for ABI-compliant field types (address, uint256, string, etc.), making it natural to define domain-specific message schemas. The typical workflow is: define your message class, create instances with your data, and pass them to Account.sign_message() to get a signature. It's most useful in DeFi protocols, governance systems, or any Ethereum application that needs to sign structured data off-chain and verify it on-chain.

Use it for:

  • Define and sign EIP-712 messages for DeFi permit() functions, governance votes, or off-chain orders that will be verified on-chain.
  • Build typed message schemas for multi-signature wallets or threshold signing schemes where structured data must be cryptographically committed.
  • Create domain-specific signing protocols in Ape scripts or Python automation that interact with Ethereum smart contracts.
  • Validate and sign complex nested message structures with arrays and custom types without manually encoding bytes.
  • Integrate EIP-712 signing into Python-based wallet or key management tools that need to sign Ethereum messages.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python message classes for EIP-712 typed structured data hashing and signing in Ethereum, enabling you to define domain-specific message types and sign them with eth-account.

Yes, if you need to sign EIP-712 messages in Python. The library is production-stable, has low install friction, and integrates cleanly with eth-account. Maintenance is aging (last release 234 days ago), but the repo is active and there are no known vulnerabilities. It's a focused, well-scoped tool for a specific cryptographic task in the Ethereum ecosystem.

Install

eip712 on PyPI

pip

pip install eip712

uv

uv add eip712

poetry

poetry add eip712

Installing eip712

Before you install

Low install friction; pure Python wheel with four runtime dependencies (pydantic, eth-account, eth-pydantic-types, eth-utils). Maintenance is aging—last release 234 days ago—but the repo is active and not archived.

License in practice

Apache-2.0 permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.

Quickstart

pip install eip712

from eip712.messages import EIP712Message
from eth_pydantic_types import abi
from eth_account import Account

class Mail(EIP712Message):
    eip712_domain = EIP712Domain(name="Ether Mail", version="1", chainId=1)
    sender: abi.address

mail = Mail(sender="0xaAaAaAaaAaAaAaaAaAAAAAAAAaaaAaAaAaaAaaAa")
acct = Account.from_key(private_key)
sig = acct.sign_message(mail.signable_message)

Requires Python 3.10 or later (up to 3.14); eth-account and eth-pydantic-types must be installed.

Verify before relying

  • Whether the library handles all EIP-712 domain configurations (chainId, verifyingContract, salt) beyond the examples shown.
  • Performance characteristics when signing large nested message structures or arrays.
  • Compatibility with hardware wallets or other signing backends beyond eth-account.

Package facts

License Apache-2.0 (permissive)
Python support supports the current Python release (<4,>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 4 — pydantic, eth-account, eth-pydantic-types, eth-utils
Maintenance aging — 234 days since the last release
Last repo commit
First released
Downloads 113,885/month — #12,323 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: eip712-0.3.3-py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersNatural Language :: EnglishOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

EIP-712 message signingEthereum structured data hashingtyped message signingeth-account integrationPydantic Ethereum messagesdomain-specific message typescryptographic message signing
ethereumcryptographyeip-712

More Cryptography packages