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) |
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
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
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
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
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
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
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
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)
name(bytes32 node) view returns (string memory)
- Interface ID:
0x691f3431
Parameters
- node (bytes32): The ENS node to query.
Returns
- string: The associated name.
Write Ethereum Address
setAddr(bytes32 node, address a)
event AddrChanged(bytes32 indexed node, address a);
- Interface ID:
0xd5fa2b00
Parameters
- node (bytes32): The ENS node to update.
- a (address): The Ethereum address to set.
Set Multicoin Address
setAddr(bytes32 node, uint256 coinType, bytes calldata a)
event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);
- 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
setContenthash(bytes32 node, bytes calldata hash)
event ContenthashChanged(bytes32 indexed node, bytes hash);
- Interface ID:
0x304e6ade
Parameters
- node (bytes32): The ENS node to update.
- hash (bytes): The contenthash to set.
Write Text Record
setText(bytes32 node, string calldata key, string calldata value)
event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);
- 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
setABI(bytes32 node, uint256 contentType, bytes calldata data)
event ABIChanged(bytes32 indexed node, uint256 indexed contentType);
- 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
setPubkey(bytes32 node, bytes32 x, bytes32 y)
event PubkeyChanged(bytes32 indexed node, bytes32 x, bytes32 y);
- 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)
setName(bytes32 node, string calldata name)
event NameChanged(bytes32 indexed node, string name);
- Interface ID:
0x77372213
Parameters
- node (bytes32): The ENS node to update.
- name (string): The associated name.
Batch Read/Write
multicall(bytes[] calldata data) view returns (bytes[] memory results)
- 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
So the input parameters would be:
- node:
0x6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
- key:
key1
- value:
value1
0x10f13a8c
6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
0000000000000000000000000000000000000000000000000000000000000060
00000000000000000000000000000000000000000000000000000000000000a0
0000000000000000000000000000000000000000000000000000000000000004
6b65793100000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000006
76616c7565310000000000000000000000000000000000000000000000000000
0x10f13a8c
6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
0000000000000000000000000000000000000000000000000000000000000060
00000000000000000000000000000000000000000000000000000000000000a0
0000000000000000000000000000000000000000000000000000000000000004
6b65793200000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000006
76616c7565320000000000000000000000000000000000000000000000000000
bytes[]
input parameter.The full ABI-encoded multicall call would therefore be (with proper padding):
0xac9650d8
0000000000000000000000000000000000000000000000000000000000000020
0000000000000000000000000000000000000000000000000000000000000002
0000000000000000000000000000000000000000000000000000000000000040
0000000000000000000000000000000000000000000000000000000000000160
00000000000000000000000000000000000000000000000000000000000000e4
10f13a8c
6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
0000000000000000000000000000000000000000000000000000000000000060
00000000000000000000000000000000000000000000000000000000000000a0
0000000000000000000000000000000000000000000000000000000000000004
6b65793100000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000006
76616c7565310000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000000000e4
10f13a8c
6cbc8d00d20a89e588f430e62b937a6402557bf0bc2127fb1378457331aa463d
0000000000000000000000000000000000000000000000000000000000000060
00000000000000000000000000000000000000000000000000000000000000a0
0000000000000000000000000000000000000000000000000000000000000004
6b65793200000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000006
76616c7565320000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000