Resolver Interface Standards
This page is a collection of methods that a resolver MAY implement.
Usage | Function Definition |
---|---|
Check Interface Support | supportsInterface(bytes4 interfaceID) external pure returns (bool) |
Read Ethereum Address | addr(bytes32 node) view returns (address) |
Read Multicoin Address | addr(bytes32 node, uint coinType) view returns (bytes memory) |
Read Content Hash | contenthash(bytes32 node) view returns (bytes memory) |
Read Text Record | text(bytes32 node, string key) view returns (string memory) |
Read Contract ABI | ABI(bytes32 node, uint256 contentTypes) view returns (uint256, bytes memory) |
Read Public Key | pubkey(bytes32 node) view returns (bytes32 x, bytes32 y) |
Read Name (for reverse records) | name(bytes32 node) view returns (string memory) |
Wildcard Resolution | resolve(bytes memory name, bytes memory data) view returns (bytes memory) |
Write Ethereum Address | setAddr(bytes32 node, address a) |
Set Multicoin Address | setAddr(bytes32 node, uint256 coinType, bytes calldata a) |
Write Content Hash | setContenthash(bytes32 node, bytes calldata hash) |
Write Text Record | setText(bytes32 node, string calldata key, string calldata value) |
Write Contract ABI | setABI(bytes32 node, uint256 contentType, bytes calldata data) |
Write Public Key | setPubkey(bytes32 node, bytes32 x, bytes32 y) |
Write Name (for reverse records) | setName(bytes32 node, string calldata name) |
Batch Read/Write | multicall(bytes[] calldata data) view returns (bytes[] memory results) |
Check Interface Support
Function
supportsInterface(bytes4 interfaceID) external pure returns (bool)
- Interface ID:
0x01ffc9a7
Parameters
- interfaceID (bytes4): The interface identifier, as specified in ERC-165
Returns
- bool: True if the contract supports the specified interface.
Read Ethereum Address
Function
addr(bytes32 node) view returns (address)
- Interface ID:
0x3b3b57de
Parameters
- node (bytes32): The ENS node to query.
Returns
- address: Ethereum address or the zero address if no address is set.
Read Multicoin Address
Function
addr(bytes32 node, uint coinType) view returns (bytes memory)
- Interface ID:
0xf1cb7e06
Parameters
- node (bytes32): The ENS node to query.
- coinType (uint): The ENSIP-9 coin type to query.
Returns
- bytes: Cryptocurrency address in its native binary format. For example, the Bitcoin address
1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
base58check decodes to the 21 bytes0062e907b15cbf27d5425399ebf6f0fb50ebb88f18
then scriptPubkey encodes to 25 bytes76a91462e907b15cbf27d5425399ebf6f0fb50ebb88f1888ac
whereas the BNB addressbnb1grpf0955h0ykzq3ar5nmum7y6gdfl6lxfn46h2
Bech32 decodes to the binary representation40c2979694bbc961023d1d27be6fc4d21a9febe6
. A zero-length string ("") will be returned if the specified coin type is not set.
Read Content Hash
Function
contenthash(bytes32 node) view returns (bytes memory)
- Interface ID:
0xbc1c58d1
Parameters
- node (bytes32): The ENS node to query.
Returns
- bytes: The contenthash set for the name, encoded in binary format.
Read Text Record
Function
text(bytes32 node, string key) view returns (string memory)
- Interface ID:
0x59d1d43c
Parameters
- node (bytes32): The ENS node to query.
- key (string): The text data key to query.
Returns
- string: The value of the text record associated with key, or the empty string if no such record exists.
Read Contract ABI
Function
ABI(bytes32 node, uint256 contentTypes) view returns (uint256, bytes memory)
- Interface ID:
0x2203ab56
Parameters
- node (bytes32): The ENS node to query.
- contentTypes (uint256): A bitwise OR of the ABI formats accepted by the caller.
Returns
- (uint256, bytes): ABI returns a two-tuple of the content type ID and the ABI data. If no data of the appropriate content type ID was found, 0 is returned for the content type ID, and the ABI data will be the empty string.
Read Public Key
Function
pubkey(bytes32 node) view returns (bytes32 x, bytes32 y)
- Interface ID:
0xc8690233
Parameters
- node (bytes32): The ENS node to query.
Returns
- (bytes32, bytes32): The ECDSA SECP256k1 public key for node, as a 2-tuple (x, y). If no public key is set, (0, 0) is returned.
Read Name (for reverse records)
Function
name(bytes32 node) view returns (string memory)
Implemented by Public Resolver
- Interface ID:
0x691f3431
Parameters
- node (bytes32): The ENS node to query.
Returns
- string: The associated name.
Wildcard Resolution
Function
resolve(bytes memory name, bytes memory data) view returns (bytes memory)
- Interface ID:
0x9061b923
Parameters
- name (bytes): DNS-encoded name
- data (bytes): Encoded function data for other resolver calls like addr(), text(), etc.
Write Ethereum Address
Function
setAddr(bytes32 node, address a)
Emitted events
event AddrChanged(bytes32 indexed node, address a);
Implemented by Public Resolver
- Interface ID:
0xd5fa2b00
Parameters
- node (bytes32): The ENS node to update.
- a (address): The Ethereum address to set.
Set Multicoin Address
Function
setAddr(bytes32 node, uint256 coinType, bytes calldata a)
Emitted events
event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);
Implemented by Public Resolver
- Interface ID:
0x8b95dd71
Parameters
- node (bytes32): The ENS node to update.
- coinType (uint256): The ENSIP-9 coin type to update.
- a (bytes): The address to set.
Write Content Hash
Function
setContenthash(bytes32 node, bytes calldata hash)
Emitted events
event ContenthashChanged(bytes32 indexed node, bytes hash);
Implemented by Public Resolver
- Interface ID:
0x304e6ade
Parameters
- node (bytes32): The ENS node to update.
- hash (bytes): The contenthash to set.
Write Text Record
Function
setText(bytes32 node, string calldata key, string calldata value)
Emitted events
event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);
Implemented by Public Resolver
- Interface ID:
0x10f13a8c
Parameters
- node (bytes32): The ENS node to update.
- key (string): The key to set.
- value (string): The text data value to set.
Write Contract ABI
Function
setABI(bytes32 node, uint256 contentType, bytes calldata data)
Emitted events
event ABIChanged(bytes32 indexed node, uint256 indexed contentType);
Implemented by Public Resolver
- Interface ID:
0x623195b0
Parameters
- node (bytes32): The ENS node to update.
- contentType (uint256): The content type of the ABI.
- data (bytes): The ABI data.
Write Public Key
Function
setPubkey(bytes32 node, bytes32 x, bytes32 y)
Emitted events
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);
Implemented by Public Resolver
- Interface ID:
0x29cd62ea
Parameters
- node (bytes32): The ENS node to update.
- x (bytes32): The X coordinate of the curve point for the public key.
- y (bytes32): The Y coordinate of the curve point for the public key.
Write Name (for reverse records)
Function
setName(bytes32 node, string calldata name)
Emitted events
event NameChanged(bytes32 indexed node, string name);
Implemented by Public Resolver
- Interface ID:
0x77372213
Parameters
- node (bytes32): The ENS node to update.
- name (string): The associated name.
Batch Read/Write
Function
multicall(bytes[] calldata data) view returns (bytes[] memory results)
Implemented by Public Resolver
- Interface ID:
0xac9650d8
Parameters
- data (bytes[]): An array of ABI-encoded resolver function calls.
Returns
- results (bytes[]): An array of data for each resolver call result.
Examples
Set two different text records:
- name: myname.eth
- key1: value1
- key2: value2
The corresponding function call is: setText(bytes32 node, string calldata key, string calldata value)
.
So the input parameters would be:
- node:
0x6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
- key:
key1
- value:
value1
Therefore the ABI-encoded call (for key1/value1) would be:
0x10f13a8c6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000046b65793100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000676616c7565310000000000000000000000000000000000000000000000000000
The second the ABI-encoded call (for key2/value2) would be very similar:
0x10f13a8c6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000046b65793200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000676616c7565320000000000000000000000000000000000000000000000000000
Both of those byte arrays would be passed into the two-dimensional bytes[]
input parameter.
The full ABI-encoded multicall call would therefore be:
0xac9650d8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000000e410f13a8c6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000046b65793100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000676616c75653100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e410f13a8c6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000046b65793200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000676616c756532000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000