Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article explores ERC-7739, a proposal that prevents a signature from being misused across multiple smart accounts managed by the same EOA, by rehashing signed data in a way that preserves human readability and enables secure verification.

This article translates, summarizes, and supplements the proposal linked below, as covered in the original Japanese article published on August 5, 2025.

I have also covered various other EIPs:

Overview

ERC-7739 defines a standard to prevent signature replay attacks when a single externally owned account (EOA) manages multiple smart accounts. A replay attack exploits a vulnerability in which a signature can be reused unchanged in another context. For example, if the same EOA controls multiple smart accounts, a signature used with one account could also be recognized as valid by another.

To address this problem, ERC-7739 introduces defensive rehashing for signature verification under ERC-1271. Specifically, it uses nested typed structures in the EIP-712 format to rehash the signed data, improving security while keeping the contents readable in wallet clients. Users can therefore inspect what they are signing, and the mechanism can be adopted without major changes to applications or wallets.

For more on ERC-1271, see the following article.

[ERC-1271] Verifying Signatures in Smart Contracts

For more on EIP-712, see the following article.

[EIP-712] Hashing and Signing Typed Structured Data

Motivation

Smart accounts can verify the validity of signatures using the ERC-1271 isValidSignature function. However, a naive implementation may allow a signature to be reused unchanged with another smart account. In the conventional example discussed in the proposal, the EOA's signature is verified solely against the hash, meaning that the same signature may be accepted by different smart accounts.

The reason is that the hash used for signature verification does not identify which smart account the signature belongs to. This omission creates a replay risk even in widely used applications such as Permit2.

To prevent this, many smart account implementations introduce their own form of defensive rehashing.

  • The original hash
  • The smart account's own address
  • The chain ID

These values are combined to produce a new final hash, against which the signature is verified.

However, a straightforward implementation of this approach can make data signed through EIP-712 appear opaque on the wallet screen, preventing the user from inspecting the contents of the signature request.

ERC-7739 addresses this problem by providing a way to perform defensive rehashing while keeping the signed contents visible. It uses EIP-712 to display the signature contents in human-readable form in wallet clients, improving security without sacrificing the user experience. The mechanism is also designed to minimize adoption barriers: even if a frontend or wallet client does not support it, users can enable it by injecting their own client-side script.

Specification

The specification defines signature verification behavior under ERC-1271. In particular, it clarifies the rules for defensive rehashing so that smart accounts can handle signatures securely. The mechanism consists of two workflows. The first is the EIP-712 TypedDataSign workflow, and the second is the EIP-191 PersonalSign workflow.

For more on EIP-191, see the following article.

[ERC-191] Using Signed Data Securely

The standard also depends on the following specifications.

  • EIP-712
    • Defines how typed data is hashed and signed.
    • Required to construct the final hash.
  • ERC-1271
    • Standardizes signature verification by contracts.
    • Provides the isValidSignature function.
  • ERC-5267
    • Defines how to retrieve EIP-712 domain information.
    • Provides the eip712Domain() function.

For more on ERC-5267, see the following article.

[ERC-5267] Exposing Information Needed to Construct EIP-712 Domains

TypedDataSign workflow

This workflow is used when the original hash was computed using EIP-712.

Computing the final hash

TypedDataSign combines the application-specific domain separator (APP_DOMAIN_SEPARATOR) and EIP-712 domain information (name, version, chain ID, contract address, and salt) to generate a new hash that includes the original data structure. This incorporates smart account-specific information into the signature and prevents replay attacks.

The hash is expressed as follows.

text
keccak256(
    0x1901 || APP_DOMAIN_SEPARATOR || hashStruct(TypedDataSign({...}))
)

Here, contentsName is a string extracted from the name of the data type. For security, the signature should be rejected if this value has an invalid format, such as an empty string or a name containing invalid symbols.

Signature format

The signature passed to isValidSignature consists of the original signature concatenated with the following data.

text
originalSignature || APP_DOMAIN_SEPARATOR || contents || contentsDescription || length(contentsDescription)

Here, contents is the hash of the original data, while contentsDescription describes its data type. This allows isValidSignature to reconstruct the correct hash and execute the TypedDataSign workflow securely.

PersonalSign workflow

PersonalSign is used when the hash was calculated according to EIP-191. This corresponds to message signing in the Ethereum Signed Message:\n... format.

Computing the final hash

PersonalSign uses ACCOUNT_DOMAIN_SEPARATOR, constructs a structure named PersonalSign(bytes prefixed) in the EIP-712 format, and computes its hash.

text
keccak256(
    0x1901 || ACCOUNT_DOMAIN_SEPARATOR || hashStruct(PersonalSign({...}))
)

Here, prefixed is the message hash constructed using the Ethereum Signed Message format. This workflow does not require additional information to be appended to the signature.

