These are the steps to resolve a .IP domain to an Ethereum address:
- Convert the name string to a name hash using the normalizer.
- Query the EBPTO registry for resolver contract for the hash.
- Query the resolver contract for the address.
Here is some example Solidity code that implements these steps for resolving a name string to an address:
interface EBPTO {
function resolver(bytes32 node) external view returns (Resolver);
}
interface Resolver {
function addr(bytes32 node) external view returns (address);
}
interface Normalize4 {
function normhash(string memory) external view returns (bytes32 node);
}
contract NameToAddressDemo {
EBPTO registry = EBPTO(0xDd0Bc20FB93E3033C9282E322f897fC2997F7f92);
Normalize4 normalizer = Normalize4(0x4D6F2f6f6dd9F48251657D6FAE53fea73c3f1E60);
function resolve(string memory name) public view returns (address) {
bytes32 node = normalizer.normhash(name);
Resolver resolver = registry.resolver(node);
return resolver.addr(node);
}
}