Resolving Names On Chain
ETHW ID resolution is straightforward enough it can be done trivially without a library. First, we define some pared-down interfaces containing only the methods we need:
For resolution, only the resolver
function in the ETHW ID contract is required; other methods permit looking up owners and updating ETHW ID from within a contract that owns a name.
With these definitions, looking up a name given its node hash is straightforward:
While it is possible for a contract to process a human-readable name into a node hash, we highly recommend working with node hashes instead, as they are easier and more efficient to work with, and allow contracts to leave the complex work of normalizing the name to their callers outside the blockchain. Where a contract always resolves the same names, those names may be converted to a node hash and stored in the contract as a constant.
Last updated