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 ERC4671, a proposed standard for non-tradable NFTs known as NTTs.

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

I also cover various other EIPs.

Overview

A non-tradable token (NTT) represents inherently personal possessions, whether tangible or intangible. Examples include university diplomas, online training certificates, government-issued documents such as national IDs, driving licenses, visas, and marriage certificates, as well as labels.

As the name suggests, these tokens are designed not to be traded or ordinarily transferred. They are soulbound. They are intended to serve as proof of possession or achievement rather than as instruments with monetary value, and are issued to individuals.

Motivation

Smart contracts have previously been used to issue university diplomas and driving licenses, as well as to represent food labels and proof of attendance at events. These use cases share a common characteristic: the use of non-tradable tokens.

Blockchains have long been used as instruments for speculation. Non-tradable tokens offer another way to use blockchain technology for practical purposes.

A common interface for non-tradable tokens can support a wider variety of applications and help establish blockchains as standard infrastructure for verifying personal possessions and achievements.

Specification

ERC4671 standardizes an interface for non-tradable tokens (NTTs) representing personal achievements or credentials. NTTs are designed to be non-transferable through the base interface, giving them the properties of soulbound tokens.

Each ERC4671 token contract represents one type of certificate, such as a university diploma or government-issued ID, delivered by an authority to individual addresses. The standard also allows the issuing authority to revoke a token without erasing its ownership record and provides functions for third parties to verify ownership and validity.

Interface

IERC4671.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

interface IERC4671 is IERC165 {
    /// Event emitted when a token `tokenId` is minted for `owner`
    event Minted(address owner, uint256 tokenId);

    /// Event emitted when token `tokenId` of `owner` is revoked
    event Revoked(address owner, uint256 tokenId);

    /// @notice Count all tokens assigned to an owner
    /// @param owner Address for whom to query the balance
    /// @return Number of tokens owned by `owner`
    function balanceOf(address owner) external view returns (uint256);

    /// @notice Get owner of a token
    /// @param tokenId Identifier of the token
    /// @return Address of the owner of `tokenId`
    function ownerOf(uint256 tokenId) external view returns (address);

    /// @notice Check if a token hasn't been revoked
    /// @param tokenId Identifier of the token
    /// @return True if the token is valid, false otherwise
    function isValid(uint256 tokenId) external view returns (bool);

    /// @notice Check if an address owns a valid token in the contract
    /// @param owner Address for whom to check the ownership
    /// @return True if `owner` has a valid token, false otherwise
    function hasValid(address owner) external view returns (bool);
}

Minted

js
event Minted(address owner, uint256 tokenId);

Emitted when a token is minted.

Parameters

  • owner
    • The address receiving the token.
  • tokenId
    • The ID of the minted token.

Revoked

js
event Revoked(address owner, uint256 tokenId);

Emitted when a token is revoked.

Parameters

  • owner
    • The owner of the token.
  • tokenId
    • The ID of the revoked token.

balanceOf

js
function balanceOf(address owner) external view returns (uint256);

Returns the number of tokens owned by the specified address. It counts all tokens issued to the address that it owns, whether they are valid or revoked.

Parameters

  • owner
    • The address whose token balance is being queried.

Returns

  • uint256
    • The number of tokens owned.

ownerOf

js
function ownerOf(uint256 tokenId) external view returns (address);

Returns the owner of the specified token. The function returns the current owner's address for tokenId. Ownership information is retained even if the token has been revoked.

Parameters

  • tokenId
    • The ID of the token.

Returns

  • address
    • The token owner.

isValid

js
function isValid(uint256 tokenId) external view returns (bool);

Checks whether a token is valid. The function returns true for a valid issued token that has not been revoked.

Parameters

  • tokenId
    • The ID of the token being checked.

Returns

  • bool
    • true if valid; false if invalid.

hasValid

js
function hasValid(address owner) external view returns (bool);

Checks whether the specified address owns at least one valid token. The function returns true if the address holds at least one token that has been issued and is still valid.

Parameters

  • owner
    • The address being checked.

Returns

  • bool
    • true if the address owns a valid token.

ERC4671Metadata

IERC4671Metadata.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC4671.sol";

