Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

This article examines ERC-5114, which defines an interface for soulbound badges associated with an NFT identified by its contract address and token ID.

This article translates, summarizes, and supplements the material linked below.

As of September 15, 2023, the original article recorded ERC-5114 as being in the Last Call stage.

Overview

A soulbound badge is a type of non-fungible token. From the moment it is created or minted, it is bound to another NFT and cannot subsequently be separated from it.

Once a soulbound badge is associated with an NFT, the association is permanent. The badge cannot be transferred independently to another NFT or account. This inseparable relationship is the reason for the term soulbound badge.

Specification

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

	// returns the NFT that this badge is bound to.
	// this function **MUST** throw if the badge 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 badge
	function ownerOf(uint256 badgeId) external view returns (address nftAddress, uint256 nftTokenId);

	// returns a URI with details about this badge collection
	// the metadata returned by this is merged with the metadata return by `badgeUri(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 `badgeUri` 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 badge 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 `badgeUri` also **MUST** follow all of the above rules
	function badgeUri(uint256 badgeId) external view returns (string badgeUri);

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

A contract implementing this standard should also implement a standard interface-detection mechanism so that callers can identify its support for ERC-5114.

The following sections explain the members of the IERC5114 interface.


Mint

javascript
event Mint(uint256 indexed badgeId, address indexed nftAddress, uint256 indexed nftTokenId);

Overview

An event emitted when a new instance of a badge is created.

Details

  • The event must not be emitted twice for the same badgeId.

Parameters

  • badgeId
    • The badge's token ID.
  • nftAddress
    • The address of the NFT contract to which the badge is bound.
  • nftTokenId
    • The token ID of the NFT to which the badge is bound.

Return value

  • None.

ownerOf

javascript
function ownerOf(uint256 badgeId) external view returns (address nftAddress, uint256 nftTokenId);

Overview

Returns information about the NFT to which the badge is bound.

Details

  • The function must throw if the badge has not been created.
  • Once a badge has been created, the function must always return the same result.
  • The returned values must match the values in the badge's original Mint event.

Arguments

  • badgeId
    • The badge's token ID.

Return values

  • nftAddress
    • The address of the NFT contract to which the badge is bound.
  • nftTokenId
    • The token ID of the NFT to which the badge is bound.

collectionUri

javascript
function collectionUri() external pure returns (string collectionUri);

Overview

Returns a URI containing information about the badge collection.

Details

  • The returned metadata is combined with the metadata returned by badgeUri(uint256).
  • The collectionUri must be immutable.
  • It must also be content-addressable, for example using ipfs:// rather than an ordinary http:// URL.

Return value

  • collectionUri
    • URI containing information about the badge collection.

badgeUri

javascript
function badgeUri(uint256 badgeId) external view returns (string badgeUri);

Overview

Returns a URI containing information about a particular badge instance.

Details

  • Metadata returned through this URI takes precedence over metadata returned through collectionUri.
  • External links in the content referenced by badgeUri must also follow the applicable immutability and content-addressing requirements.

Arguments

  • badgeId
    • The badge's token ID.

Return value

  • badgeUri
    • URI containing information about the badge.

metadataFormat

javascript
function metadataFormat() external pure returns (string format);

Overview

Returns a string describing the format of the content referenced by badgeUri and collectionUri, such as EIP-ABCD or soulbound-schema-version-4.

Return value

  • format
    • A string identifying the metadata format.

Additional Notes

Immutability

Once a soulbound badge is bound to an NFT, that association cannot be moved or modified.

Even when several badges are associated with the same NFT, their individual bindings cannot be detached or merged. The immutable relationship also enables applications to cache results for efficient retrieval.

Why Content-Addressable URIs Are Required

A content-addressable URI identifies particular content or data rather than merely its location.

Soulbound badges are intended to serve as permanent indicators associated with a persona. Neither the recipient nor the issuer can independently transfer the badge or reclaim its binding.

Remote content must not be changed or removed as a means of selectively censoring or manipulating a recipient. Content addressing preserves the identity of the referenced content, although it does not by itself guarantee continued data availability.

No Fixed badgeUri Data Format

The standard intentionally leaves the format of content referenced by collectionUri() and badgeUri(uint256), and the detailed rules for combining them, open to future improvement.

The core requirement is the immutability of the badge, regardless of the chosen metadata schema.

The metadataFormat function supplies information about the format or version so that callers can interpret the referenced data.

Backward Compatibility

This is a new token type. It is not intended to be backward-compatible with existing token standards except insofar as it can be bound to an existing valid soul, an asset identifiable by an address and an ID.

In other words, its compatibility with existing assets concerns their use as the target of the binding, not compatibility with their token transfer interfaces.

Security Considerations

Users and applications must carefully assess whether a badge implementation actually meets the standard's requirements.

A creator may make an API appear compliant during initial inspection while implementing a mechanism that allows a badge to be transferred or modified later. Merely exposing the expected interface does not guarantee immutability.

Soulbound badges are bound to personas rather than directly to individual humans. A persona can collect multiple badges over time and may represent one person or a group of people.

Control of that persona can also be transferred to another person or group. Parties interacting with a persona should not assume that it corresponds to exactly one human being.

A soulbound badge may itself be bound to another soulbound badge. Theoretically, simultaneously created relationships may form a cycle. Software traversing such relationships should account for cycle detection and determine how cycles are handled.

Citation

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

Conclusion

ERC-5114 defines an interface for soulbound badges permanently bound to an asset identified by its NFT contract address and token ID.

If you have questions, feel free to contact me on Twitter.

Twitter @cardene777

I also publish articles on the following platforms.

https://chaldene.net/