Is it possible to use a ENS name as an address in solidity, instead of having to use the usual long address?


address public _address = myname.eth;

It is... but it isn't...

You can't do it like you present above, but you could call the ENS contract to get the resolver contract address, then call the resolver contract to get the name's contract address...

This would cost a bit of gas though, so you're probably best just looking up the address and entering it in directly; unless of course you need it to be continuously up to date with the current live address.

Not the answer you're looking for? Browse other questions tagged or ask your own question.