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 EIP: Support ENS Name for Web3 URL #6821

Merged
merged 13 commits into from
May 5, 2023
42 changes: 42 additions & 0 deletions EIPS/eip-6821.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
eip: 6821
title: Support ENS Name for Web3 URL
description: A mapping from an ENS name to the contract address in Web3 URL
author: Qi Zhou (@qizhou), Qiang Zhu (@qzhodl)
discussions-to: https://ethereum-magicians.org/t/eip-6821-support-ens-name-for-web3-url/13654
status: Draft
type: Standards Track
category: ERC
created: 2023-04-02
requires: 137, 634, 3770, 4804
---

## Abstract

This standard defines the mapping from an Ethereum name service (ENS) name to an Ethereum address for [ERC-4804](./eip-4804.md).

## Motivation

ERC-4804 defines a `web3://`-scheme RFC 2396 URI to call a smart contract either by its address or a **name** from name service. If a **name** is specified, the standard specifies a way to resolve the contract address from the name.

## Specification

Given **contractName** and **chainid** from a `web3://` URI defined in ERC-4804, the protocol will find the address of the contract using the following steps:

1. Find the `contentcontract` text record on ENS resolver on chain **chainid**. Return an error if the chain does not have ENS or the record is an invalid ETH address.
2. If the `contentcontract` text record does not exist, the protocol will use the resolved address of **name** from [ERC-137](./eip-137.md#contract-address-interface).
3. If the resolved address of **name** is the zero address, then return an "address not found" error.

Note that `contentcontract` text record may return an Ethereum address in hexadecimal with a `0x` prefix or an [ERC-3770](./eip-3770.md) chain-specific address. If the address is an ERC-3770 chain-specific address, then the **chainid** to call the message will be overridden by the **chainid** specified by the ERC-3770 address.

## Rationale

The standard uses `contentcontract` text record with ERC-3770 chain-specific address instead of `contenthash` so that the record is human-readable - a design principle of ERC-4804. Further, we can use the text record to add additional fields such as time to live (TTL).

## Security Considerations

No security considerations were found.

## Copyright

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