ERC-4671 Soulbound token (NTT) standard (Non-Tradable Tokens Standard)
Stagnant · NFTs & multi-token · created 2022-01-13
A standard for issuing and verifying tokens that represent non-transferable proof of personal ownership, such as university diplomas, driver's licenses, and ID cards.
Why it is needed
Until now, most tokens on the blockchain have been designed as assets that can be freely bought and sold. However, an increasing number of certificates that are meaningful only to their holder and should not be traded, such as university diplomas, driver's licenses, ID cards, and marriage certificates, are being issued on the blockchain. Without a common standard, these certificates end up implemented differently by each project, making them hard for other services to trust and verify, and using a generic token standard as-is creates the risk that a certificate could be bought, sold, or transferred to someone else. This standard defines a common interface for certificate tokens that issuers can revoke but that can never be transferred, letting third parties easily verify ownership and validity.
What to implement
event Minted(address owner, uint256 tokenId);: An event emitted when token tokenId is issued to owner.event Revoked(address owner, uint256 tokenId);: An event emitted when owner's token tokenId is revoked.function balanceOf(address owner) external view returns (uint256);: Counts the number of tokens owned by owner.function ownerOf(uint256 tokenId) external view returns (address);: Returns the owner address of token tokenId.function isValid(uint256 tokenId) external view returns (bool);: Checks whether token tokenId has not been revoked.function hasValid(address owner) external view returns (bool);: Checks whether owner holds a valid token.
In depth
Core interface: IERC4671
The base interface, which inherits ERC-165, consists of four query functions, balanceOf(owner), ownerOf(tokenId), isValid(tokenId), hasValid(owner), and two events, Minted(owner, tokenId) and Revoked(owner, tokenId). One contract represents one certificate type issued by one issuing institution; for example, a contract for French national ID cards and a contract for EIP author badges would be separate contracts. One address can hold multiple tokens, and each token has a unique tokenId. The issuing institution can revoke a token but cannot delete it, so the record that it was once held remains permanently.
Metadata extension (IERC4671Metadata)
Adds three functions, name(), symbol(), and tokenURI(tokenId), providing the token type's name and abbreviation along with a URI for fetching an individual token's metadata.
Enumerable extension (IERC4671Enumerable)
emittedCount() and holdersCount() query the total number issued and the number of holders, while tokenOfOwnerByIndex(owner, index) and tokenByIndex(index) allow iterating tokens by index, either per holder or across all tokens.
Delegation extension (IERC4671Delegate)
delegate(operator, owner) and delegateBatch(operators, owners) grant an operator a one-time right to mint a token to a specific owner. The authorized operator calls mint(owner) or mintBatch(owners) to actually issue the token, and issuerOf(tokenId) can be used to query which address issued a given token.
Consensus extension (IERC4671Consensus)
voters() queries a predetermined list of voters, and approveMint(owner) and approveRevoke(tokenId) are used to vote on issuance and revocation respectively. This is a structure where issuance and revocation are decided by consensus among predetermined voters.
Pull extension (IERC4671Pull)
pull(tokenId, owner, signature) is a function used when a token owner wants to move a token to another wallet they control. The caller must supply a signature, signed by the owner wallet, over the tuple (tokenId, owner, recipient).
NTT Store
A store interface that lets users register the address of their IERC4671Enumerable contract so third parties can conveniently query the non-tradable tokens held by an address. add(token) and remove(token) register and deregister, while get(owner) queries the list of token contracts an address has registered. Registering and deregistering emit Added and Removed events respectively.
Why off-chain metadata was chosen over on-chain, and the current status
The standard chose to keep token data off-chain via tokenURI(). Since non-tradable tokens represent personal property, encryption may be necessary in some cases, but since the encryption approach varies by use case, the standard decided not to specify it. Another reason is that because Solidity does not support generics or struct inheritance, it was difficult to design a general-purpose metadata store. This proposal is currently in Stagnant status and is no longer being actively discussed or changed.
Things to watch out for
- Privacy exposure risk of tokenURI: Because non-tradable tokens represent personal property like an ID card, users may want to encrypt the metadata returned by tokenURI. The standard does not specify an encryption method, and the contract creator bears responsibility for keeping that URI available at all times.
- No recovery option if a wallet is lost: The standard does not define a transfer function to move a token from one wallet to another. So if a wallet is lost, there is no way to recover it other than having the issuing institution reissue the token, meaning users must be careful about managing the wallet that receives the token.