EIPs Explained

ERC-2193 · Stagnant · ERC · 2019-07-16

ERC-2193: dType Alias Extension - Decentralized Type System

Proposes human-readable aliases such as [email protected] for any on-chain data record, built on the dType type registry rather than DNS-style names.

What problem does it solve?

ENS (EIP-137) gives human-readable names to accounts and contracts, but not to individual pieces of data inside a contract, such as one user's profile or one payment channel. ENS also uses DNS's leaf-to-root order (sub.domain.eth), the opposite of how a dot works in most programming languages.

ERC-2193 proposes an Alias registry that names any record stored through the dType system (ERC-1900 for type definitions, ERC-2157 for storage contracts), using separators that carry meaning.

How it works

  • An alias combines a dType type identifier, a separator, a name, and the identifier of the record in that type's storage contract.
  • Separators and their reading order:
Separator Meaning Example
. general domain, root to leaf domain.subdomain.resource
@ actor-related data, leaf to root [email protected]
# concepts, root to leaf topicX#postY
/ resource path, root to leaf resourceRoot/resource
  • Anyone may set an alias if they own the underlying record in the dType storage contract. They prove this with a signature over the type id, identifier, name, separator, a nonce, the Alias contract address and the chain id (EIP-155), which prevents replays.
  • Owners can update or delete aliases. A record can have several aliases with different names or separators.
  • Content can be addressed either by raw bytes32 identifiers or by the human alias; both resolve to the same record.

Sample code

The interface from the spec:

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface Alias {
    event AliasSet(bytes32 dtypeIdentifier, bytes1 separator, string name, bytes32 indexed identifier);

    function setAlias(
        bytes32 dtypeIdentifier,
        bytes1 separator,
        string memory name,
        bytes32 identifier,
        bytes memory signature
    ) external;

    function getAliased(bytes1 separator, string memory name) external view returns (bytes32 identifier);
}

Resolving an alias from a script (ethers v6):

const id = await aliasRegistry.getAliased("0x40", "alice"); // "@" separator

Things to know

  • Status: Stagnant, as are the dType proposals it depends on (ERC-1900, ERC-2157).
  • The exact signature encoding, backwards compatibility and test cases are not specified ("will be added").
  • It only works for data stored in dType-linked contracts; it is not a general replacement for ENS in practice.

#naming #alias #registry #dtype

Details

Authors
Loredana Cirstea (@loredanacirstea), Christian Tzurcanu (@ctzurcanu)
Status
Stagnant
Type
Standards Track / ERC
Created
2019-07-16
Requires

Machine-readable: Markdown · JSON