Known Ethereum nodes lack functionality to get transaction list for ETH address (account).
To solve the issue, there is free and open source third-party solution — Ethereum transaction Indexer: https://github.com/Adamant-im/ETH-transactions-storage
The Indexer allows to explore transactions by Ethereum address and obtain a history of any user|wallet in just a move, like Etherscan does. Indexer is written in Python. It works as a service in background:
- connects to Ethereum node (works well with geth or parity, others are not tested)
- stores all transactions in Postgres database (including smart contract transactions)
- provides data for API to get transactions by address
Indexer connects to Ethereum node and fetches transactions using JSON RPC, creating transactions Index in Postgres database. First Indexer will store transactions starting from block you indicate. After that, it will check for new blocks every 20 seconds and update the index. You may change the interval.
API for Ethereum transaction Indexer is published by Postgrest tool. If you need to provide public API, use any webserver like nginx and setup proxy to Postgrest port in config.
After index is created, you can use requests like
curl -k -X GET "http://localhost:3000/?and=(contract_to.eq.,or(txfrom.eq.0x6b924750e56a674a2ad01fbf09c7c9012f16f094,txto.eq.0x6b924750e56a674a2ad01fbf09c7c9012f16f094))&order=time.desc&limit=25"
or
https://yourserver.com/ethtxs?and=(contract_to.eq.,or(txfrom.eq.0x6b924750e56a674a2ad01fbf09c7c9012f16f094,txto.eq.0x6b924750e56a674a2ad01fbf09c7c9012f16f094))&order=time.desc&limit=25
The request will show 25 last transactions for Ethereum address 0x6b924750e56a674a2ad01fbf09c7c9012f16f094, ordered by timestamp.