interface IERC4671Metadata is IERC4671 {
    /// @return Descriptive name of the tokens in this contract
    function name() external view returns (string memory);

    /// @return An abbreviated name of the tokens in this contract
    function symbol() external view returns (string memory);

    /// @notice URI to query to get the token's metadata
    /// @param tokenId Identifier of the token
    /// @return URI for the token
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

name

js
function name() external view returns (string memory);

Returns the token name.

Returns

  • string
    • The token name.

symbol

js
function symbol() external view returns (string memory);

Overview Returns the token's abbreviated name or symbol. Examples of short names are ETH and IDFRA.

Returns

  • string
    • The token symbol.

tokenURI

js
function tokenURI(uint256 tokenId) external view returns (string memory);

Returns the URI of the metadata associated with a token. The URI can be used to access metadata, for example in JSON format.

Parameters

  • tokenId
    • The ID of the token.

Returns

  • string
    • The metadata URI.

ERC4671Enumerable

IERC4671Enumerable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC4671.sol";

interface IERC4671Enumerable is IERC4671 {
    /// @return emittedCount Number of tokens emitted
    function emittedCount() external view returns (uint256);

    /// @return holdersCount Number of token holders  
    function holdersCount() external view returns (uint256);

    /// @notice Get the tokenId of a token using its position in the owner's list
    /// @param owner Address for whom to get the token
    /// @param index Index of the token
    /// @return tokenId of the token
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /// @notice Get a tokenId by it's index, where 0 <= index < total()
    /// @param index Index of the token
    /// @return tokenId of the token
    function tokenByIndex(uint256 index) external view returns (uint256);
}

emittedCount

js
function emittedCount() external view returns (uint256);

Returns the total number of tokens emitted. This is the cumulative issuance count, including revoked tokens.

Returns

  • uint256
    • The number of tokens emitted.

holdersCount

js
function holdersCount() external view returns (uint256);

Returns the number of token holders. In the base non-transferable model, this counts addresses that have received tokens, since revocation does not erase ownership. An extension that moves ownership must account for its own holder-count changes.

Returns

  • uint256
    • The number of holders.

tokenOfOwnerByIndex

js
function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

Retrieves a token from an owner's token list by index. The function returns the tokenId corresponding to the specified index.

Parameters

  • owner
    • The owner's address.
  • index
    • The index in the owner's token list.

Returns

  • uint256
    • The corresponding token ID.

tokenByIndex

js
function tokenByIndex(uint256 index) external view returns (uint256);

Retrieves a tokenId using a global token index. It provides access to the token IDs in the contract's global enumeration.

Parameters

  • index
    • The global token index.

Returns

  • uint256
    • The token ID.

ERC4671Delegate

IERC4671Delegate.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC4671.sol";

interface IERC4671Delegate is IERC4671 {
    /// @notice Grant one-time minting right to `operator` for `owner`
    /// An allowed operator can call the function to transfer rights.
    /// @param operator Address allowed to mint a token
    /// @param owner Address for whom `operator` is allowed to mint a token
    function delegate(address operator, address owner) external;

    /// @notice Grant one-time minting right to a list of `operators` for a corresponding list of `owners`
    /// An allowed operator can call the function to transfer rights.
    /// @param operators Addresses allowed to mint
    /// @param owners Addresses for whom `operators` are allowed to mint a token
    function delegateBatch(address[] memory operators, address[] memory owners) external;

    /// @notice Mint a token. Caller must have the right to mint for the owner.
    /// @param owner Address for whom the token is minted
    function mint(address owner) external;

    /// @notice Mint tokens to multiple addresses. Caller must have the right to mint for all owners.
    /// @param owners Addresses for whom the tokens are minted
    function mintBatch(address[] memory owners) external;

    /// @notice Get the issuer of a token
    /// @param tokenId Identifier of the token
    /// @return Address who minted `tokenId`
    function issuerOf(uint256 tokenId) external view returns (address);
}

delegate

js
function delegate(address operator, address owner) external;

Grants an operator a one-time right to mint a token for a specified owner. The operator can execute mint once for owner.

Parameters

