Link to this headingENS (Ethereum Name Service)
This is a smart contract that provides a way to map names to an address.
Resolve a Name to an Account:
# optional, for convenience (pip install ens)
# ---- Connect to Ethereum ----
=
=
# ---- ENS Registry Address & ABI ----
=
=
# ---- Resolver ABI ----
=
# ---- Helper: Namehash algorithm ----
"""
ENS namehash implementation in Python.
"""
= b * 32
=
=
return
# ---- Main lookup ----
=
# Step 1: Get resolver from ENS Registry
=
=
=
# Step 2: Query resolver for address
=
=
# vitalik.eth is converted to ee6c4522aab0003e8d14cd40a6af439055fd2577951148c14b6cea9a53475835
# resolver<0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e>(node_name) -> eth_address
# vitalik.eth resolves to: 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045