Support ENS Name for Web3 URL
The ERC-6821 proposal defines the mapping from an Ethereum name service (ENS) name to an Ethereum address for ERC-4804, specifically for the web3://-scheme RFC 2396 URI to call a smart contract either by its address or a name from name service. It specifies a way to resolve the contract address from the name by finding the contentcontract text record on ENS resolver on the specified chain, and if it does not exist, using the resolved address of name from ERC-137.
This standard defines the mapping from an Ethereum name service (ENS) name to an Ethereum address for ERC-4804.
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.
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:
- Find the
contentcontracttext 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.
- If the
contentcontracttext record does not exist, the protocol will use the resolved address of name from ERC-137.
- If the resolved address of name is the zero address, then return an "address not found" error.
contentcontract text record may return an Ethereum address in hexadecimal with a
0x prefix or an ERC-3770 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.
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).
No security considerations were found.
Copyright and related rights waived via CC0.
Adopted by projects
Not miss a beat of EIPs' update?
Subscribe EIPs Fun to receive the latest updates of EIPs Good for Buidlers to follow up.View all