February 5, 2026

Introducing: EIP-712 Structs in Python – Treum

Introducing: EIP-712 Structs in Python – Treum

Introducing: EIP-712 Structs in Python – Treum

What is EIP-712?

  • Support for this standard in Ethereum clients (such as MetaMask) would give some insight to users into what sort of messages they are signing — instead of a long random hexstring, they would see a human-readable data structure.

Why use this library?

Having come from a heavy Java background, it made the most sense to treat specialized data structures like this as classes and objects. The goal of this python library is to give “side-by-side” parity to data structure creation in both Python and Solidity, as well as handling the common operations needed for this library.

Although you could easily create a domain separator like any other struct, a convenience method is provided to help you skip the tedium.

With the domain separator ready, we can convert the struct into the message format.

Note: The standard JSON Encoder doesn’t support bytes types. Use .to_message_json() to ensure bytes are correctly encoded into hexstrings during JSON encoding.

Included in the spec is also a deterministic method for converting a struct/domain pair into a reliable bytestring. This bytestring is suitable for tasks such as signing the message payload.

Published at Thu, 01 Aug 2019 15:57:25 +0000

Bitcoin Pic Of The Moment
✅ This image from Marco Verch (trendingtopics) is available under Creative Commons 2.0. Please link to the original photo and the license. ? License for use outside of the Creative Commons is available by request.
By trendingtopics on 2019-05-21 08:40:10
tags

Previous Article

Introducing: EIP-712 Structs in Python – Treum

Next Article

BitPay Says It Has ‘Paused’ Processing Bitcoin Payments in Germany

You might be interested in …