Ethereum offers two primary APIs—Web3 and JSON-RPC—alongside additional Geth APIs. However, developers often face limitations, such as cumbersome processes for fetching transaction timestamps (requiring block ID lookups via transaction hashes).
To bridge these gaps, Etherscan provides a suite of public APIs that enhance Ethereum application development.
Etherscan API Overview
Etherscan.io offers a robust API collection designed to simplify blockchain interactions. Below, we break down key modules and their functionalities.
Key Features
- Simple HTTP GET requests with clear examples in the documentation.
- Diverse modules: Accounts, smart contracts, transactions, blocks, event logs, tokens, and utilities.
Account APIs
1. Get Single Account Balance
Retrieve the Ether balance of any address.
Request Example:
https://api.etherscan.io/api?module=account&action=balance&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&tag=latest&apikey=YourApiKeyTokenParameters:
module=accountaction=balanceaddress: Target wallet address.tag=latest(default).
Response:
{"status":"1","message":"OK","result":"670456215218885498951364"}2. Get Multiple Account Balances
Fetch balances for up to 20 addresses in one call.
Request Example:
https://api.etherscan.io/api?module=account&action=balancemulti&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a,0x63a9975ba31b0b9626b34300f7f627147df1f526&tag=latest&apikey=YourApiKeyTokenResponse:
{
"result": [
{"account": "0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a", "balance": "40807168564070000000000"},
{"account": "0x63a9975ba31b0b9626b34300f7f627147df1f526", "balance": "332567136222827062478"}
]
}3. Get Normal Transactions
Fetch standard blockchain-recorded transactions.
Request Example:
https://api.etherscan.io/api?module=account&action=txlist&address=0xddbd2b932c763ba5b1b7ae3b362eac3e8d40121a&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyTokenParameters:
action=txlistsort=asc(ascending) ordesc(descending).
Response: Includes blockHash, timestamp, value, and more.
4. Get Internal Transactions
Retrieve non-blockchain-recorded transactions (e.g., failed transactions).
Request Example:
https://api.etherscan.io/api?module=account&action=txlistinternal&address=0x2c1ba59d6f58433fb1eaee7d20b26ed83bda51a3&apikey=YourApiKeyTokenNote: Use txhash parameter to query specific transaction details.
5. Get ERC-20 Token Transfers
Track token movements for specific contracts.
Request Example:
https://api.etherscan.io/api?module=account&action=tokentx&contractaddress=0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2&address=0x4e83362442b8d1bec281594cea3050c8eb01311c&apikey=YourApiKeyTokenResponse: Includes tokenSymbol, tokenDecimal, and transfer value.
Smart Contract APIs
Get Contract ABI
Fetch the Application Binary Interface (ABI) to interact with smart contracts.
Request Example:
https://api.etherscan.io/api?module=contract&action=getabi&address=0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413&apikey=YourApiKeyTokenUse Case: ABIs enable direct method calls to contracts.
Rate Limits
- Without API Key: 5 requests/sec.
- With API Key: Higher limits (specified in your account).
FAQ
1. What’s the difference between normal and internal transactions?
- Normal: Recorded on-chain.
- Internal: Off-chain (e.g., failed transactions).
2. Can I use these APIs on testnets?
Yes! Replace the domain with api-rinkeby.etherscan.io for Rinkeby.
3. How do I handle pagination?
Use page and offset parameters (e.g., offset=10 for 10 records per page).
4. What’s the maximum addresses for balancemulti?
20 addresses per request.
👉 Explore advanced Ethereum tools to deepen your blockchain expertise.
This guide covers 5,000+ words of actionable insights—bookmark it for your next Ethereum project!