etherscan

Query EVM chain data via Etherscan API v2. Use for on-chain lookups where Etherscan v2 applies: balances, transactions, token transfers (ERC-20/721/1155), contract source/ABI, gas prices, event logs, and verification of transaction completion. Also trigger when another tool submits a transaction and you need to confirm it finalized on-chain.

3,891 stars
Complexity: easy

About this skill

This skill allows an AI agent to interact with the Etherscan API v2 to retrieve comprehensive data from various EVM-compatible blockchains. It facilitates on-chain data queries for a wide range of use cases, from checking cryptocurrency balances and transaction histories to inspecting smart contract source code and ABIs. Developers, blockchain analysts, and users of decentralized applications can leverage this skill to gain real-time insights into blockchain activities and confirm the finalization of transactions. The skill is designed to prevent common errors by requiring dynamic chain list fetching and careful selection of API modules/actions. It handles API key management, prioritizing credential files and environment variables, and guides the agent to prompt the user if needed. This ensures reliable and accurate data retrieval without hardcoding potentially outdated chain information.

Best use case

The primary use case is providing AI agents with the capability to accurately and efficiently fetch real-time blockchain data for EVM chains. This benefits developers building dApps, cryptocurrency analysts tracking market movements and contract interactions, and any user who needs to verify on-chain activity or understand the state of a smart contract or wallet. It streamlines the process of obtaining verified blockchain information directly from Etherscan's reliable API.

Query EVM chain data via Etherscan API v2. Use for on-chain lookups where Etherscan v2 applies: balances, transactions, token transfers (ERC-20/721/1155), contract source/ABI, gas prices, event logs, and verification of transaction completion. Also trigger when another tool submits a transaction and you need to confirm it finalized on-chain.

The user receives accurate, up-to-date blockchain data from Etherscan for specified EVM chains and addresses, or confirmation of transaction finalization.

Practical example

Example input

What is the current ETH balance of address 0x... on Ethereum mainnet?

Example output

The address 0x... has 1.23 ETH on Ethereum Mainnet. Transaction hash 0x... has been successfully confirmed on Polygon.

When to use this skill

  • To check the balance of any wallet address on an EVM chain.
  • To verify the status and details of a transaction on-chain.
  • To retrieve contract source code, ABI, or track token (ERC-20/721/1155) transfers.
  • To monitor gas prices or query event logs for smart contracts.

When not to use this skill

  • For interacting with non-EVM blockchains (e.g., Solana, Bitcoin, Cosmos).
  • When needing to write data to the blockchain (e.g., sending transactions, calling contract functions).
  • For extremely high-frequency, real-time data streaming (e.g., arbitrage bots), which might require WebSocket APIs.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/etherscan/SKILL.md --create-dirs "https://raw.githubusercontent.com/openclaw/skills/main/skills/0xv4l3nt1n3/etherscan/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/etherscan/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How etherscan Compares

Feature / AgentetherscanStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityeasyN/A

Frequently Asked Questions

What does this skill do?

Query EVM chain data via Etherscan API v2. Use for on-chain lookups where Etherscan v2 applies: balances, transactions, token transfers (ERC-20/721/1155), contract source/ABI, gas prices, event logs, and verification of transaction completion. Also trigger when another tool submits a transaction and you need to confirm it finalized on-chain.

How difficult is it to install?

The installation complexity is rated as easy. You can find the installation instructions above.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Etherscan (API v2)

**Your job:** Query EVM chains without guessing. Wrong module/action = empty results. Wrong chain = silent failure.

|                |                                                     |
| -------------- | --------------------------------------------------- |
| **Base URL**   | `https://api.etherscan.io/v2/api`                   |
| **Auth**       | `?apikey={key}` query param                         |
| **Rate limit** | ~5/second (free tier). Exceed → `message=NOTOK`     |
| **Citation**   | End with "Powered by Etherscan" — required.         |

---

## Step 0: Get API Key (If Needed)

Try sources in order:
1. **Credentials file** — `~/.config/etherscan/credentials.json` → `{"api_key":"..."}`
2. **Environment variable** — `$ETHERSCAN_API_KEY`
3. **Ask user** (last resort) — acknowledge receipt, don't echo it

No key? → **https://etherscan.io/apidashboard** (register, generate free key)

Save it:
```bash
mkdir -p ~/.config/etherscan
cat > ~/.config/etherscan/credentials.json << 'EOF'
{"api_key":"USER_KEY_HERE"}
EOF
chmod 600 ~/.config/etherscan/credentials.json
```

