https://github.com/pxlvre/eip712
🗝️ EIP-712 is a standard for structuring typed data for Ethereum smart contracts. It is a standard for how to encode typed data according to EIP-191 so that the encoded data may be used to produce a cryptographic hash and a signature.
https://github.com/pxlvre/eip712
cryptography eip eip712 ethereum rust web3
Last synced: 11 days ago
JSON representation
🗝️ EIP-712 is a standard for structuring typed data for Ethereum smart contracts. It is a standard for how to encode typed data according to EIP-191 so that the encoded data may be used to produce a cryptographic hash and a signature.
- Host: GitHub
- URL: https://github.com/pxlvre/eip712
- Owner: pxlvre
- Created: 2022-10-17T01:09:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-15T01:18:18.000Z (about 2 years ago)
- Last Synced: 2026-01-19T03:44:21.301Z (5 months ago)
- Topics: cryptography, eip, eip712, ethereum, rust, web3
- Language: Rust
- Homepage: https://eips.ethereum.org/EIPS/eip-712
- Size: 13.7 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
🗝️ [EIP-712](https://eips.ethereum.org/EIPS/eip-712): Typed Structured Data Hashing and Signing
EIP-712 is a standard for structuring typed data for Ethereum smart contracts. It is a standard for how to encode typed data according to EIP-191 so that the encoded data may be used to produce a cryptographic hash and a signature.
## Motivation
There are many use cases where it is useful to allow a smart contract to verify that a message was signed by a known account. This is useful for cases such as signed approvals, price oracles, and authenticated off-chain protocols.
The Ethereum ABI specification does not provide encoding for structs, making it difficult to encode arbitrary data for signing. This EIP provides a basic specification for encoding typed data.
## Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt).
### Definitions
- `domain` is a set of information about the context in which the message is being signed. It is encoded as a struct with the following members:
- `name` is a string that describes the domain to which the message is being sent. This string SHOULD be the human-readable name of the domain.
- `version` is a string that represents the version of the domain's message signing format. This string SHOULD be a unique identifier for the version of the domain's message signing format.
- `chainId` is a 256-bit integer that represents the chain ID of the chain where the message is being sent.
- `verifyingContract` is a 160-bit integer that represents the address of the contract that will be used to verify the message.
- `salt` is a 256-bit integer that represents a random value used to ensure that signatures are unique to this message.
- `message` is a struct that contains the information to be signed. It is encoded as a struct.