  • operator
    • The address receiving minting permission.
  • owner
    • The address for which the token may be minted.

delegateBatch

js
function delegateBatch(address[] memory operators, address[] memory owners) external;

Grants multiple operators minting rights for their corresponding owners in a single call. Each operator is authorized to mint once for the corresponding owner.

Parameters

  • operators
    • An array of addresses receiving minting permission.
  • owners
    • The intended token recipients corresponding to the operators.

mint

js
function mint(address owner) external;

Mints a token for the specified address. The caller must have permission to mint for owner.

Parameters

  • owner
    • The address for which the token is minted.

mintBatch

js
function mintBatch(address[] memory owners) external;

Mints tokens for multiple addresses in one call. The caller must have permission to mint for each address.

Parameters

  • owners
    • An array of token recipient addresses.

issuerOf

js
function issuerOf(uint256 tokenId) external view returns (address);

Returns the address of the issuer or operator who minted a token. The function returns the issuer's address for the specified tokenId.

Parameters

  • tokenId
    • The ID of the token whose issuer is being queried.

Returns

  • address
    • The address of the token issuer.

ERC4671Consensus

IERC4671Consensus.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC4671.sol";

interface IERC4671Consensus is IERC4671 {
    /// @notice Get voters addresses for this consensus contract
    /// @return Addresses of the voters
    function voters() external view returns (address[] memory);

    /// @notice Cast a vote to mint a token for a specific address
    /// @param owner Address for whom to mint the token
    function approveMint(address owner) external;

    /// @notice Cast a vote to revoke a specific token
    /// @param tokenId Identifier of the token to revoke
    function approveRevoke(uint256 tokenId) external;
}

voters

js
function voters() external view returns (address[] memory);

Returns the addresses eligible to vote in this contract. The result identifies who may participate in decisions to mint or revoke tokens through the consensus mechanism.

Returns

  • address[]
    • The list of voter addresses.

approveMint

js
function approveMint(address owner) external;

Casts a vote in favor of minting a token for a specified address. A voter can use this function to approve issuing a token to owner.

Parameters

  • owner
    • The intended recipient of the token.

approveRevoke

js
function approveRevoke(uint256 tokenId) external;

Casts a vote in favor of revoking a specified token. A voter can use this function to approve revoking that token.

Parameters

  • tokenId
    • The ID of the token proposed for revocation.

ERC4671Pull

IERC4671Pull.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC4671.sol";

interface IERC4671Pull is IERC4671 {
    /// @notice Pull a token from the owner wallet to the caller's wallet
    /// @param tokenId Identifier of the token to transfer
    /// @param owner Address that owns tokenId
    /// @param signature Signed data (tokenId, owner, recipient) by the owner of the token
    function pull(uint256 tokenId, address owner, bytes memory signature) external;
}

pull

js
function pull(uint256 tokenId, address owner, bytes memory signature) external;

Allows an owner to move a token to another of their wallets. The caller supplies the signature of (tokenId, owner, recipient) produced using the owner wallet, allowing the token to be pulled from owner to the caller's wallet. This optional extension is an exception to the base interface's non-transferable design, intended for wallet migration.

Parameters

  • tokenId
    • The ID of the token to move.
  • owner
    • The address currently owning the token.
  • signature
    • The owner's signature over (tokenId, owner, recipient).

NTT Store

Non-tradable tokens are intended to be verified by third parties. Users therefore need a convenient way to selectively expose their tokens. ERC4671Store defines a store interface for this purpose, allowing users to register, expose, and remove references to particular ERC4671Enumerable token contracts.

IERC4671Store.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

interface IERC4671Store is IERC165 {
    // Event emitted when a IERC4671Enumerable contract is added to the owner's records
    event Added(address owner, address token);

    // Event emitted when a IERC4671Enumerable contract is removed from the owner's records
    event Removed(address owner, address token);

    /// @notice Add a IERC4671Enumerable contract address to the caller's record
    /// @param token Address of the IERC4671Enumerable contract to add
    function add(address token) external;

    /// @notice Remove a IERC4671Enumerable contract from the caller's record
    /// @param token Address of the IERC4671Enumerable contract to remove
    function remove(address token) external;