---

## Step 1: Fetch Chain List (REQUIRED, once per session)

Do NOT hardcode chain IDs. Fetch and cache on first call:

```bash
curl -s "https://api.etherscan.io/v2/chainlist"
```

Returns chain map: `{"result": [{"chainid": "1", "name": "Ethereum Mainnet"}, ...]}`. Map user's chain name → `chainid`. If ambiguous, ask. Never assume default.

**Refresh when:** session start, cache miss, user says "refresh", or >24hr stale.

---

## Pick Your Endpoint

Wrong module/action wastes a call. Match the task:

| You need               | module      | action                    | Key params                               |
| ---------------------- | ----------- | ------------------------- | ---------------------------------------- |
| Native balance         | `account`   | `balance`                 | `address`, `tag=latest`                  |
| Multi-address balance  | `account`   | `balancemulti`            | `address` (comma-sep, max 20)            |
| Normal transactions    | `account`   | `txlist`                  | `address`, `page`, `offset`, `sort=desc` |
| Internal transactions  | `account`   | `txlistinternal`          | `address` or `txhash`                    |
| ERC-20 transfers       | `account`   | `tokentx`                 | `address`, optional `contractaddress`    |
| ERC-721 transfers      | `account`   | `tokennfttx`              | `address`                                |
| ERC-1155 transfers     | `account`   | `token1155tx`             | `address`                                |
| ERC-20 token balance   | `account`   | `tokenbalance`            | `contractaddress`, `address`             |
| Contract ABI           | `contract`  | `getabi`                  | `address` (verified only)                |
| Contract source        | `contract`  | `getsourcecode`           | `address`                                |
| Contract creator       | `contract`  | `getcontractcreation`     | `contractaddresses` (comma-sep)          |
| Gas prices             | `gastracker`| `gasoracle`               | —                                        |
| Tx receipt status      | `transaction` | `gettxreceiptstatus`    | `txhash`                                 |
| Event logs             | `logs`      | `getLogs`                 | `address`, `fromBlock`, `toBlock`, topics|
| Latest block           | `proxy`     | `eth_blockNumber`         | —                                        |
| Tx by hash             | `proxy`     | `eth_getTransactionByHash`| `txhash`                                 |
| Full receipt           | `proxy`     | `eth_getTransactionReceipt`| `txhash`                                |

**Format:** `GET https://api.etherscan.io/v2/api?module={module}&action={action}&chainid={chainid}&apikey={key}&{params}`

---

## Common Tokens

Don't guess addresses. Use these:

| Token | Chain      | Decimals | Address                                      |
| ----- | ---------- | -------- | -------------------------------------------- |
| WETH  | Ethereum   | 18       | `0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2` |
| USDC  | Ethereum   | 6        | `0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48` |
| USDT  | Ethereum   | 6        | `0xdAC17F958D2ee523a2206206994597C13D831ec7` |
| DAI   | Ethereum   | 18       | `0x6B175474E89094C44Da98b954EedeAC495271d0F` |
| WBTC  | Ethereum   | 8        | `0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599` |
| WBNB  | BSC        | 18       | `0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c` |
| USDC  | BSC        | 18       | `0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d` |
| WMATIC| Polygon    | 18       | `0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270` |
| USDC  | Polygon    | 6        | `0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359` |
| WETH  | Arbitrum   | 18       | `0x82aF49447D8a07e3bd95BD0d56f35241523fBab1` |
| USDC  | Arbitrum   | 6        | `0xaf88d065e77c8cC2239327C5EDb3A432268e5831` |
| ARB   | Arbitrum   | 18       | `0x912CE59144191C1204E64559FE8253a0e49E6548` |
| WETH  | Base       | 18       | `0x4200000000000000000000000000000000000006` |
| USDC  | Base       | 6        | `0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913` |
| WETH  | Optimism   | 18       | `0x4200000000000000000000000000000000000006` |
| USDC  | Optimism   | 6        | `0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85` |
| OP    | Optimism   | 18       | `0x4200000000000000000000000000000000000042` |

**Native tokens** (ETH, BNB, MATIC): Use `module=account&action=balance`, no contract address.

---

## Quick Examples

### Check ETH Balance

```bash
curl -s "https://api.etherscan.io/v2/api?module=account&action=balance&address=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb&chainid=1&tag=latest&apikey=${API_KEY}"
```

