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 covers ERC5023, a standard that enables an NFT holder to share a token by minting a copy for another address.

The following proposal is the basis for this article.

For more on ERC721, see the following article.

https://chaldene.net/erc721

Overview

The proposal standardizes an interface for making non-fungible tokens shareable. Shareable tokens are created by minting a copy of an existing token for another address. The operation makes it possible to track who shared what with whom.

Motivation

NFT standards such as ERC721 and ERC1155 were developed to standardize non-fungible digital resources. However, many resources with non-fungible value do not need to be scarce.

The proposal seeks to capture externalities by introducing a new kind of incentive mechanism into the ecosystem, based on anti-rival logic.

Anti-rival logic describes a mechanism in which sharing resources can increase their value. Physical resources are generally limited: when one person uses a rival resource, it may no longer be available to someone else. For digital resources and in certain other cases, however, sharing may not diminish value and may even increase it.

Anti-rival logic

An incentive mechanism is a mechanism for encouraging particular behaviors or activities in an economic system. In this case, participants receive shareable tokens in return for taking certain actions.

An externality here refers to a beneficial effect that sharing a token has on other participants or the ecosystem as a whole. Where ordinary tokens primarily allow their owners to obtain the benefits associated with holding them, shareable tokens are intended to gain value through sharing. Sharing a token is thus expected to have a positive effect on the sharer and the wider ecosystem.

Consider the following examples.

  1. Shareable tokens on a social media platform

    Sharing content can benefit not only its creator but also the person who shares it and the people who view it. Sharers contribute to the popularity of the content, potentially increasing their own visibility and the likelihood of receiving more likes or comments. Viewers gain more opportunities to discover interesting content and access a wider variety of material, improving their experience.

  2. Shareable tokens on a decentralized file-sharing platform

    Sharing a file can benefit its uploader, the person sharing it, and the people downloading it. Sharers help distribute the file and make valuable information available to a larger audience. Downloaders gain useful information or data that they can apply to their own purposes.

Externalities

These incentives function both as units of account and as shareable media.

A unit of account in this context means that holding a token can represent a particular economic action or participation, with tokens awarded in return for that activity. Because participants can earn tokens by taking specified actions, the tokens serve as incentives. For example, a participant might receive tokens for sharing content or contributing to a platform.

A shareable medium is an item with a digital nature. Tokens can represent digital assets, content, art, and similar items. Holding a token can confer rights associated with the item it represents, depending on the implementation and applicable terms. Shareable tokens also have the potential to gain value through sharing. In other words, sharing a token with other people may increase the value it represents.

Shareable NFTs are flexible tokens that enable the sharing of digital property, with zero transaction cost in the economic model described by the proposal. This does not mean an on-chain transaction is exempt from network gas fees. They are intended to help measure and assess positive externalities in economic systems and to increase value for participants and the ecosystem as a whole.

Conventional NFT standards such as ERC721 and ERC1155 do not specify a sharing mechanism. Instead, they define interfaces for common rival use cases, such as minting tokens and transferring them. Unlike ordinary NFTs, shareable tokens are designed to be shared across multiple addresses. Shareability means that an existing token can be minted again as a copy for another address. The original token remains intact while another address receives a copy representing the same resource.

Summary

Shareable tokens introduce a feature that enables sharing across multiple addresses while retaining compatibility with conventional NFT standards. They achieve this by minting copies of existing tokens for other addresses. Because the original remains intact, the resource represented by a token can provide value to multiple parties.

Sharing a token while retaining the original

Sharing is an interesting concept that can be understood in several ways. For example, one way to think about sharing is as making a digital copy. A person provides a digital resource, such as a photograph, music, or video, to someone else while retaining their own rights to the resource. This form of sharing can be understood as duplication of a digital resource.

Shareable tokens can support different forms of sharing. One form makes a digital asset itself available to multiple people; another grants multiple people rights to use particular digital content. Shareable tokens are designed to accommodate these different approaches.

Shareable tokens are a new type of token capable of supporting various forms of sharing, including sharing digital resources. Their flexibility and implementation freedom make them applicable to different use cases and requirements.

