Exploring Blockchain Data
Overview
Query and analyze blockchain data across multiple EVM-compatible networks including Ethereum, Polygon, Arbitrum, Optimism, and BSC. Supports transaction lookups, address balance checks, block inspection, token balance queries, transaction history retrieval, and whale wallet tracking via a unified CLI.
Prerequisites
- Python 3.8+ with
requestsandweb3libraries installed (pip install requests web3) - Etherscan API key (free tier provides 5 requests/second; set via
ETHERSCAN_API_KEYenvironment variable) - Optional: API keys for Polygonscan, Arbiscan, and other chain-specific explorers for higher rate limits
blockchain_explorer.pyCLI script,chain_client.py, andtoken_resolver.pymodules available in the plugin directory- RPC endpoint access (public endpoints work; dedicated providers like Alchemy, Infura, Chainstack, or QuickNode recommended for reliability)
Instructions
- Set the Etherscan API key as an environment variable:
export ETHERSCAN_API_KEY=<key>to unlock higher rate limits beyond the default 5 requests/second. - Run
python blockchain_explorer.py tx <hash>to look up a transaction by hash, returning status, block number, from/to addresses, value transferred, and gas details. - Append
--detailedto the transaction query to decode the function call, identify the interacting protocol, and display input parameters. - Specify
--chain polygon,--chain arbitrum, or--chain bscto query transactions on alternative EVM chains when the hash is not found on Ethereum. - Run
python blockchain_explorer.py address <address>to check the native token balance and total transaction count for a wallet. - Add
--history --limit 50to the address query to retrieve the most recent 50 transactions with timestamps, values, and counterparties. - Add
--tokensto the address query to list all ERC-20 token holdings with balances, symbols, and USD values via CoinGecko price resolution. - Run
python blockchain_explorer.py block latestto inspect the most recent block, orpython blockchain_explorer.py block <number>for a specific block. - Run
python blockchain_explorer.py token <wallet> <contract>to check the balance of a specific ERC-20 token at a wallet address, with automatic decimal and symbol resolution. - Export any query result in JSON or CSV format using
--format jsonor--format csvand redirect to a file for downstream processing. - Enable verbose mode with
--verboseto display API request URLs, response times, cache hit/miss status, and rate limit counters for debugging.