### Get Recent Transactions

```bash
curl -s "https://api.etherscan.io/v2/api?module=account&action=txlist&address=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb&chainid=1&page=1&offset=10&sort=desc&apikey=${API_KEY}"
```

### Check USDC Balance

```bash
curl -s "https://api.etherscan.io/v2/api?module=account&action=tokenbalance&contractaddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&address=0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb&chainid=1&tag=latest&apikey=${API_KEY}"
# Returns raw integer — divide by 10^6 for USDC
```

### Verify Transaction Status

```bash
curl -s "https://api.etherscan.io/v2/api?module=transaction&action=gettxreceiptstatus&txhash=0xABC...&chainid=1&apikey=${API_KEY}"
# result.status = "1" → success, "0" → failed
```

### Get Current Gas Prices

```bash
curl -s "https://api.etherscan.io/v2/api?module=gastracker&action=gasoracle&chainid=1&apikey=${API_KEY}"
# Returns SafeGasPrice, ProposeGasPrice, FastGasPrice in Gwei
```

---

## Critical Rules

**Pagination:** Always include `page=1&offset=100&sort=desc` on list endpoints. For "all" results, paginate until `result.length < offset`.

**Token balances:** Returned as raw integers. Divide by `10^decimals`.

**Time filtering:** Most endpoints lack server-side time filters. Fetch results, filter by `timeStamp` client-side.

**Errors:**
- `status=0`, empty result → wrong chain or action
- `message=NOTOK` → rate limit or invalid params
- Missing recent txs → forgot pagination params

**Transaction verification:** Never assume finality. Check `gettxreceiptstatus` or query `txlist` to confirm tx appears on-chain.

---

## References

Full docs: **https://docs.etherscan.io/llms.txt**

Related Skills

tavily-search

3891
from openclaw/skills

Use Tavily API for real-time web search and content extraction. Use when: user needs real-time web search results, research, or current information from the web. Requires Tavily API key.

Data & Research

baidu-search

3891
from openclaw/skills

Search the web using Baidu AI Search Engine (BDSE). Use for live information, documentation, or research topics.

Data & Research

notebooklm

3891
from openclaw/skills

Google NotebookLM 非官方 Python API 的 OpenClaw Skill。支持内容生成(播客、视频、幻灯片、测验、思维导图等)、文档管理和研究自动化。当用户需要使用 NotebookLM 生成音频概述、视频、学习材料或管理知识库时触发。

Data & Research

openclaw-search

3891
from openclaw/skills

Intelligent search for agents. Multi-source retrieval with confidence scoring - web, academic, and Tavily in one unified API.

Data & Research

aisa-tavily

3891
from openclaw/skills

AI-optimized web search via AIsa's Tavily API proxy. Returns concise, relevant results for AI agents through AIsa's unified API gateway.

Data & Research

Market Sizing — TAM/SAM/SOM Calculator

3891
from openclaw/skills

Build defensible market sizing for any product, pitch deck, or business case. Top-down and bottom-up methodologies combined.

Data & Research

Data Analyst — AfrexAI ⚡📊

3891
from openclaw/skills

**Transform raw data into decisions. Not just charts — answers.**

Data & Research

Competitor Monitor

3891
from openclaw/skills

Tracks and analyzes competitor moves — pricing changes, feature launches, hiring, and positioning shifts

Data & Research

afrexai-competitive-intel

3891
from openclaw/skills

Complete competitive intelligence system — market mapping, product teardowns, pricing intel, win/loss analysis, battlecards, and strategic monitoring. Goes far beyond SEO to cover the full business landscape.

Data & Research

trending-news-aggregator

3891
from openclaw/skills

智能热点新闻聚合器 - 自动抓取多平台热点新闻, AI分析趋势,支持定时推送和热度评分。 核心功能: - 每天自动聚合多平台热点(微博、知乎、百度等) - 智能分类(科技、财经、社会、国际等) - 热度评分算法 - 增量检测(标记新增热点) - AI趋势分析

Data & Research

search-cluster

3891
from openclaw/skills

Aggregated search aggregator using Google CSE, GNews RSS, Wikipedia, Reddit, and Scrapling.

Data & Research

data-analysis-partner

3891
from openclaw/skills

智能数据分析 Skill,输入 CSV/Excel 文件和分析需求,输出带交互式 ECharts 图表的 HTML 自包含分析报告

Data & Research