skills/etherscan-api/SKILL.md
This skill should be used when the user asks to "check ETH balance", "query ERC-20 balance", "get wallet balance", "check token holdings", "query Etherscan", or mentions Etherscan API, blockchain balance queries, or multi-chain balance lookups.
npx skillsauth add sablier-labs/agent-skills etherscan-apiInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Query blockchain balances using Etherscan's unified API V2. This skill covers:
chainid parameterScope: This skill focuses on balance queries for free-tier accounts. For other Etherscan API features, consult the fallback documentation.
Before making any API call, verify the ETHERSCAN_API_KEY environment variable is set:
if [ -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
fi
If the environment variable is missing, inform the user and halt execution.
Do not default to Ethereum Mainnet. Always infer the chain from the user's prompt before making any API call.
If the user references a chain not supported by Etherscan (e.g., Solana, Bitcoin), inform them:
The 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
For the complete list of supported chains and their IDs, see ./references/chains.md.
All requests use the unified V2 endpoint:
https://api.etherscan.io/v2/api
The chainid parameter determines which blockchain to query.
Query native ETH (or native token) balance for an address.
| Parameter | Required | Default | Description |
| --------- | -------- | -------- | ---------------------------------------------------- |
| chainid | No | 1 | Chain ID (see chains.md) |
| module | Yes | - | Set to account |
| action | Yes | - | Set to balance |
| address | Yes | - | Wallet address (supports up to 20 comma-separated) |
| tag | No | latest | Block tag (latest, pending, or hex block number) |
| apikey | Yes | - | API key from $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"
Single address:
{
"status": "1",
"message": "OK",
"result": "172774397764084972158218"
}
Multi-address:
{
"status": "1",
"message": "OK",
"result": [
{"account": "0xaddress1", "balance": "1000000000000000000"},
{"account": "0xaddress2", "balance": "2500000000000000000"}
]
}
Query ERC-20 token balance for an address.
| Parameter | Required | Default | Description |
| ----------------- | -------- | -------- | --------------------------------- |
| chainid | No | 1 | Chain ID (see chains.md) |
| module | Yes | - | Set to account |
| action | Yes | - | Set to tokenbalance |
| contractaddress | Yes | - | ERC-20 token contract address |
| address | Yes | - | Wallet address to query |
| tag | No | latest | Block tag |
| apikey | Yes | - | API key from $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"
}
Specify the chainid parameter to query different blockchains.
| Chain | Chain ID |
| ------------ | -------- |
| Ethereum | 1 |
| Polygon | 137 |
| Arbitrum One | 42161 |
| Linea | 59144 |
| zkSync | 324 |
curl -s "https://api.etherscan.io/v2/api?chainid=137&module=account&action=balance&address=0x...&tag=latest&apikey=$ETHERSCAN_API_KEY"
For the complete list of supported chains, see ./references/chains.md.
API responses return balances in the smallest unit (wei for ETH, smallest decimals for tokens).
Divide by 10^18:
# Using bc for precision
echo "scale=18; 172774397764084972158218 / 1000000000000000000" | bc
# Result: 172774.397764084972158218
Divide by 10^decimals (typically 18, but varies per token):
| Token | Decimals | | ----------- | -------- | | Most tokens | 18 | | USDC, USDT | 6 | | WBTC | 8 |
# USDC example (6 decimals)
echo "scale=6; 135499000000 / 1000000" | bc
# Result: 135499.000000
Default behavior: Present results in a Markdown table:
| Address | Balance (ETH) | Chain |
|---------|---------------|-------|
| 0xde0B...7BAe | 172,774.40 | Ethereum |
| 0xabc1...2def | 50.25 | Polygon |
User preference: If the user requests a specific format (JSON, CSV, plain text, etc.), use that format instead. Do not generate a Markdown table when the user specifies an alternative output format.
The following chains require a paid Etherscan plan and are not available on free tier:
8453)10)43114)56)If a user requests a query on these chains, inform them that a paid plan is required.
| Status | Message | Cause |
| ------ | ------------------------ | ------------------------------- |
| 0 | NOTOK | Invalid API key or rate limited |
| 0 | Invalid address format | Malformed address |
| 0 | No transactions found | Address has no activity |
If rate limited, wait briefly and retry.
./references/chains.md - Complete list of supported chains with chain IDsFor use cases not covered by this skill (transaction history, contract verification, gas estimates, etc.), fetch the AI-friendly documentation:
https://docs.etherscan.io/llms.txt
Use WebFetch to retrieve this documentation for extended API capabilities.
development
This skill should be used when the user asks to "create a state machine", "add xState", "use xState with React", "implement actor-based state", "manage complex state with state machines", "use xState with Effect", "integrate Effect-ts with xState", mentions xState hooks (useMachine, useActor, useSelector), or discusses finite state machines in React applications.
tools
This skill should be used when the user asks about "viem", "viem client", "viem actions", "TypeScript Ethereum", "createPublicClient", "createWalletClient", "parseEther", "formatEther", "readContract", "writeContract", or mentions using viem for blockchain interactions.
development
This skill should be used when the user asks about "Tailwind CSS", "tailwind-variants", "tv() function", "CSS-first configuration", "Tailwind breaking changes", mentions styling with Tailwind utilities, gradient syntax, or component variants with TypeScript.
development
This skill should be used when the user asks to "analyze a screenshot", "generate implementation spec", "create SPEC.md from screenshot", "extract design specs", "spec from image", or provides website screenshots and wants detailed implementation guidance.