At the smart contract implementation level, shareable tokens can be made non-transferable. This creates tokens that are both shareable and non-transferable. Once a token has been minted, its ownership cannot be transferred to another address, even though sharing through minting a new token is possible.

The interface for shareable NFTs can be used to define shareable, non-transferable NFTs. This is an attempt to make the more abstract concept of shareability accessible to a wider audience.

The interface defines the minimum functionality needed to express shareability. It provides a common basis for creating and sharing tokens, while the implementation determines whether transfers are prohibited. Using a common interface helps make shareability easier to understand and simplifies the implementation of sharing and non-transferability.

Shareable non-transferable tokens

Specification

javascript
interface IERC5023 is IERC165 {

  event Share(address indexed from, address indexed to, uint256 indexed tokenId, uint256 derivedFromtokenId);

  function share(address to, uint256 tokenIdToBeShared) external returns(uint256 newTokenId);

}

Share

An event emitted when a token is shared by minting a new token for another address, rather than transferring ownership of the caller's original token.

  • from
    • The address of the original token owner.
  • to
    • The address of the new token owner.
  • tokenId
    • The ID of the newly minted token, as shown by the reference implementation below.
  • derivedFromtokenId
    • The ID of the existing token from which the new token was derived.

share

A function that shares an existing token by minting a new token with a new token ID. The original token remains with its owner, while the newly minted token goes to the specified address (to).

  • to
    • The address that will own the new token.
  • tokenIdToBeShared
    • The ID of the existing token to be shared through minting a copy.

The function returns the newly minted token ID. The Share event is emitted when share is called and a new token derived from the specified token ID is minted to the recipient.

Additional Considerations

Existing NFT standards define transferable non-fungible tokens but do not define shareable non-fungible tokens. To create shareable NFTs, an existing NFT contract can be extended with an interface defining the basic principles of sharing. Specifically, the interface defines a sharing event and a function for sharing. The decision about token transferability is left to the contract implementer. If transfers remain enabled, shareable tokens behave like existing tokens, with the difference that sharing leaves the original token intact. If transfers are disabled, the result is a shareable non-transferable token: a new token can be minted for another person, but ownership of an existing token cannot be transferred.

NFT (non-fungible token) standards generally define transferable tokens. Their owners can transfer the tokens to other people. However, shareable NFTs are not defined by these existing standards. Creating a shareable token requires extending an existing NFT contract with a new interface defining the basic principles of sharing.

The new interface defines events related to sharing and a function for performing it. Specifically, it records sharing through the Share event and provides the share function for sharing a token with another person. The contract implementer determines whether the tokens are transferable. If transferability is enabled, shareable tokens can be transferred like ordinary tokens, while sharing leaves the original token with its owner. If transferability is disabled, shareable tokens become non-transferable. New tokens can still be minted for other people, but existing tokens cannot be transferred.

Creating shareable NFTs therefore involves extending existing NFT contracts and introducing a new sharing interface. Different combinations of sharing and transferability policies allow different types of shareable tokens to be created, giving holders control over how sharing takes place within those rules. This makes it possible to implement more complex sharing functionality and customize token properties in greater detail.

Scenario

Suppose Bob and Alice are collaborating on a project. Bob earns a unique NFT recognizing his contribution to the project, but feels that his achievement was not accomplished through his efforts alone. He wants to share the recognition with Alice, who also contributed to the project. Bob calls share on the contract that manages his token, specifying which token he wants to share and with whom. A new token is created for Alice, and the Share event records its token ID and the ID of the original token from which it was derived.

Over time, the Share event data forms a tree. If Bob shares with Alice, and Alice subsequently shares with Charlie and David, the sharing activity produces a basic tree structure. The event data can later be used to obtain information about the sharing activity represented by the tokens.

text
   B
   |
   A
  / \
 C   D

These trees can also be transformed into larger network representations. For example, if Bob shares a token with Alice, Alice shares another token with Charlie, and Bob also shares a token with Charlie, the following network emerges.

text
B----A----C
\________/

Backward Compatibility

The proposal is backward compatible with ERC721 and ERC1155.

Reference Implementation

The reference implementation illustrates a common use case for tokens shared within a particular community. Shareable, non-transferable tokens can be used by the contract owner to recognize the merits or achievements of people who have contributed to that community.

