Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial draft for Name-bound tokens #5107

Closed
wants to merge 5 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions EIPS/eip-xxxx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
eip: XXXX
TimDaub marked this conversation as resolved.
Show resolved Hide resolved
title: Name-bound Tokens
description: A standard interface for non-separable non-fungible tokens, also known as "Name-bound" or "soulbound tokens" or "badges"
author: Tim Daubenschütz (@TimDaub), Tom Cohen (@TheWaler), Enrico Bottazzi (@enricobottazzi)
discussions-to: https://ethereum-magicians.org/t/name-bound-tokens/9362
status: Draft
type: Standards Track
category: ERC
created: 2022-05-24
requires: 137, 165, 721
---

## Abstract

Proposes a standard API for Name-bound Tokens (NBT) within smart contracts. A NBT is a non-fungible token bound to a single ENS hashnode, and cannot be transferred between ENS names. This EIP defines basic functionality to gift, mint, and track NBT.
TimDaub marked this conversation as resolved.
Show resolved Hide resolved
TimDaub marked this conversation as resolved.
Show resolved Hide resolved

## Motivation

The Ethereum community has expressed a need for non-transferrable, non-fungible tokens. While Account-bound tokens technically allow for a simple binding mechanism, their central mechanic discourages healthy key rotation routines.

Common use cases for Name-bound tokens include tracking an individual's achievements (which can be used as credentials), or items that cannot be transferred (like certain loot in multiplayer online games).

The purpose of this document is to make NBTs a reality on Ethereum by creating consensus around a **maximally backward-compatible** but otherwise **minimal** interface definition.

## Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

`EIP-XXXX` tokens _must_ implement the interfaces:

- [EIP-165](./eip-165.md)'s `ERC165` (`0x01ffc9a7`)
- [EIP-721](./eip-721.md)'s `ERC721Metadata` (`0x5b5e139f`)

`EIP-XXXX` tokens _must not_ implement the interfaces:

- [EIP-721](./eip-721.md)'s `ERC721` (`0x80ac58cd`)

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.6;

/// @title Name-bound tokens
/// @dev See https://eips.ethereum.org/EIPS/eip-XXXX
/// Note: the ERC-165 identifier for this interface is 0x6352211e.
interface IERCXXXX /* is ERC165, ERC721Metadata */ {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface does not seem to define anything really. Is this still work in progress?

All of this can be accomplished by 721 or 1155. What you may want to specify is a getter function signaling whether a token is "soulbound" or not, but enforcement of that via transfer is still up to the particular token.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree on this I think. The specification for a soulbound token defines ownerOf and it defines that the result of ownerOf is immutable across temporally disconnected calls. This means that if you call ownerOf and get back XXX, you can be confident that if you call ownerOf again at any point in the future you would get the same result.

Copy link
Contributor Author

@TimDaub TimDaub May 30, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@axic would it help if along with the interface definition, we checked in a reference implementation to this PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an interface. The only thing what can be prescribed is what the semantics should be, but it cannot be enforced via an interface description. Reference implementations are out of scope.

/// @dev This emits when ownership between ENS nodes of any NBT changes by any mechanism.
/// This event emits when NBTs are created (`from` == 0x0) and destroyed
/// (`to` == 0x0).
event Transfer(bytes32 indexed _from, bytes32 indexed _to, uint256 indexed _id);
Comment on lines +47 to +50
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not have a mint and burn event instead? Seems like that would be more clear than Transfer(0, ...) and Transfer(..., 0, ...)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is the "industry standard" with all tokens 😬

/// @notice Find the owner of an NBT
/// @dev NBTs assigned to empty string namehash ('') are considered invalid, and queries
/// about them do throw.
/// @param _tokenId The identifier for an NFT
/// @return The address of the owner of the NFT
function ownerOf(uint256 _tokenId) external view returns (bytes32);
}
```

See [`EIP-721`](./eip-721.md) for a definition of its metadata JSON Schema.

## Rationale

### Interface

`EIP-XXXX` shall be maximally backward-compatible but still only expose a minimal and simple to implement interface definition.

As [`EIP-721`](./eip-721.md) tokens have seen widespread adoption with wallet providers and marketplaces, using its `ERC721Metadata` interface with [`EIP-165`](./eip-165.md) for feature-detection potentially allows implementers to support `EIP-XXXX` tokens out of the box.

If an implementer of [`EIP-721`](./eip-721.md) properly built [`EIP-165`](./eip-165.md)'s `function supportsInterface(bytes4 interfaceID)` function, already by recognizing that [`EIP-721`](./eip-721.md)'s track and transfer interface component with the identifier `0x80ac58cd` is not implemented, transferring of a token should not be suggested as a user interface option.

Still, however, since `EIP-XXXX` supports [`EIP-721`](./eip-721.md)'s `ERC721Metadata` extension, an account-bound token should be displayed in wallets and marketplaces with no changes needed.

### Provenance Indexing

NBTs can be indexed by tracking the emission of `event Transfer(bytes32 indexed _from, bytes32 indexed _to, uint256 indexed _id)`.

We recommend implementers to validate `Transfer`'s `_from` field by comparing it to the transaction-level `_from` field to mitigate "sleepminting" attacks.

## Backwards Compatibility

We have adopted the [`EIP-165`](./eip-165.md) and `ERC721Metadata` functions purposefully to create a high degree of backward compatibility with [`EIP-721`](./eip-721.md). We have deliberately used [`EIP-721`](./eip-721.md) terminology such as `function ownerOf(...)` and `event Transfer` to minimize the effort of familiarization for `EIP-XXXX` implementers already familiar with, e.g., [`EIP-20`](./eip-20.md) or [`EIP-721`](./eip-721.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the rationale, rather than the backwards compatibility section.


## Copyright
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Considerations section is required.


Copyright and related rights waived via [CC0](../LICENSE.md).