What Is ENS EIP-1155 and Why Does It Matter?
ENS EIP-1155 refers to the integration of the Ethereum Naming Service (ENS) with the ERC-1155 token standard. While ENS has traditionally relied on ERC-721 (NFT) tokens to represent domain ownership, EIP-1155 introduces a multi-token model that allows a single smart contract to manage multiple domain types, subnames, and metadata variations. This is particularly relevant for advanced use cases such as issuing subdomains, renting names, or managing bulk registrations.
The core advantage lies in gas efficiency and composability. ERC-1155 supports both fungible and non-fungible tokens within one contract, reducing deployment and transaction costs. For ENS, this means you can create a registry where a parent domain (e.g., example.eth) can issue thousands of subnames as distinct tokens without deploying separate contracts for each. This is critical for enterprises, DAOs, and developers building on-chain identity systems. If you are exploring this architecture, you can the official ens app by examining the reference implementations available on testnets.
From a technical standpoint, EIP-1155 also enables batch transfers and atomic swaps. For example, a registrar could transfer an entire portfolio of subdomains in a single transaction. The standard integrates with existing ENS resolvers via the setTokenURI function, allowing off-chain metadata (like avatar images or profile data) to be stored efficiently. However, the transition from ERC-721 to ERC-1155 is not automatic—it requires resolver upgrades and careful handling of ownership records.
How Does ENS EIP-1155 Differ from Standard ENS (ERC-721)?
The primary difference is token granularity. Standard ENS uses ERC-721, where each domain is a unique, non-fungible token with its own contract address. This works well for simple ownership but becomes expensive and complex when managing hierarchical names like sub.example.eth. EIP-1155, by contrast, allows a single contract to represent many tokens, identified by an id field, where the id can encode the domain hash and subname path.
Concrete differences include:
- Gas costs: Deploying one ERC-1155 contract costs ~500k gas versus deploying separate ERC-721 contracts per domain tier (which could run millions).
- Batch operations: With ERC-1155, you can transfer multiple subnames, metadata updates, or approvals in one call. ERC-721 requires a loop of single transactions.
- Metadata management: ERC-1155 uses a single
uri()function with anidparameter, while ERC-721 often requires separate token URI storage per domain. - Interoperability: ERC-1155 tokens are recognized by wallets and marketplaces that support the standard, but some ENS-specific platforms (like the ENS Manager App) may not yet fully parse the token ID structure.
For users migrating from standard ENS, the most noticeable change is in wallet integration. For instance, if you hold subnames under an ERC-1155 registry, they may appear as "collection items" rather than individual NFTs. If you are using a multi-chain setup, ensure your wallet supports viewing and interacting with ERC-1155 tokens—specifically, the ENS coinbase wallet integration handles this by mapping token IDs to domain names via a resolver.
Common Technical Questions About ENS EIP-1155
1. Can I Mint Subnames Using EIP-1155 Without a Resolver?
No. Even with EIP-1155, an ENS resolver is required to translate the token ID (which represents the domain hash) into a readable name and record set. The resolver must implement the supportsInterface(bytes4 interfaceID) function to return true for the ERC-1155 metadata interface (0xd9b67a26). Without this, wallets and dapps cannot fetch the domain name or associated records (e.g., ETH address, content hash).
2. How Do I Compute the Token ID for a Subname Like "pay.example.eth"?
The token ID is typically the uint256 representation of the namehash of the full domain (e.g., namehash("pay.example.eth")). This ensures deterministic ID generation. For example:
- Namehash of
"pay.example.eth"=0x1234...5678 - Token ID =
uint256(0x1234...5678)
You can compute this using ethers.utils.namehash in JavaScript. The registry contract stores the balance of each token ID (per owner) using the ERC-1155 balanceOf function.
3. Does EIP-1155 Support Renting or Expiration of Subnames?
Yes, but it requires additional logic. The ERC-1155 standard itself does not enforce time-based ownership. To implement rental periods or expiration, you need a wrapper contract that checks timestamps before allowing transfers or record updates. One pattern is to use an ERC-1155 "rental token" that burns after a set block number. The ENS registry's setSubnodeRecord function can then be called only by the valid token holder.
4. Are There Security Risks When Mixing ERC-1155 with ENS Resolvers?
Yes. The primary risk is incorrect mapping of token IDs to domain names. An attacker could mint a token with a crafted id that resembles a legitimate subname (e.g., using an ID that decodes to pay.example.eth but points to a different resolver). Mitigations include:
- Always verifying that the token ID equals the namehash of the claimed domain.
- Using a resolver that checks the registry's owner mapping before returning records.
- Auditing the ERC-1155 contract to ensure
_mintcannot be called with arbitraryidvalues.
How to Integrate ENS EIP-1155 with Existing Wallets and Dapps
Integration requires updates to three layers: the token contract, the ENS resolver, and the frontend interface. Here is a step-by-step breakdown:
- Token contract: Deploy an ERC-1155 contract that implements
_mintwith thebytes dataparameter for the resolver address. Alternatively, use a factory pattern to link each token ID to a specific resolver. - Resolver: Modify the ENS resolver (e.g.,
PublicResolver.sol) to accept anuint256 tokenIdinstead ofbytes32 nodein its lookup functions. This may require forking the official resolver to add a mapping fromtokenIdtonode. - Frontend: Use libraries like
ethers.jsorweb3.jswith the ERC-1155 ABI. CallbalanceOf(owner, tokenId)to check ownership, anduri(tokenId)to fetch metadata. For name resolution, pass thetokenIdto the resolver'saddrfunction.
A practical example: Suppose you manage a DAO that issues member.dao.eth subnames. Using EIP-1155, you can mint 1,000 tokens with IDs corresponding to member1.dao.eth, member2.dao.eth, etc., in a single transaction. Each token's metadata URL points to a JSON file stored on IPFS, containing the member's ENS records. The resolver then maps the token ID back to the namehash for reverse resolution.
For wallets, compatibility varies. MetaMask supports ERC-1155 via its custom token import, but will display the token ID as a number. To show the human-readable domain name, the wallet must call the resolver's name(tokenId) function. The ENS coinbase wallet already implements this logic by resolving ERC-1155 token IDs through a dedicated ENS resolver endpoint. Users can view subnames as clickable links within the interface.
Tradeoffs: When Should You NOT Use ENS EIP-1155?
While EIP-1155 is powerful, it is not always the right choice. Avoid it in these scenarios:
- Single-domain ownership: If you only own one or two ENS domains, the complexity of ERC-1155 outweighs benefits. Stick to ERC-721.
- Legacy integrations: Many ENS-aware applications (e.g., etherscan domain lookups) were built for ERC-721. They may not parse ERC-1155 token IDs correctly.
- Metadata flexibility: ERC-1155 uses a single
uri()function with a template ({id}parameter). If you need per-token custom metadata without an off-chain server, ERC-721 is simpler. - Regulatory compliance: If your ENS use case requires revocable or upgradable tokens, ERC-1155's immutable supply may conflict. Consider ERC-1155 with a burnable extension.
In summary, ENS EIP-1155 offers a scalable, gas-efficient path for managing hierarchical domain names, but demands careful resolver design and wallet compatibility testing. For most individual users, standard ENS remains the safer choice. For developers building identity systems or domain marketplaces, the tradeoff is worth examining through a testnet deployment before mainnet migration.