ERC-7406: Multi-Namespace Onchain Registry

An universally accepted multi-namespace registry with mapping structures on the Ethereum


Metadata
Status: DraftStandards Track: ERCCreated: 2023-07-23
Authors
Mengshi Zhang (@MengshiZhang), Zihao Chen (@zihaoccc)
Requires

Abstract


This EIP proposes a universally accepted description for onchain registry entries with support for multi-namespaces, where each entry is structured as a mapping type. The multi-namespace registry enables the storage of a collection of key-value mappings within the blockchain, serving as a definitive source of information with a traceable history of changes. These mapping records act as pointers combined with onchain assets, offering enhanced versatility in various use cases by encapsulating extensive details. The proposed solution introduces a general mapping data structure that is flexible enough to support and be compatible with different situations, providing a more scalable and powerful alternative to current ENS-like registries.

Motivation


Blockchain-based registries are fundamental components for decentralized applications, enabling the storage and retrieval of essential information. Existing solutions, like the ENS registry, serve specific use cases but may lack the necessary flexibility to accommodate more complex scenarios. The need for a more general mapping data structure with multi-namespace support arises to empower developers with a single registry capable of handling diverse use cases efficiently.

The proposed multi-namespace registry offers several key advantages:

  • Versatility: Developers can define and manage multiple namespaces, each with its distinct set of keys, allowing for more granular control and organization of data. For instance, single same key can derive as different pointers to various values based on difference namespaces, which a namespace can be specified as a session type, if this registry stores sessions, or short URL -> full URL mapping is registry stores such type of data.
  • Traceable History: By leveraging multi-namespace capabilities, the registry can support entry versioning by using multi-namespace distinct as version number, enabling tracking of data change history, reverting data, or data tombstoning. This facilitates data management and governance within a single contract.
  • Enhanced Compatibility: The proposed structure is designed to be compatible with various use cases beyond the scope of traditional ENS-like registries, promoting its adoption in diverse decentralized applications.

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.

Registry specification

The multi namespace registry contract exposes the following functions:


  • Returns the owner of the specified key under the given namespace.

  • Returns the resolver address for the specified key under the given namespace.

  • Transfers ownership of the key under the specified namespace to another owner. This function may only be called by the current owner of the key under a specific namespace. The same key under different namespaces may have different owners. A successful call to this function logs the event Transfer(bytes32 namespace, bytes32 key, address newOwner).

  • Create a new namespace such as a new version or a new type of protocol in current registry. A successful call to this function logs the event NewNamespace(bytes32 namespace).

  • Sets the resolver address for the key under the given namespace. This function may only be called by the owner of the key under a specific namespace. The same key under different namespaces may have different resolvers. A successful call to this function logs the event NewResolver(bytes32 namespace, bytes32 key, address newResolver).

Resolver specification

The multi-namespace resolver contract can utilize the same specification as defined in ERC-137.

Rationale


By supporting multiple namespaces, the registry caters to various use cases, including but not limited to identity management, session management, record tracking, and decentralized content publishing. This flexibility enables developers to design and implement more complex decentralized applications with ease.

Backwards Compatibility


As this EIP introduces a new feature and does not modify any existing behaviors, there are no backwards compatibility issues.

Reference Implementation


Appendix A: Registry Implementation


Security Considerations


The proposed multi-namespace registry introduces several security considerations due to its ability to manage various namespaces and access controls. Thorough testing, auditing, and peer reviews will be conducted to identify and mitigate potential attack vectors and vulnerabilities. Security-conscious developers are encouraged to contribute to the audit process.

Copyright


Copyright and related rights waived via CC0.