Querying transaction history for an Ethereum address is a common requirement in wallet development, blockchain analytics, and decentralized application (dApp) design. Whether you're building a crypto wallet, auditing fund flows, or verifying user activity, retrieving accurate and timely transaction records is essential. This guide explores two practical approaches to fetch Ethereum transaction data—using Etherscan API and Web3j event filters—with implementation insights, limitations, and best practices.
Understanding the Challenge
When developing an Ethereum wallet or related service, one of the core functionalities is displaying transaction history for a given address. However, Ethereum’s native JSON-RPC API does not offer a direct method like eth_getTransactionsByAddress. This forces developers to rely on alternative solutions.
Many developers using Web3j—a popular Java library for Ethereum interaction—often struggle to find built-in methods for querying past transactions. While Web3j excels at sending transactions and interacting with smart contracts, it lacks native support for fetching historical data. As a result, external tools or workarounds become necessary.
Solution 1: Using Etherscan API
The most straightforward way to retrieve transaction history is through the Etherscan API, which provides well-documented endpoints for account and transaction data.
Key Endpoint: txlist
Etherscan offers the txlist action under the account module:
https://api.etherscan.io/api?module=account&action=txlist&address=0x...&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyTokenParameters Explained
module=account: Specifies the account-related module.action=txlist: Retrieves normal (ETH) transactions.address: The Ethereum address to query.startblock/endblock: Define the block range. Use0to99999999or"latest"for recent data.sort=asc: Returns results in chronological order.apikey: A required authentication token obtained by registering on etherscan.io.
👉 Discover how blockchain APIs can power your next project with real-time data access.
Pagination Support
To overcome the 1000-record limit per request, use pagination:
&page=1&offset=100This allows fetching up to 10,000 records across multiple requests (100 pages × 100 items). For deeper historical analysis, combine this with time-based block estimation or batch processing.
Sample Response (JSON)
{
"status": "1",
"message": "OK",
"result": [
{
"blockNumber": "14567890",
"timeStamp": "1648765432",
"hash": "0xabc...",
"from": "0x123...",
"to": "0x456...",
"value": "1000000000000000000",
"gasUsed": "21000"
}
]
}Each transaction includes critical details: block number, timestamp, sender, receiver, value (in wei), and gas usage.
Advantages
- Simple integration via HTTP GET requests.
- No need for running a full node.
- Fast response times and reliable uptime.
Limitations
- Rate-limited (5 calls/sec per API key).
- Not suitable for high-frequency or enterprise-scale queries without premium plans.
- Dependent on a third-party service.
Solution 2: Using Web3j Filters and Event Listening
For applications requiring full control over data ingestion, implementing a local listener using Web3j filters is a robust alternative.
How It Works
Instead of querying past data directly, this method listens for new transactions in real-time using event filters:
EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST,
DefaultBlockParameterName.LATEST,
"0xYourAddress");
web3j.ethLogObservable(filter).subscribe(log -> {
// Process incoming transaction logs
});All incoming transactions are captured as they occur and stored in a local database (e.g., PostgreSQL, MongoDB). Historical queries are then performed against this database.
Implementation Requirements
- Backend server or service to maintain continuous connection.
- Database schema to store transaction hashes, addresses, values, timestamps, etc.
- Error handling and reconnection logic for network interruptions.
Challenges on Mobile Platforms
As noted in the original article, using filters on Android or other mobile platforms may lead to instability due to limited background execution capabilities and WebSocket timeout issues.
👉 Explore how real-time blockchain monitoring enhances security and transparency in dApps.
Frequently Asked Questions
Q: Can I get more than 10,000 transactions from Etherscan?
A: No. The free tier limits txlist to 10,000 results (100 pages × 100 offset). For deeper archives, consider using Etherscan’s premium API or alternative providers.
Q: Is there a way to get ERC-20 token transfers using Etherscan?
A: Yes. Use the tokentx action instead: action=tokentx&address=0x... returns all ERC-20 token transactions for the specified address.
Q: Why doesn’t Ethereum’s JSON-RPC support direct transaction history lookup?
A: Ethereum nodes prioritize state integrity over historical indexing. Querying past transactions requires scanning the entire blockchain, which is resource-intensive. Hence, external indexing services like Etherscan fill this gap.
Q: Can I combine both methods?
A: Absolutely. Use Etherscan to seed historical data and Web3j filters to capture future transactions—ensuring completeness and real-time updates.
Q: Are there privacy concerns when using Etherscan API?
A: Yes. Exposing wallet addresses via public API calls may leak user behavior patterns. Always anonymize requests in production environments and avoid logging sensitive data.
Q: What are some alternatives to Etherscan?
A: Consider Alchemy, Infura with Archive nodes, or Moralis for scalable blockchain data access—though these may require subscriptions.
Core Keywords for SEO
- Ethereum transaction history
- Query ETH transactions by address
- Etherscan API tutorial
- Web3j filter example
- Blockchain transaction lookup
- ETH wallet development
- Retrieve wallet transaction records
- Real-time Ethereum event listening
Final Thoughts
While Ethereum does not natively support querying transaction history by address, practical solutions exist through third-party APIs and event-driven architectures. For rapid prototyping and simplicity, Etherscan API is ideal. For long-term scalability and independence, combining Web3j filters with local storage offers greater control.
Choosing the right method depends on your application’s needs: real-time updates, historical depth, platform constraints, and infrastructure resources.
👉 Start building smarter blockchain applications with powerful developer tools today.
Regardless of your approach, always ensure secure handling of API keys, efficient data caching, and compliance with privacy standards. With the right strategy, querying Ethereum transaction records becomes a seamless part of your blockchain development workflow.