Comparing EIP-191 and EIP-712
1. EIP-191: Simple Message Signing
EIP-191 defines a generic way to sign messages in Ethereum. It involves signing a raw message hash prefixed with Ethereum Signed Message:, ensuring that the signature cannot be directly used as a transaction. However, this method lacks structure, making it difficult for users to verify what they are signing. This can lead to security risks such as blind approvals and phishing attacks.
2. EIP-712: Structured Data Signing
EIP-712 improves upon EIP-191 by introducing a structured format for signing messages using Typed Data. Instead of a simple hash, messages are encoded with a defined schema, enabling wallets to present a clear and human-readable signing request to users. This reduces confusion and enhances security by making signed data more understandable.
3. Security and UX Enhancements
While EIP-191 is still widely used for basic signing, EIP-712 provides significant security and usability benefits:
- Human-Readable Data: Users can see exactly what they are signing instead of a raw hash.
- Domain Separation: Each signature is tied to a specific domain, preventing replay attacks across different applications.
- Improved Wallet Support: Wallets like MetaMask can parse and display structured data, ensuring transparency in transactions.