ERC-1271: a contract wallet validates signatures by its rules

Explainer7 min read

ERC-1271 lets contract wallets validate signatures under their current rules. Learn the magic value, state changes and why a valid signature is not an allowance.

Fictional ERC-1271 comic: Brokzi compares a contract-wallet signature result under two different policies while a separate token-allowance record stays unchanged. No real wallet check or transaction is shown.
AI-assisted editorial illustration · Brokzi
On this page

A wallet signature can be valid for its owner and still fail an application's check. One possible reason is that the application is checking the owner's key when it needs to check the contract account's rules.

ERC-1271 gives a contract account a standard way to answer whether it accepts a signature for a particular data hash. The caller asks the account's code; acceptance is signalled by the bytes4 value 0x1626ba7e. That result concerns one validation request under the rules at that state. It does not create a token allowance, execute the signed action or certify the application.

This explainer is for readers using, or trying to understand, a deployed contract wallet on an EVM network. It uses the ERC-1271 specification and a pinned library implementation, not a test of a wallet or a signing tutorial.

Recovering a key and asking an account are different checks

For an ordinary, undelegated externally owned account (EOA), an ECDSA signature check can recover an address from the signature and data hash, then compare that address with the expected signer. A contract wallet has an account address whose authorization rules live in code. Its owners can supply signatures that the account evaluates, but recovering one owner's address does not turn that address into the wallet's contract address.

Consider a fictional wallet W controlled by owners A and B. An application expecting W cannot establish W's approval simply by recovering A and checking that the result equals W. They are different addresses. The account must evaluate the supplied signature material under its actual policy.

Checking routeQuestion being answeredImportant limit
Ordinary EOA recoveryDoes the signature recover the expected key-controlled address for this hash?Recovering an owner is not the same as validating a contract account
ERC-1271 contract callDoes this account's code accept the hash and signature material now?The answer can depend on account state, time and implementation

These are verification routes, not two universal product categories. EIP-7702 permits EOAs to delegate to code. An address having code is therefore not proof that every familiar EOA-versus-contract assumption still holds. Brokzi's smart-wallet overview separates these account mechanisms.

What isValidSignature receives

The ERC-1271 interface takes a 32-byte hash and a signature byte array, returning a 4-byte value:

isValidSignature(
    bytes32 hash,
    bytes signature
) -> bytes4

This describes the interface; it is not deployable code or a request to connect a wallet.

The hash identifies the data the caller wants checked. The signature argument carries whatever evidence the account's implementation supports. The standard allows different verification schemes, so it does not require every contract wallet to accept one ordinary 65-byte ECDSA signature.

The validation method must not modify state and must allow external calls. Those two requirements can coexist: a wallet can consult other contract logic while performing a read-only validation. Its implementation remains responsible for deciding whether the evidence satisfies its rules. The method name alone does not tell you the owners, threshold or exceptions.

The magic value has a narrow job

0x1626ba7e is the specified success value. It is not a transaction hash, an allowance amount or a promise that every later use of the signature will succeed.

OpenZeppelin Contracts v5.5.0's SignatureChecker provides a concrete adapter. Its address-based check uses ECDSA recovery when the signer has no code and the ERC-1271 route when it has code. The contract route makes a static call and checks both call success and the returned data against the expected selector.

For that implementation, an error or an unsuitable response does not become a successful validation. Its response check expects at least 32 bytes of ABI return data, with the expected padded value. That is compatible with returning a bytes4 through the ABI: the declared value and its encoded return-data size are different things. Finding the four magic bytes somewhere in arbitrary output is not the check.

The pinned IERC1271 interface confirms the return type. This is a description of that library version, not evidence that an unnamed application uses it or that a deployed wallet follows its intended policy.

The same signature can receive a different answer later

OpenZeppelin explicitly notes that contract-signature validity can change between states. The cryptographic bytes need not change for the account's acceptance rule to change.

Here is a fictional policy example. Wallet W has active owners A and B. Its custom validator counts their distinct, valid signatures against its current threshold, with no special pre-approved-message exception. Keep the same message hash and the same packet containing only A's signature throughout. Assume all other checks pass.

ObservationCurrent custom policyResult for the unchanged packet
State A1 of the 2 owners is sufficientAccepted: the validator returns the ERC-1271 magic value
State B, after an authorized policy changeBoth owners are requiredNot accepted: A alone does not meet the threshold

The policy-changing action is separate from these validation reads. Calling the read-only validator does not change the threshold. This is a logical example, not an executed contract, an actual account state or a universal rule that every wallet implements thresholds this way.

The practical consequence is about evidence: keep the account, network, hash, signature material and observed state together. A saved successful result from an earlier state does not prove current acceptance. An unsuccessful response also does not explain its cause by itself; an application needs to distinguish a rejected signature from a failed or unsupported verification route.

Typed data and replay protection need their own rules

EIP-712 defines typed-data hashing and domain separation. Its domain can include a chain ID and verifying contract, among other fields; the applicable domain depends on the protocol. ERC-1271 accepts a hash and signature evidence. These standards address different parts of a signed-message workflow.

Neither the ERC-1271 success value nor a tidy typed-data display supplies a universal one-use nonce, expiry or cancellation rule. EIP-712 explicitly leaves replay handling to applications. The accepting protocol needs to define which actions the message authorizes and how repeated use is handled.

For a particular request, identify the actual domain, permitted action and any enforced nonce or time conditions. Do not infer those protections from a wallet badge. Our EIP-2612 permit explainer shows one separate protocol's nonce and allowance rules; it does not establish ERC-1271 support in every token's permit implementation.

A signature result does not rewrite a token allowance

An ERC-20 allowance is a token-contract record for an owner and spender. ERC-1271 validation answers whether the account accepts signature evidence. One result does not substitute for the other record.

Extend the fictional example: suppose W's allowance for spender S on token T is 30 displayed token units. The only state change is the wallet policy change described above; no token approval or spending occurs. That allowance remains 30 before and after the signature packet stops passing. A rejected packet does not, by itself, revoke S's existing allowance.

Conversely, a zero allowance for one owner-spender pair is not proof that every signed message is invalid. A protocol may combine signature validation with a later spending action, so the requested effect and execution rules still matter. Use the allowance-verification guide for that separate record.

Keep a useful verification record

For a deployed contract-wallet signature, an application's explanation should make it possible to identify:

  • The exact network and account whose policy is being checked.
  • The signed data, its hash and the protocol's domain, rather than only a friendly login label.
  • The supported verification route and how it interprets the response.
  • The state or observation time, because policy-dependent acceptance can change.
  • The action the message authorizes and any separate spending permissions or replay controls.

An account not yet deployed can require another verification arrangement; this article does not establish that an application supports it. Nor does a valid contract signature prove transaction inclusion, a completed trade, trustworthy code or recovery of an earlier transfer.

Read ERC-1271 as the account's answer to a specified signature question. Keep that answer separate from what the application can do with it and from permissions already stored elsewhere.

Sources

Primary specifications and pinned source checked November 1, 2026. OpenZeppelin v5.5.0 is the selected reference version, not a claim about every deployed wallet or the latest library. The owner/threshold and 30-token examples are invented, and the artwork is a fictional mechanism illustration. No wallet connection, signature creation, RPC request, contract execution, policy change, approval, allowance lookup or transaction was performed. This is education, not a security audit or financial recommendation.

See something wrong? Brokzi logs material changes. Prepare a correction note.

About the byline

Brokzi Editorial

The accountable byline for Brokzi’s explainers, definitions, news notes, and corrections.

Editorial responsibility →