EIPs Explained

ERC-7231 · Final · ERC · 2023-06-25

ERC-7231: Identity-aggregated NFT

An ERC-721 extension that binds a hashed bundle of a user's Web2 and Web3 identities to an NFT, so apps can verify which accounts belong to the token's owner.

What problem does it solve?

People carry many identities: a wallet address, an ENS name, a DID, accounts on social networks and other Web2 services. Applications that want to know "this wallet also owns that account" have no common, verifiable way to ask. ENS gives names but no proof of off-chain accounts; soulbound tokens usually depend on a central attester.

ERC-7231 lets the owner of an NFT (or soulbound token) attach a list of their identities to it. The list lives in the token's metadata, and only a hash of it (the identities root) is stored on-chain, so anyone can check that the off-chain list has not been tampered with and was signed by the owner.

How it works

  1. Metadata. The token's JSON metadata gains a MultiIdentities array. Each entry has a userID (a Web2 account or a DID), a verifierUri describing how to verify it, an optional memo, and free-form properties.
  2. On-chain root. The owner calls setIdentitiesRoot(id, root), where root is a hash over the user IDs. The contract stores it and emits SetIdentitiesRoot.
  3. Verification. Anyone can call verifyIdentitiesBinding(id, owner, userIDs, root, signature). Per the spec it checks:
    • that owner actually owns NFT id,
    • that the user IDs are well formed,
    • that root matches what is stored for the token,
    • that signature over the root comes from the owner, using ERC-1271 so smart-contract wallets can sign too.

The function returns true or false and must not change state. How each individual identity is proven (OAuth, OpenID, zk-based DID proofs, etc.) is left to the verifier named in verifierUri.

Sample code

The interface defined by the standard:

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

interface IERC7231 {
    event SetIdentitiesRoot(uint256 id, bytes32 identitiesRoot);

    function setIdentitiesRoot(uint256 id, bytes32 identitiesRoot) external;

    function getIdentitiesRoot(uint256 id) external returns (bytes32);

    function verifyIdentitiesBinding(
        uint256 id,
        address nftOwnerAddress,
        string[] memory userIDs,
        bytes32 identitiesRoot,
        bytes calldata signature
    ) external returns (bool);
}

A metadata fragment carrying two identities (values are illustrative):

{
  "name": "Profile #42",
  "image": "ipfs://.../42.png",
  "MultiIdentities": [
    { "userID": "did:example:alice", "verifierUri": "https://verifier.example/did", "memo": "main DID" },
    { "userID": "github:alice", "verifierUri": "https://verifier.example/github" }
  ]
}

Things to know

  • Status is Final. It requires ERC-165, ERC-721 and ERC-1271.
  • Only the hash is on-chain. The privacy of the identity list depends on where the metadata is hosted; anyone who can read the metadata can read the user IDs.
  • The on-chain check proves the owner signed this list, not that each Web2 account really belongs to them. That second step depends on the off-chain verifier.
  • Works with transferable NFTs and with soulbound tokens such as ERC-5192. Because verification checks the signature against the current owner, a binding signed by a previous owner stops verifying after a transfer.

#nft #identity #did #erc721

Details

Authors
Chloe Gu <[email protected]>, Navid X. (@xuxinlai2002), Victor Yu <[email protected]>, Archer H.
Status
Final
Type
Standards Track / ERC
Created
2023-06-25
Requires

Machine-readable: Markdown · JSON