An Ethereum Name Service command-line tool
The Ethereum Name Service (ENS) maps easy to remember (and type) domain names such as ‘orinocopay.eth’ to Ethereum addresses such as ‘0x1234567890abcdef1234567890abcdef12345678’. Domains can be registered with ENS through an auction process, and once owned a user can associate the domain with an address.
Something that ENS has been missing is command-line tools to allow access to its features and functions without having to write your own code. As part of Orinoco’s work on payment channels we required a Go library to handle ENS functions, and have added a command-line frontend to it for general purpose use.
Some nice features of the tool are:
- written in Go, so compiles to a simple static binary
- does not require a local Ethereum node
- uses the geth-style keystore for ease of integration with existing tools
- uses Orinoco’s value parsing library to allow for bids such as “0.05 ether” and gas prices such as “1gwei”
- accepts ENS domains and resolves addresses to domains wherever useful
To install it:
$ go get github.com/orinocopay/ens
Using the tool is straightforward. To provide general information about a domain:
$ ens info orinocopay.eth
Owned since 2017-06-27 18:43:31 +0100 BST
Locked value is 0.01 Ether
Highest bid was 0.121 Ether
Deed owner is orinocopay.eth (0xa34c6bcae6f46ac6470443ccea67d937f6060c7e)
Address owner is orinocopay.eth (0xa34c6bcae6f46ac6470443ccea67d937f6060c7e)
Resolver is 0x5ffc014343cd971b7eb70732021e26c35b744cc4
Domain resolves to 0xa34c6bcae6f46ac6470443ccea67d937f6060c7e
Address resolves to orinocopay.eth
ens
also provides more specific commands where the output can be used easily by other tools. For example, to obtain the address for a domain:
$ ens address orinocopay.eth
0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1
Setting the address for a domain is nearly as easy, only requiring the passphrase to unlock the account that owns the domain and the address to which the domain should resolve:
$ ens address set --address=0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --passphrase='my secret phrase' orinocopay.eth
Note that ens
expects you to have a local keystore, but it does not need you to be running a local Ethereum node. You can manage your local keystore with geth
or similar tools.
ENS supports the idea of reverse resolution, where an address can be resolved to a domain. ens
allows you to obtain this information:
$ ens name 0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1
orinocopay.eth
Starting an auction for an address is equally simple:
$ ens auction start --address=0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1 --passphrase='my secret phrase' --bid='0.5 ether' --salt='my secret salt' mywantedname.eth
and other commands such as ens auction reveal
and ens auction finish
have the expected effect. ens auction help
provides details of the commands available when participating in an auction.
The tool’s Github repository is at https://github.com/orinocopay/ens where the source code and issues list can be found.
Some useful hints when using this tool:
- you can change the gas price of your transactions with the
--gasprice
option - you can log your state-changing activities with the
--log
option (handy if you are prone to forget the domain you were bidding on or the salt that you used for a bid) - you can use a local Ethereum node rather than the default node with
--connection=~/.ethereum/geth.rpc
or equivalent. For testing on Ropsten add the option--connection=https://ropsten.orinocopay.com:8546/
It should be noted that this software is relatively new and although it has been tested and is in use to secure and manage a number of domains there are no guarantees that it’s totally bug-free. It is suggested that you use it from an account with limited ether and monitor the generated transactions manually until you are comfortable with how it operates.
Feedback on the tool is welcome. Any issues found with the tool can be reported at the relevant Github issues list.