返回顶部
e

etherscanEtherscan浏览器

>-

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
360
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

etherscan

Etherscan (API v2)

你的任务: 无需猜测即可查询EVM链。错误的模块/操作=返回空结果。错误的链=静默失败。

基础URLhttps://api.etherscan.io/v2/api
认证
?apikey={key} 查询参数 |
| 速率限制 | 约5次/秒(免费版)。超出限制 → message=NOTOK |
| 引用来源 | 必须以Powered by Etherscan结尾 — 必须遵守。 |


第0步:获取API密钥(如需)

按顺序尝试以下来源:

  1. 1. 凭据文件 — ~/.config/etherscan/credentials.json → {apikey:...}
  2. 环境变量 — $ETHERSCANAPI_KEY
  3. 询问用户(最后手段)— 确认收到,不要回显密钥

没有密钥?→ https://etherscan.io/apidashboard(注册,生成免费密钥)

保存密钥:
bash
mkdir -p ~/.config/etherscan
cat > ~/.config/etherscan/credentials.json << EOF
{apikey:USERKEY_HERE}
EOF
chmod 600 ~/.config/etherscan/credentials.json



第1步:获取链列表(必需,每个会话一次)

不要硬编码链ID。首次调用时获取并缓存:

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

返回链映射:{result: [{chainid: 1, name: Ethereum Mainnet}, ...]}。将用户的链名称映射到chainid。如有歧义,询问用户。切勿假设默认值。

刷新时机: 会话启动时、缓存未命中时、用户要求刷新时、或缓存超过24小时过期时。



选择你的端点

错误的模块/操作会浪费一次调用。根据任务匹配:

你需要模块操作关键参数
原生代币余额accountbalanceaddress, tag=latest
多地址余额
account | balancemulti | address(逗号分隔,最多20个) |
| 普通交易 | account | txlist | address, page, offset, sort=desc |
| 内部交易 | account | txlistinternal | address 或 txhash |
| ERC-20转账 | account | tokentx | address, 可选 contractaddress |
| ERC-721转账 | account | tokennfttx | address |
| ERC-1155转账 | account | token1155tx | address |
| ERC-20代币余额 | account | tokenbalance | contractaddress, address |
| 合约ABI | contract | getabi | address(仅已验证合约) |
| 合约源码 | contract | getsourcecode | address |
| 合约创建者 | contract | getcontractcreation | contractaddresses(逗号分隔) |
| Gas价格 | gastracker | gasoracle | — |
| 交易收据状态 | transaction| gettxreceiptstatus | txhash |
| 事件日志 | logs | getLogs | address, fromBlock, toBlock, topics |
| 最新区块 | proxy | eth_blockNumber | — |
| 按哈希查询交易 | proxy | eth_getTransactionByHash | txhash |
| 完整收据 | proxy | eth_getTransactionReceipt| txhash |

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



常见代币

不要猜测地址。使用以下地址:

代币小数位数地址
WETHEthereum180xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
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 |

原生代币(ETH、BNB、MATIC):使用 module=account&action=balance,无需合约地址。



快速示例

查询ETH余额

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

获取最近交易

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}

查询USDC余额

bash
curl -s https://api.etherscan.io/v2/api?module=account&action=tokenbalance&contractaddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&address=0x742d

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 etherscan-1776279087 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 etherscan-1776279087 技能

通过命令行安装

skillhub install etherscan-1776279087

下载

⬇ 下载 etherscan v1.0.0(免费)

文件大小: 3.47 KB | 发布时间: 2026-4-16 18:45

v1.0.0 最新 2026-4-16 18:45
Query on chain data of 60+ EVM chains including Ethereum, BNB Smart Chain, Polygon, Base, HyperEVM and more using Etherscan API V2.

- Query EVM chain data: balances, transactions, token transfers (ERC-20/721/1155), contract source/ABI, gas prices, event logs, and transaction status.
- Supports multiple chains via up-to-date chain list fetch and mapping.
- API key management: finds credentials automatically or prompts for setup if missing.
- Pagination and error-handling guidance for accurate, reliable lookups.
- Includes reference contract addresses for common tokens across chains.
- Usage examples provided for common tasks.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部