ERC-7913 · Final · ERC · 2025-03-21
ERC-7913: Signature Verifiers
A one-function interface that lets smart accounts verify signatures from keys that have no Ethereum address of their own, such as passkeys (P-256), RSA keys or ZK email proofs, by identifying a signer as a (verifier, key) pair.
What problem does it solve?
On Ethereum a signer is normally an address: an EOA checked with ecrecover, or a contract checked with ERC-1271 isValidSignature. But smart accounts increasingly want to be controlled by keys that are not secp256k1 and have no address: secp256r1 passkeys on phones, RSA keys issued by institutions, or ZK proofs over an email or JWT.
You could deploy one ERC-1271 contract per key, but that costs gas for every new key, and it gives each key an address that people might mistakenly send funds to. ERC-7913 instead proposes a few shared verifier contracts, one per key type. Any key can then be described as (verifier, key) with zero setup cost.
How it works
A verifier implements a single view function:
function verify(bytes calldata key, bytes32 hash, bytes calldata signature)
external view returns (bytes4);
It returns the magic value 0x024ad318 (the function's own selector) if signature is valid for hash under key, and otherwise should return 0xffffffff or revert. Keys are arbitrary non-empty bytes, e.g. an encoded P-256 or RSA public key. Verifiers should be stateless.
To support old and new signers in one place, a system represents every signer as bytes signer = verifier || key:
- shorter than 20 bytes: invalid;
- exactly 20 bytes (empty key): the address is the signer, so use ERC-1271 if it has code,
ecrecoverotherwise; - longer: call
verify(key, hash, signature)on the verifier and check for the magic value.
The message is always a bytes32 hash (typically from ERC-191 or EIP-712); schemes with their own hashing should treat that hash as the message.
Sample code
Checking any signer, adapted from the spec's reference implementation:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import {SignatureChecker} from "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol";
interface IERC7913SignatureVerifier {
function verify(bytes calldata key, bytes32 hash, bytes calldata signature)
external view returns (bytes4);
}
library SignerCheck {
function isValid(bytes calldata signer, bytes32 hash, bytes calldata sig)
internal view returns (bool)
{
if (signer.length < 20) return false;
if (signer.length == 20) {
// EOA (ecrecover) or ERC-1271 contract
return SignatureChecker.isValidSignatureNow(address(bytes20(signer)), hash, sig);
}
address verifier = address(bytes20(signer[0:20]));
try IERC7913SignatureVerifier(verifier).verify(signer[20:], hash, sig) returns (bytes4 m) {
return m == IERC7913SignatureVerifier.verify.selector; // 0x024ad318
} catch {
return false;
}
}
}
Things to know
- Status: Final.
- Verifiers should not be upgradeable and should not read mutable state; parameters belong either in the key or in immutable code. A guardian key set up today may need to work years from now, and statelessness also keeps verifiers within ERC-7562 validation rules for 4337 bundlers.
- Empty keys are deliberately out of scope for verifiers; 20-byte signers go through ERC-1271 /
ecrecover. - A P-256 verifier can be built cheaply on top of the EIP-7951 secp256r1 precompile where the chain supports it.
- OpenZeppelin Contracts ships utilities for this pattern; check the version you use rather than writing your own dispatcher.