---
eip: 6066
label: ERC-6066
title: Signature Validation Method for NFTs
status: Final
type: Standards Track
category: ERC
created: 2022-11-29
requires: 165, 721, 1155, 1271, 5750
official: https://eips.ethereum.org/EIPS/eip-6066
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6066.md
canonical: https://eips.huatuo.xyz/eip-6066/
lang: en
tldr: An ERC-1271-style isValidSignature(tokenId, hash, data) check that lets an NFT itself act as a signer, so authority can follow the token instead of a particular wallet.
tags: [nft, signatures, governance, dao, interface]
---

# ERC-6066: Signature Validation Method for NFTs

> A way to verify signatures when the signing entity is an ERC-721 or ERC-1155 NFT

**TL;DR:** An ERC-1271-style isValidSignature(tokenId, hash, data) check that lets an NFT itself act as a signer, so authority can follow the token instead of a particular wallet.

## What problem does it solve?

Wallets prove consent with `ecrecover`, and smart contract accounts do it with [ERC-1271](/eip-1271/) `isValidSignature(hash, signature)`. But there was no standard way for an **NFT** to sign.

That matters when an NFT represents a role. Imagine a DAO whose officer positions (CFO, COO…) are NFTs that change hands after each election. If the sitting CFO signs an agreement with their personal key, the signature stays with that person after they leave office. With ERC-6066, the signature belongs to the CFO token, so the office keeps its commitments when its holder changes. The spec also mentions wrapped ENS subdomains, which are NFTs, as natural signers for organisational hierarchies.

## How it works

An [ERC-721](/eip-721/) or [ERC-1155](/eip-1155/) contract may implement one function:

```solidity
function isValidSignature(uint256 tokenId, bytes32 hash, bytes calldata data)
    external view returns (bytes4 magicValue);
```

- It returns the magic value `0x12edb34f` if token `tokenId` has validly "signed" `hash`.
- It must not modify state, and it may call other contracts to decide.
- `data` is optional extra context, following the [ERC-5750](/eip-5750/) pattern of a trailing `bytes` parameter for future extensibility.
- Callers that support contract signatures must use this method when the signer is an NFT holder.

How a token comes to sign is deliberately left open, just as ERC-1271 does not mandate a signing scheme. The reference implementation follows the Gnosis Safe approach: the current owner calls `sign(tokenId, hash)`, which stores an on-chain approval flag. The "signature" is therefore a recorded act of consent, not a cryptographic signature.

The magic value equals the [ERC-165](/eip-165/) interface ID of `IERC6066`, so the same constant is used for interface detection.

## Sample code

Minimal signing NFT based on OpenZeppelin ERC-721:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC6066 {
    function isValidSignature(uint256 tokenId, bytes32 hash, bytes calldata data)
        external view returns (bytes4);
}

contract OfficeBadge is ERC721, IERC6066 {
    bytes4 constant MAGIC = 0x12edb34f;
    mapping(uint256 => mapping(bytes32 => bool)) private signed;

    constructor() ERC721("Office", "OFC") {}

    function sign(uint256 tokenId, bytes32 hash) external {
        require(ownerOf(tokenId) == msg.sender, "not holder");
        signed[tokenId][hash] = true;
    }

    function isValidSignature(uint256 tokenId, bytes32 hash, bytes calldata)
        external view returns (bytes4)
    {
        return signed[tokenId][hash] ? MAGIC : bytes4(0xffffffff);
    }

    function supportsInterface(bytes4 id) public view override returns (bool) {
        return id == type(IERC6066).interfaceId || super.supportsInterface(id);
    }
}
```

Verifying from a dapp (ethers v6):

```ts
const ok = (await badge.isValidSignature(tokenId, digest, "0x")) === "0x12edb34f";
```

## Things to know

- Status is **Final**.
- Contract-based signatures are revocable or changeable by design; a check that passed yesterday may fail today. Re-verify at the moment you rely on it.
- Signing authority follows the token. Selling or transferring the NFT transfers the power to sign future messages, so treat such tokens like keys.
- Because there is no cryptographic signature, verifiers must trust the NFT contract's logic; review it as carefully as a wallet contract.


---

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