    /// @notice Get all the IERC4671Enumerable contracts for a given owner
    /// @param owner Address for which to retrieve the IERC4671Enumerable contracts
    function get(address owner) external view returns (address[] memory);
}

Added

js
event Added(address owner, address token);

Emitted when a user adds a token contract to their store.

Parameters

  • owner
    • The address of the user adding the contract.
  • token
    • The address of the registered ERC4671Enumerable token contract.

Removed

js
event Removed(address owner, address token);

Emitted when a user removes a previously registered token contract from their store.

Parameters

  • owner
    • The address of the user removing the contract.
  • token
    • The address of the removed ERC4671Enumerable token contract.

add

js
function add(address token) external;

Registers an ERC4671Enumerable token contract in the user's store. The function adds the token contract to the caller's records, making the reference available to third parties. The contract being added is expected to conform to ERC4671Enumerable.

Parameters

  • token
    • The address of the token contract to add.

remove

js
function remove(address token) external;

Removes a registered token contract from the user's store. The function removes a previously registered contract from the caller's list. This removes the reference from the user's public store listing; it does not revoke the token itself or erase existing on-chain information.

Parameters

  • token
    • The address of the token contract to remove.

get

js
function get(address owner) external view returns (address[] memory);

Returns the list of ERC4671Enumerable token contracts exposed by a specified user. Third parties can use this function to retrieve the contract references published in an address's store. Tokens whose contracts have not been added to the store are not included in this listing.

Parameters

  • owner
    • The address of the user whose store is being queried.

Returns

  • address[]
    • An array of the exposed token contract addresses.

Rationale

On-chain vs. Off-chain

The proposal's metadata design keeps NTT metadata off-chain rather than directly storing it on-chain. There are two main reasons for this choice.

  • Non-tradable tokens represent personal possessions or credentials, so certain use cases may require data encryption. There are many possible encryption approaches, and the choice depends on the application. The standard therefore does not prescribe a particular method of encryption.
  • To keep the token specification generic, an alternative design considered storing token data in a contract such as MetadataStore. However, Solidity does not support generic types or struct inheritance, preventing the flexible representation envisaged by the authors.

For these reasons, the metadata design uses tokenURI() to reference external resources. The interface itself returns a URI rather than enforcing a particular storage or encryption technology.

Security Considerations

The tokenURI Function

The tokenURI function returns the URI of metadata associated with a token. When handling personal data, such as national identification information, encrypting the contents may be necessary. The issuer of each contract is responsible for implementing appropriate encryption and data protection.

URI Availability

The resource referenced by the URI (the off-chain metadata) should remain accessible at all times. If a link breaks or the resource is deleted and the metadata can no longer be retrieved, the token may lose its intended meaning or usefulness.

Reissuing Tokens

The base ERC4671 interface does not support ordinary token transfers. Users therefore need to take particular care of the wallets in which they receive NTTs. If access to a wallet is lost, the recovery method described by the proposal is for the issuing authority to reissue the token, much like replacing a real-world certificate.

The optional Pull extension described above permits migration with a signature from the original wallet, but it does not recover access to a wallet whose signing authority has been lost.

Reference Implementation

EIPCreatorBadge.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./ERC4671.sol";

contract EIPCreatorBadge is ERC4671 {
    constructor() ERC4671("EIP Creator Badge", "EIP") {}

    function giveThatManABadge(address owner) external {
        require(_isCreator(), "You must be the contract creator");
        _mint(owner);
    }

    function _baseURI() internal pure override returns (string memory) {
        return "https://eips.ethereum.org/ntt/";
    }
}

Citation

Omar Aflak (@omaraflak), Pol-Malo Le Bris, Marvin Martin (@MarvinMartin24), "ERC-4671: Non-Tradable Tokens Standard [DRAFT]," Ethereum Improvement Proposals, no. 4671, January 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-4671.

The citation above retains the status recorded in the original article. The official proposal currently lists its status as Stagnant.

Conclusion

ERC4671 proposes a standard for non-tradable NFTs known as NTTs, with interfaces for issuing and verifying personal credentials.

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

Twitter @cardene777

I also publish on other platforms.

https://chaldene.net/