Message classes for typed structured data hashing and signing in Ethereum, based on EIP-712. Current version 0.3.3, requires Python >=3.10, <4. Maintained actively by ApeWorX.
Install & Compatibility
Where this runs
tested against v0.3.3 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.292s · 58.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 6.5s · import 1.230s · 62MB
60MB installed
● package 60MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Correct import for the main message class.
from eip712 import EIP712Message
EIP712Type is exported from top-level eip712 since v0.3.0.
from eip712 import EIP712Type
EIP712Domain is now directly available from eip712.
from eip712 import EIP712Domain
Define EIP-712 message structures using pydantic-based classes and generate the structured data for signing.
from eip712 import EIP712Message, EIP712Domain
class Person(EIP712Message):
name: str
wallet: str
class Mail(EIP712Message):
from_: Person = Person(name='Alice', wallet='0x...') # field alias
to: Person
contents: str
message = Mail(
from_=Person(name='Alice', wallet='0x...'),
to=Person(name='Bob', wallet='0x...'),
contents='Hello!'
)
print(message.to_message())
print(message.encode_712())
print(message.signable_message())
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.