Specifically, the contract owner can create a new token and award it to a particular person. This recognizes the person's contribution to the community or other valuable activity. The recipient can then share the token with others. For instance, the recipient can share the recognition with other people who participated in or influenced that contribution.

Contributions and achievements within a community can thus be represented by tokens and their value recognized. Sharing tokens also connects different community members, forming a network of shared activity and influence.

For example, when Bob contributes to a community, the contract owner awards Bob a special token. Bob receives the token and decides to share it with other members or friends who appreciated his contribution. Bob chooses to share the token with Alice and Charlie. Alice then chooses to share with Eve, and Charlie with David. In this way, Bob's token is shared among multiple people in the community.

Bob's contribution and achievements are recognized within the community, and further sharing may also influence other people. The information associated with the shared tokens can reveal the activities or relationships they represent and can help promote interaction and collaboration within the community.

javascript
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;

import "./IERC5023.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Context.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract ShareableERC721 is ERC721URIStorage, Ownable, IERC5023 /* EIP165 */ {

  string baseURI;

  uint256 internal _currentIndex;
    
  constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {}

  function mint(
        address account,
        uint256 tokenId
    ) external onlyOwner {
        _mint(account, tokenId);
  }

  function setTokenURI(
        uint256 tokenId, 
        string memory tokenURI
    ) external {
        _setTokenURI(tokenId, tokenURI);
  }

  function setBaseURI(string memory baseURI_) external {
        baseURI = baseURI_;
  }
    
  function _baseURI() internal view override returns (string memory) {
        return baseURI;
  }

  function share(address to, uint256 tokenIdToBeShared) external returns(uint256 newTokenId) {
      require(to != address(0), "ERC721: mint to the zero address");
      require(_exists(tokenIdToBeShared), "ShareableERC721: token to be shared must exist");
      
      require(msg.sender == ownerOf(tokenIdToBeShared), "Method caller must be the owner of token");

      string memory _tokenURI = tokenURI(tokenIdToBeShared);
      _mint(to, _currentIndex);
      _setTokenURI(_currentIndex, _tokenURI);

      emit Share(msg.sender, to, _currentIndex, tokenIdToBeShared);

      return _currentIndex;
  }

  function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        revert('In this reference implementation tokens are not transferrable');
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        revert('In this reference implementation tokens are not transferrable');
    }
}

The code above is available in the following repository.

Tests

The test code is located here.

sh
$ cd contract
$ npm install
$ npx hardhat test test/ERC6147/ERC6147.test.ts

The command above illustrates how to install dependencies and run a test. Note that the original command names ERC6147 rather than ERC5023; for this article, use the ERC5023 test file linked above.

Security Considerations

The reference implementation should not be used in production as written. The proposal identifies no additional security considerations directly related to the standard.

The particular sample above also needs careful review: its URI setters have no access-control checks, its token index is not advanced in the shown code, and it does not cover all inherited transfer entry points. These limitations are specific to the example, not requirements of ERC5023.

Citation

Jarno Marttila (@yaruno), Martin Moravek (@mmartinmo), "ERC-5023: Shareable Non-Fungible Token," Ethereum Improvement Proposals, no. 5023, January 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5023.

Discussion

ERC5023 lets an NFT owner retain ownership of the original token while giving a copy to another address. Some NFT rental implementations transfer the NFT itself to another address, which can be a concern for the owner. Granting usage rights to an NFT can also raise concerns about possible vulnerabilities in the implementation. With the copy-based approach, the original NFT remains under the owner's control, since a separate token is minted. This reduces the risks associated with transferring the original, although the sharing implementation itself still requires a security review. The sample might appear to support only one copy per NFT, but the interface does not impose such a limit; the example's minting index must also be managed correctly to avoid token ID collisions. A copied NFT can be made transferable or non-transferable. Making copies non-transferable could restrict their use to the addresses that receive them. Alternatively, transferable copies could be traded. I would like to try building something with these shareable NFTs.

Conclusion

This article covered ERC5023, a standard for sharing NFTs by minting copies while retaining the original token.

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

Twitter @cardene777