---
eip: 6492
label: ERC-6492
title: Signature Validation for Predeploy Contracts
status: Final
type: Standards Track
category: ERC
created: 2023-02-10
requires: 1271
official: https://eips.ethereum.org/EIPS/eip-6492
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6492.md
canonical: https://eips.huatuo.xyz/eip-6492/
lang: en
tldr: "A signature wrapper that carries the deploy data of a not-yet-deployed smart wallet, so apps can verify ERC-1271 signatures from counterfactual accounts, for example at login, before the wallet's first transaction."
tags: [signatures, smart-wallet, account-abstraction, erc-1271, counterfactual]
---

# ERC-6492: Signature Validation for Predeploy Contracts

> A way to verify a signature when the account is a smart contract that has not been deployed yet

**TL;DR:** A signature wrapper that carries the deploy data of a not-yet-deployed smart wallet, so apps can verify ERC-1271 signatures from counterfactual accounts, for example at login, before the wallet's first transaction.

## What problem does it solve?

Smart-contract wallets verify signatures through [ERC-1271](/eip-1271/): the app calls `isValidSignature(hash, sig)` on the wallet contract. Many wallets (especially [ERC-4337](/eip-4337/) accounts) are **counterfactual**: their address is known in advance via CREATE2, but the contract is only deployed with the first transaction. Until then there is no code to call, so a brand-new user cannot "Sign-In with Ethereum" ([ERC-4361](/eip-4361/)) or sign an off-chain order.

ERC-6492 lets the signature carry the information needed to deploy the wallet, so the verifier can simulate the deployment and then run the normal ERC-1271 check.

## How it works

**Signer side**

- Wallet already deployed and ready: produce a normal ERC-1271 signature.
- Wallet not yet deployed: wrap it as
  `abi.encode(factory, factoryCalldata, innerSig) ++ magicBytes`
- Wallet deployed but needing a setup call before it can verify (e.g. a migration): the same wrapper, with `prepareTo, prepareData` in place of the factory fields.

`magicBytes` is the 32-byte suffix `0x6492…6492` (the pair `6492` repeated). It ends in `0x92`, which is never a valid `v` for a 65-byte ECDSA signature, so it cannot be confused with an EOA signature.

**Verifier side, in this order**

1. If the signature ends in `magicBytes`: unwrap it, call the factory to deploy (if there is no code yet), then call `isValidSignature` with the inner signature. Off-chain this is done inside a single `eth_call`, so nothing is really deployed.
2. Else, if the address has code: plain ERC-1271.
3. If ERC-1271 fails on an already-deployed wallet with a wrapped signature: run the prefix call as a "prepare" call and retry.
4. Else (no code): `ecrecover`.

The order matters: `ecrecover` must not run before ERC-1271, since a contract wallet's signature might also be a valid ECDSA signature for a different address.

The spec includes a reference `UniversalSigValidator` plus a `ValidateSigOffchain` helper whose constructor returns the result, so you can verify with one `eth_call` without any deployed contract.

## Sample code

Wrapping a signature for an undeployed wallet (ethers v6):

```ts
import { AbiCoder, concat } from "ethers";

const MAGIC = "0x" + "6492".repeat(16);

function wrap6492(factory: string, factoryCalldata: string, innerSig: string) {
  const encoded = AbiCoder.defaultAbiCoder().encode(
    ["address", "bytes", "bytes"],
    [factory, factoryCalldata, innerSig],
  );
  return concat([encoded, MAGIC]);
}
```

Verifying off-chain with the spec's helper bytecode, no deployment needed:

```ts
const data = concat([
  validateSigOffchainBytecode, // compiled ValidateSigOffchain from the spec
  AbiCoder.defaultAbiCoder().encode(["address", "bytes32", "bytes"], [signer, hash, signature]),
]);
const isValid = (await provider.call({ data })) === "0x01";
```

## Things to know

- **Status: Final.** Many wallet and app libraries already implement universal 6492 / 1271 / ecrecover verification.
- On-chain verification needs a `CALL` (to deploy), not a `STATICCALL`, which brings reentrancy risk. The reference `isValidSig` reverts away all side effects and reads the result from the revert data; `isValidSigWithSideEffects` is cheaper but not reentrancy-safe.
- If the wallet is already deployed, the live contract is checked, so key rotation is respected.
- Replay risk: a wrapped signature could still verify on another chain where the same factory and bytecode can deploy the wallet, even if keys were changed elsewhere. Include chain id in what you sign (for example with [EIP-712](/eip-712/)).
- Whether the deployed wallet has the right owner is up to the factory; changing the calldata changes the CREATE2 address, so it cannot be used to impersonate.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-6492
