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-5633, which proposes making ERC-1155 tokens non-transferable soulbound tokens (SBTs).

This explanation translates, summarizes, and expands on the following specification.

For more EIPs, see https://cardene.dev/proposals.

Overview

ERC-5633 extends ERC-1155 by allowing the soulbound property to be configured per token type. A soulbound token cannot be transferred to another account after issuance. The proposal allows a single contract to manage both transferable and soulbound NFTs.

Motivation

The proposal draws inspiration from soulbound items in World of Warcraft (WoW). Some items become non-transferable once equipped by a character. For example, the rare item Calisea's Necklace is soulbound, whereas an ordinary low-level necklace may be transferable.

The Ethereum community has likewise shown interest in non-transferable NFTs and needs a standard that defines this property for each item type. ERC-5633 lets one NFT contract manage multiple token types with independent transferability settings, making it easier to manage equipment and achievements in games, for example.

ERC-5633 uses ERC-165 interface detection so wallets and applications can check whether the contract supports the extension and then determine whether a particular token ID is soulbound. Non-soulbound tokens can be transferred normally, whereas attempts to transfer soulbound tokens are blocked.

For ERC-165, see the following article.

ERC-165 Explained: Checking Whether a Contract Supports an Interface

This allows developers to enforce the soulbound property at the contract level and helps users avoid unexpected transfer failures.

Specification

IERC5633.sol
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

interface IERC5633 {
  /**
   * @dev Emitted when a token type `id` is set or cancel to soulbound, according to `bounded`.
   */
  event Soulbound(uint256 indexed id, bool bounded);

  /**
   * @dev Returns true if a token type `id` is soulbound.
   */
  function isSoulbound(uint256 id) external view returns (bool);
}

If isSoulbound(uint256 id) returns true for a token ID, tokens of that type are soulbound and cannot be transferred between accounts.

All ERC-1155 transfer operations involving such tokens must fail. Minting and burning are exceptions and remain possible.

Interface Definition (IERC5633)

The IERC5633 interface defines one event and one function.

  • event Soulbound(uint256 id, bool bounded)

    Emitted when a token ID is set or unset as soulbound. A true bounded value means soulbound; false means the restriction has been removed.

  • function isSoulbound(uint256 id) external view returns (bool)

    Checks whether a token type is soulbound.

ERC-165 Integration

A contract implementing IERC5633 must implement ERC-165's supportsInterface and return true for interface ID 0x911ec470.

Wallets and other contracts can call supportsInterface(0x911ec470) to detect support for the extension.

Additional Considerations

If all tokens in the contract are soulbound by default, the implementation must make isSoulbound(uint256 id) return true by default.

Reference Implementation

ERC5633.sol
// SPDX-License-Identifier: CC0-1.0

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "./IERC5633.sol";

/**
 * @dev Extension of ERC1155 that adds soulbound property per token id.
 *
 */
abstract contract ERC5633 is ERC1155, IERC5633 {
    mapping(uint256 => bool) private _soulbounds;
    
    /// @dev See {IERC165-supportsInterface}.
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155) returns (bool) {
        return interfaceId == type(IERC5633).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns true if a token type `id` is soulbound.
     */
    function isSoulbound(uint256 id) public view virtual returns (bool) {
        return _soulbounds[id];
    }

    function _setSoulbound(uint256 id, bool soulbound) internal {
        _soulbounds[id] = soulbound;
        emit Soulbound(id, soulbound);
    }

    /**
     * @dev See {ERC1155-_beforeTokenTransfer}.
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual override {
        super._beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            if (isSoulbound(ids[i])) {
                require(
                    from == address(0) || to == address(0),
                    "ERC5633: Soulbound, Non-Transferable"
                );
            }
        }
    }
}

Citation

HonorLabs (@honorworldio), "ERC-5633: Composable Soulbound NFT, EIP-1155 Extension [DRAFT]," Ethereum Improvement Proposals, no. 5633, September 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5633.

Conclusion

ERC-5633 enables an ERC-1155 contract to enforce non-transferability independently for each token ID while continuing to support minting and burning.

Further reading and author links:

https://chaldene.net/