Loading...
Loading...
Compare original and translation side by side
chainidchainidETHERSCAN_API_KEYif [ -z "$ETHERSCAN_API_KEY" ]; then
echo "Error: ETHERSCAN_API_KEY environment variable is not set."
echo "Get a free API key at: https://etherscan.io/myapikey"
exit 1
fiETHERSCAN_API_KEYif [ -z "$ETHERSCAN_API_KEY" ]; then
echo "Error: ETHERSCAN_API_KEY environment variable is not set."
echo "Get a free API key at: https://etherscan.io/myapikey"
exit 1
fiThe chain "[chain name]" is not supported by Etherscan API V2.
Etherscan supports EVM-compatible chains only. For the full list, see:
https://docs.etherscan.io/etherscan-v2/getting-started/supported-chains./references/CHAINS.md该链「[链名称]」不受Etherscan API V2支持。
Etherscan仅支持兼容EVM的链。完整支持列表请查看:
https://docs.etherscan.io/etherscan-v2/getting-started/supported-chains./references/CHAINS.mdhttps://api.etherscan.io/v2/apichainidhttps://api.etherscan.io/v2/apichainid| Parameter | Required | Default | Description |
|---|---|---|---|
| No | | Chain ID (see CHAINS.md) |
| Yes | - | Set to |
| Yes | - | Set to |
| Yes | - | Wallet address (supports up to 20 comma-separated) |
| No | | Block tag ( |
| Yes | - | API key from |
| 参数 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| 否 | | 链ID(查看CHAINS.md) |
| 是 | - | 设置为 |
| 是 | - | 设置为 |
| 是 | - | 钱包地址(最多支持20个地址用逗号分隔) |
| 否 | | 区块标签( |
| 是 | - | 来自 |
curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=balance&address=0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe&tag=latest&apikey=$ETHERSCAN_API_KEY"curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=balance&address=0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe&tag=latest&apikey=$ETHERSCAN_API_KEY"curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=balancemulti&address=0xaddress1,0xaddress2,0xaddress3&tag=latest&apikey=$ETHERSCAN_API_KEY"curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=balancemulti&address=0xaddress1,0xaddress2,0xaddress3&tag=latest&apikey=$ETHERSCAN_API_KEY"{
"status": "1",
"message": "OK",
"result": "172774397764084972158218"
}{
"status": "1",
"message": "OK",
"result": [
{"account": "0xaddress1", "balance": "1000000000000000000"},
{"account": "0xaddress2", "balance": "2500000000000000000"}
]
}{
"status": "1",
"message": "OK",
"result": "172774397764084972158218"
}{
"status": "1",
"message": "OK",
"result": [
{"account": "0xaddress1", "balance": "1000000000000000000"},
{"account": "0xaddress2", "balance": "2500000000000000000"}
]
}| Parameter | Required | Default | Description |
|---|---|---|---|
| No | | Chain ID (see CHAINS.md) |
| Yes | - | Set to |
| Yes | - | Set to |
| Yes | - | ERC-20 token contract address |
| Yes | - | Wallet address to query |
| No | | Block tag |
| Yes | - | API key from |
| 参数 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|
| 否 | | 链ID(查看CHAINS.md) |
| 是 | - | 设置为 |
| 是 | - | 设置为 |
| 是 | - | ERC-20代币合约地址 |
| 是 | - | 要查询的钱包地址 |
| 否 | | 区块标签 |
| 是 | - | 来自 |
curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=tokenbalance&contractaddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&address=0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe&tag=latest&apikey=$ETHERSCAN_API_KEY"curl -s "https://api.etherscan.io/v2/api?chainid=1&module=account&action=tokenbalance&contractaddress=0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48&address=0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe&tag=latest&apikey=$ETHERSCAN_API_KEY"{
"status": "1",
"message": "OK",
"result": "135499000000"
}{
"status": "1",
"message": "OK",
"result": "135499000000"
}chainidchainid| Chain | Chain ID |
|---|---|
| Ethereum | |
| Polygon | |
| Arbitrum One | |
| Linea | |
| Scroll | |
| zkSync | |
| 链 | 链ID |
|---|---|
| Ethereum | |
| Polygon | |
| Arbitrum One | |
| Linea | |
| Scroll | |
| zkSync | |
curl -s "https://api.etherscan.io/v2/api?chainid=137&module=account&action=balance&address=0x...&tag=latest&apikey=$ETHERSCAN_API_KEY"./references/CHAINS.mdcurl -s "https://api.etherscan.io/v2/api?chainid=137&module=account&action=balance&address=0x...&tag=latest&apikey=$ETHERSCAN_API_KEY"./references/CHAINS.mdundefinedundefinedundefinedundefined| Token | Decimals |
|---|---|
| Most tokens | 18 |
| USDC, USDT | 6 |
| WBTC | 8 |
undefined| 代币 | 小数位数 |
|---|---|
| 大多数代币 | 18 |
| USDC、USDT | 6 |
| WBTC | 8 |
undefinedundefinedundefined| Address | Balance (ETH) | Chain |
|---------|---------------|-------|
| 0xde0B...7BAe | 172,774.40 | Ethereum |
| 0xabc1...2def | 50.25 | Polygon || 地址 | 余额(ETH) | 链 |
|---------|---------------|-------|
| 0xde0B...7BAe | 172,774.40 | Ethereum |
| 0xabc1...2def | 50.25 | Polygon |84531043114568453104311456| Status | Message | Cause |
|---|---|---|
| | Invalid API key or rate limited |
| | Malformed address |
| | Address has no activity |
| 状态码 | 消息 | 原因 |
|---|---|---|
| | API密钥无效或触发速率限制 |
| | 地址格式错误 |
| | 地址无任何活动记录 |
./references/CHAINS.md./references/CHAINS.mdhttps://docs.etherscan.io/llms.txtWebFetchhttps://docs.etherscan.io/llms.txtWebFetch