Detecting support

A smart account indicates that it supports the standard by returning a specific magic number.

text
isValidSignature(0x77397739...., "")
→ bytes4(0x77390001)

This value indicates the standard's version and may change if the standard is updated in the future.

Selecting the workflow

isValidSignature automatically determines which workflow to use based on the supplied data without changing the signature interface. If the signature includes APP_DOMAIN_SEPARATOR or the original data hash, it executes the TypedDataSign workflow; otherwise, it executes the PersonalSign workflow.

Conditions for skipping defensive rehashing

In some cases, a smart account may skip rehashing. Examples include calls to isValidSignature made off-chain and cases where the hash already contains the smart account's address.

This flexibility takes into account the possibility that many applications may not support the newer EIP-712 format. Conventional signature verification remains available where rehashing can safely be omitted.

Additional considerations

TypedDataSign structure

The TypedDataSign type hash (typedDataSignTypehash) must be generated by the contract each time. This ensures that the data the user is being asked to sign remains visible at the time of the signature request. By requiring the signed contents to be a user-defined type, the mechanism can display the contents without concealing them.

The fields contained in eip712Domain are also expanded directly into the TypedDataSign structure. This avoids collisions that could otherwise occur when the contracts used for signature verification have different domain types.

Furthermore, the bitmap (bytes1) and extensions (uint256[]) fields defined in ERC-5267 are omitted. Distinguishing between a field that is absent and one that holds a zero value does not improve signature security. The extensions field is used for off-chain signaling to indicate EIP numbers.

contentsDescription modes

EIP-712 handles the ordering of types lexicographically. As a result, with nested types, contentsName may not always appear at the start of the type definition. To address this issue, the standard introduces an explicit mode that allows the type name to be specified directly. This ensures that the signed contents are displayed correctly.

Detecting support through isValidSignature

To make implementation easier for modular smart accounts, the standard detects support using the existing isValidSignature function rather than adding a new function. The function signals support by returning a specific magic number.

Constraints on contentsName

contentsName must not start with a lowercase 7-bit ASCII character. This restriction preserves language independence and extensibility over time. For example, primitive types such as uint256 may have different names in other programming languages (such as u256), so the standard avoids locking in naming conventions too rigidly.

Compatibility

Compatibility with earlier drafts

Earlier drafts defined a function named supportsNestedTypedDataSign() to detect support. The function indicated support by returning the fixed value 0xd620c85a. The version of the specification described here removes that mechanism and instead uses a magic number returned by isValidSignature. This design eliminates the need to extend the existing interface and makes adoption easier for modular accounts.

Reference implementation

ERC-7739 provides an optimized reference implementation intended for direct use in production. It includes additional features needed to ensure security, flexibility, developer experience, and user experience. Rather than being a minimal proof-of-concept example, it is designed for practical use.

This approach aims to avoid misunderstandings that arose with ERC-1271. In that case, some developers assumed that the minimal reference implementation was itself a secure implementation and adopted it without sufficient safeguards. ERC-7739 deliberately provides a practical reference implementation to avoid repeating that mistake.

Security

Rejecting invalid contentsName values

Widely used implementations of eth_signTypedData do not correctly validate the names of custom types (contentsName). A phishing site could exploit this issue by inserting control characters into contentsName and manipulating the name to break out of the PersonalSign type definition. As a result, the wallet client could ask users to sign an unreadable hash.

To prevent this attack, it is strongly recommended that the contract validate contentsName and reject invalid names.

Limitation on chaining multiple signers

An account using this mechanism to prevent signature replay under ERC-1271 cannot be combined with another signer using the same mechanism. The reason is that the TypedDataSign structure contains the message being signed. If that message were itself another TypedDataSign structure, the final EIP-712 message would contain two nested TypedDataSign types. The EIP-712 specification cannot express this in a single request, making the combination technically infeasible.

This restriction prevents multi-level signature chains, but provides a robust mechanism for resisting replay attacks.

Citation

vectorized (@vectorized), Sihoon Lee (@push0ebp), Francisco Giordano (@frangio), Hadrien Croubois (@Amxx), Ernesto García (@ernestognw), Im Juno (@junomonster), howydev (@howydev), Atarpara (@Atarpara), 0xcuriousapple (@0xcuriousapple), "ERC-7739: Readable Typed Signatures for Smart Accounts [DRAFT]," Ethereum Improvement Proposals, no. 7739, May 2024. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7739.

Conclusion

This article covered ERC-7739, a proposal that prevents signatures from being misused across multiple smart accounts managed by one EOA, using human-readable rehashing for secure verification. I hope it has been helpful.

If you have questions, feel free to reach out via Twitter DM:

Twitter @cardene777

I also publish content on other platforms:

https://chaldene.net/