EIPs Explained

ERC-4973 · Review · ERC · 2022-04-01

ERC-4973: Account-bound Tokens

Account-bound tokens: NFTs that bind to one account, cannot be transferred, are created only with the recipient's EIP-712 signature, and can always be dropped by their holder.

What problem does it solve?

Some tokens should not be tradable: proof that you attended an event, completed a course or belong to a community. The spec borrows a game analogy: in World of Warcraft, certain legendary items bind to a character on pickup and can never be sold or traded, so owning one proves the holder earned it.

Ad hoc versions of this exist (e.g. ERC-721 contracts whose transfers revert), but wallets cannot tell them apart from normal NFTs. ERC-4973 defines a minimal, consent-based interface for account-bound tokens (ABTs) that stays as compatible with existing NFT tooling as possible.

How it works

An ABT contract must implement ERC-165 and ERC721Metadata (name, symbol, tokenURI), and must not report support for the ERC-721 transfer interface (0x80ac58cd). Wallets that check ERC-165 can therefore show the token but hide "send".

The IERC4973 interface (ERC-165 ID 0xeb72bb7c):

Function Purpose
give(to, metadata, signature) Issuer creates an ABT for to; signature is to's consent
take(from, metadata, signature) Recipient claims an ABT using from's signed consent
unequip(tokenId) Holder removes the ABT from their account at any time
balanceOf, ownerOf Same meaning as ERC-721
decodeURI(metadata) Turns the metadata bytes into the token URI

Consent is an EIP-712 signature over Agreement(address active, address passive, bytes metadata). The tokenId is that typed-data hash cast to uint256, so the same agreement cannot be minted twice. Contract accounts sign via ERC-1271.

unequip emits Transfer(owner, address(0), tokenId). After unequipping, the same agreement can be used again to re-equip.

Sample code

Producing the consent signature for give (ethers v6):

import { Wallet, hexlify, toUtf8Bytes } from "ethers";

const recipient = new Wallet(process.env.RECIPIENT_KEY!);
const issuer = "0xIssuerAddress";            // msg.sender of give()
const metadata = hexlify(toUtf8Bytes("ipfs://bafy..."));

const domain = {
  name: "MyBadge",              // must match the contract's EIP-712 domain
  version: "1",
  chainId: 1,
  verifyingContract: "0xBadgeContract",
};
const types = {
  Agreement: [
    { name: "active", type: "address" },
    { name: "passive", type: "address" },
    { name: "metadata", type: "bytes" },
  ],
};

// For give(): active = issuer, passive = recipient
const signature = await recipient.signTypedData(
  domain, types, { active: issuer, passive: recipient.address, metadata },
);
// Issuer then calls: badge.give(recipient.address, metadata, signature)

Things to know

  • Status is Review: the interface may still change. The simpler, Final ERC-5192 is a common alternative for soulbound NFTs.
  • The spec defines no recovery if keys are lost or rotated; issuers should provide re-issuance or revocation processes. Binding the ABT to a multisig contract is one suggested mitigation.
  • Indexers should check that a Transfer event's from matches the transaction sender to avoid spoofed events.
  • The domain fields above are placeholders; use the values the target contract actually hashes.

#soulbound #nft #badge #identity

Details

Authors
Tim Daubenschütz (@TimDaub)
Status
Review
Type
Standards Track / ERC
Created
2022-04-01
Requires

Machine-readable: Markdown · JSON