惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
WordPress大学
WordPress大学
博客园 - 【当耐特】
The Cloudflare Blog
B
Blog
Last Week in AI
Last Week in AI
小众软件
小众软件
量子位
S
SegmentFault 最新的问题
V
Visual Studio Blog
博客园 - 叶小钗
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
Hugging Face - Blog
Hugging Face - Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
宝玉的分享
宝玉的分享
A
About on SuperTechFans
雷峰网
雷峰网
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
MongoDB | Blog
MongoDB | Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Martin Fowler
Martin Fowler

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
ENS Resolver CLI — Look Up Any ENS Name from Your Terminal
neuralmint · 2026-05-27 · via DEV Community

So you want to know what Ethereum address is behind an ENS name like vitalik.eth? Or maybe you got an address and need to find its ENS name? Say hello to ens_resolver — a single-file Python CLI that does exactly that, with zero pip dependencies.

What It Does

ens_resolver is a lightweight CLI tool that talks directly to the Ethereum network via a public JSON-RPC endpoint. It implements the ENS specification (EIP-137) from scratch — namehash algorithm, ABI encoding, and all.

Two subcommands:

python3 ens_resolver.py resolve vitalik.eth
vitalik.eth  →  0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

python3 ens_resolver.py reverse 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045
0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045  →  vitalik.eth

Enter fullscreen mode Exit fullscreen mode

Need machine-readable output? Add --json:

python3 ens_resolver.py --json resolve nick.eth
{"name": "nick.eth", "address": "0xb8c2C29ee19D8307cb7255e1Cd9CbDE883A267d5"}

Enter fullscreen mode Exit fullscreen mode

How It Works

Under the hood, ens_resolver:

  1. Computes the namehash of the ENS name (the recursive hash defined in EIP-137)
  2. Calls resolver() on the ENS registry contract (0x0000...d2e1e) to get the resolver address
  3. Calls addr() on the resolver to get the resolved wallet address

For reverse lookups, it follows the *.addr.reverse pattern:

  1. Reverses the address into 0x...addr.reverse
  2. Computes the namehash
  3. Gets the resolver and calls name(bytes32) to read the ENS name

Why Not Just Use Etherscan?

  • No browser needed — works from a terminal, SSH session, or CI pipeline
  • Scriptable — JSON output for piping into other tools
  • Lightweight — single file, pure Python
  • Fast — direct JSON-RPC calls, no page loads

Tech Stack

  • Python 3 (stdlib: argparse, urllib, json, re)
  • pycryptodomex for Keccak-256 hashing (Ethereum-compatible, distinct from SHA3)
  • Public Ethereum JSON-RPC endpoint (configurable via ENS_RPC_URL env var)

The ENS resolution is implemented from scratch using the actual smart contract ABI — function selectors, ABI encoding, and response decoding are all done manually with Python stdlib.

Install

No pip install nonsense for the tool itself — just grab the file:

curl -L https://raw.githubusercontent.com/neuralmint/ens-resolver-cli/main/ens_resolver.py -o ens_resolver.py
pip3 install pycryptodomex  # only dep, for Keccak-256 hashing
chmod +x ens_resolver.py
python3 ens_resolver.py --help

Enter fullscreen mode Exit fullscreen mode

Or clone the repo:

git clone https://github.com/neuralmint/ens-resolver-cli.git
cd ens-resolver-cli
python3 ens_resolver.py resolve vitalik.eth

Enter fullscreen mode Exit fullscreen mode

Use Cases

  • Scripting — batch-resolve a list of ENS names from a file
  • Monitoring — check if a name resolves to the expected address
  • Portfolio tools — map ENS names to addresses for balance checks
  • Reverse lookups — find the ENS name behind any Ethereum address

Support

If this tool saves you time, consider tossing a tip:

SOL: 4TGyiYBjaYhFFPNYyCoJjf16ctUsWVBiMR1FXQxEfhWi

ETH: 0xe07f177E0725c11EEc8BeA34C5b5193CaF2a1A6a


Built with Python. MIT licensed. Part of the neuralmint CLI Tools series.