EIPs Explained

ERC-5484 · Final · ERC · 2022-08-17

ERC-5484: Consensual Soulbound Tokens

Non-transferable ERC-721 tokens where issuer and receiver agree up front on who may burn each token, a rule fixed forever at issuance.

What problem does it solve?

"Soulbound" tokens (SBTs) are NFTs that cannot be transferred: credentials, memberships, loan or credit records tied to one account. Early implementations each did it differently, usually by making every transfer revert, which gave tools no clean way to tell an SBT from a broken NFT. They also disagreed on the key question for such tokens: who is allowed to destroy one?

ERC-5484 standardizes an SBT as a regular ERC-721 token with two additions: an explicit burn authorization per token, and an Issued event that marks soulbound issuance. Both parties consent to the burn rule before the token exists.

How it works

  • The token implements ERC-165 and ERC-721, plus IERC5484 (interface ID 0x0489b56f).
  • Each token has a BurnAuth, readable via burnAuth(tokenId):
Value Who can burn Example use from the spec
IssuerOnly (0) Issuer Loan record
OwnerOnly (1) Holder Paid membership
Both (2) Either Credentials
Neither (3) Nobody Credit history
  • burnAuth must be shown to the receiver, and the issuer must present the metadata and obtain the receiver's signature, before issuance. After issuance both burnAuth and metadata are immutable.
  • On mint the contract emits the normal ERC-721 Transfer plus Issued(from, to, tokenId, burnAuth), so indexers can recognise SBT issuance without breaking NFT tooling.
  • Transfers still revert, but integrators can check supportsInterface(0x0489b56f) first instead of discovering it by failing.

Sample code

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol";

interface IERC5484 {
    enum BurnAuth { IssuerOnly, OwnerOnly, Both, Neither }
    event Issued(address indexed from, address indexed to, uint256 indexed tokenId, BurnAuth burnAuth);
    function burnAuth(uint256 tokenId) external view returns (BurnAuth);
}

contract Credential is ERC721, IERC5484 {
    address public immutable issuer;
    mapping(uint256 => BurnAuth) private _auth;

    constructor() ERC721("Credential", "CRED") { issuer = msg.sender; }

    // Receiver consent (signature over metadata + burnAuth) is checked offchain or here; omitted.
    function issue(address to, uint256 id, BurnAuth auth) external {
        require(msg.sender == issuer, "issuer only");
        _auth[id] = auth;
        _safeMint(to, id);
        emit Issued(msg.sender, to, id, auth);
    }

    function burnAuth(uint256 id) external view returns (BurnAuth) {
        _requireOwned(id);
        return _auth[id];
    }

    function burn(uint256 id) external {
        BurnAuth a = _auth[id];
        bool ok = (msg.sender == issuer && (a == BurnAuth.IssuerOnly || a == BurnAuth.Both))
               || (msg.sender == ownerOf(id) && (a == BurnAuth.OwnerOnly || a == BurnAuth.Both));
        require(ok, "not authorized");
        _burn(id);
    }

    // Block every transfer except mint and burn.
    function _update(address to, uint256 id, address auth) internal override returns (address from) {
        from = _ownerOf(id);
        require(from == address(0) || to == address(0), "soulbound");
        return super._update(to, id, auth);
    }

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

Things to know

  • Status: Final.
  • The spec requires the receiver's signature before issuance but does not define its format; implementers choose one (an EIP-712 typed message is a natural fit).
  • The rationale text calls the second option ReceiverOnly while the interface names it OwnerOnly; the enum in the interface is what matters.
  • Burning is the route to key rotation: the authorised party burns the old token and the issuer re-issues to the new address.
  • Alternatives: ERC-5192 (minimal locked() signal), ERC-6239 (semantic SBTs) and ERC-4973 (account-bound tokens, in Review).

#soulbound #sbt #nft #erc-721 #credentials

Details

Authors
Buzz Cai (@buzzcai)
Status
Final
Type
Standards Track / ERC
Created
2022-08-17
Requires
Required by

Machine-readable: Markdown · JSON