⚠️ 该 EIP 不建议普遍使用或实施,因为它可能会发生变化。

EIP-5114: Soulbound Badge Source

A badge that is attached to a "soul" at mint time and cannot be transferred after that.

作者 Micah Zoltu
讨论-To https://ethereum-magicians.org/t/eip-5114-soulbound-token/9417
状态 Draft
类型 Standards Track
分类 ERC
创建日期 2022-05-30
依赖 721
英文版 https://eips.ethereum.org/EIPS/eip-5114

Abstract

A soulbound token is a token that is bound to another Non-Fungible Token (NFT; e.g., a EIP-721 token) when it is minted, and cannot be transferred/moved after that.

Specification

interface IERC5114 {
    // fired anytime a new instance of this token is minted
    // this event **MUST NOT** be fired twice for the same `tokenId`
    event Mint(uint256 indexed tokenId, address indexed nftAddress, uint256 indexed nftTokenId);

    // returns the NFT that this token is bound to.
    // this function **MUST** throw if the token hasn't been minted yet
    // this function **MUST** always return the same result every time it is called after it has been minted
    // this function **MUST** return the same value as found in the original `Mint` event for the token
    function ownerOf(uint256 index) external view returns (address nftAddress, uint256 nftTokenId);

    // returns a URI with details about this token collection
    // the metadata returned by this is merged with the metadata return by `tokenUri(uint256)`
    // the collectionUri **MUST** be immutable (e.g., ipfs:// and not http://)
    // the collectionUri **MUST** be content addressable (e.g., ipfs:// and not http://)
    // data from `tokenUri` takes precedence over data returned by this method
    // any external links referenced by the content at `collectionUri` also **MUST** follow all of the above rules
    function collectionUri() external pure returns (string collectionUri);

    // returns a censorship resistant URI with details about this token instance
    // the collectionUri **MUST** be immutable (e.g., ipfs:// and not http://)
    // the collectionUri **MUST** be content addressable (e.g., ipfs:// and not http://)
    // data from this takes precedence over data returned by `collectionUri`
    // any external links referenced by the content at `tokenUri` also **MUST** follow all of the above rules
    function tokenUri(uint256 tokenId) external view returns (string tokenUri);

    // returns a string that indicates the format of the tokenUri and collectionUri results (e.g., 'EIP-ABCD' or 'soulbound-schema-version-4')
    function metadataFormat() external pure returns (string format);
}

Implementers of this standard SHOULD also depend on a standard for interface detection so callers can easily find out if a given contract implements this interface.

Rationale

Immutability

By requiring that tokens can never move, we both guarantee non-separability and non-mergeability among collections of soulbound tokens that are bound to a single NFT while simultaneously allowing users to aggressively cache results.

Content Addressable URIs Required

Soulbound tokens are meant to be permanent badges/indicators attached to a persona. This means that not only can the user not transfer ownership, but the minter also cannot withdraw/transfer/change ownership as well. This includes mutating or removing any remote content as a means of censoring or manipulating specific users.

No Specification for tokenUri Data Format

The format of the data pointed to by collectionUri() and tokenUri(uint256) is intentionally left out of this standard in favor of separate standards that can be iterated on in the future. The immutability constraints are the only thing defined by this to ensure that the spirit of this token is maintained, regardless of the specifics of the data format. The metadataFormat function can be used to inform a caller what type/format/version of data they should expect at the URIs, so the caller can parse the data directly without first having to deduce its format via inspection.

向后兼容性

This is a new token type and is not meant to be backward compatible with any existing tokens other than existing viable souls (like EIP-721 tokens).

Security Considerations

Users of tokens that claim to implement this EIP must be diligent in verifying they actually do. A token author can create a token that, upon initial probing of the API surface, may appear to follow the rules when in reality it doesn’t. For example, the contract could allow transfers via some mechanism and simply not utilize them initially.

It should also be made clear that soulbound tokens are not bound to a human, they are bound to a persona. A persona is any actor (which could be a group of humans) that collects multiple soulbound tokens over time to build up a collection of badges. This persona may transfer to another human, or to another group of humans, and anyone interacting with a persona should not assume that there is a single permanent human behind that persona.

It is possible for a soulbound token to be bound to another soulbound token. In theory, if all tokens in the chain are created at the same time they could form a loop. Software that tries to walk such a chain should take care to have an exit strategy if a loop is detected.

Copyright and related rights waived via CC0.

参考文献

Please cite this document as:

Micah Zoltu, "EIP-5114: Soulbound Badge [DRAFT]," Ethereum Improvement Proposals, no. 5114, May 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5114.