I am trying to write a script to audit the changing balance of an ETH address, but I cannot seem to figure out any way to find transactions where ETH has been sent to that address. I couldn't find an appropriate query in the Web3 docs and I couldn't find an appropriate endpoint on the Etherscan API. I would love to find out that I missed it though.

To be more precise, how could you find the transaction with hash 0x8c04e9c806fd7a3273d8a13b54239ab42a5f0b534520e760ccab920bc3d8d59c (https://etherscan.io/tx/0x8c04e9c806fd7a3273d8a13b54239ab42a5f0b534520e760ccab920bc3d8d59c) if you only had the recipient address 0xe81d6fce840ab873c7bccb6c2ab15e4b6daf92c7 and did not already have the transaction hash?

Note: I chose a plain ETH transfer transaction at random from the Etherscan homepage.

Ideally a solution wouldn't involve querying all transactions in a range and then filtering locally.

EDIT: this is slightly different from (How to get transactions by account using web3 js?) because I am OK with using tools outside of web3JS

  • 1
    Unfortunately geth doesn't provide an api to retrieve transaction history. There are some script that will iterate all blocks but that is slow and misses internal transactions. You have to use a third party api like Etherscan or run your own instnace of a block explorer like blockscout github.com/poanetwork/blockscout.
    – Ismael
    Commented Mar 5, 2020 at 17:28
  • Thanks so much for the help! Blockscout is an incredibly helpful tool. Commented Mar 6, 2020 at 17:47

1 Answer 1


After poking around blockscout per Ismael's suggestion, I found that the transaction I was looking for was available, so blockscout is definitely a viable option if you don't want to resort to iterating over all transactions.

However, I found that Etherscan provided the same information and I just completely missed it. For future readers, this curl got me all the transactions for the account in the question for the block range 9000000 - 9619126 (there are 163 results) and one of those transactions is the transaction in question:

curl http://api.etherscan.io/api?module=account&action=txlist&address=0xe81d6fce840ab873c7bccb6c2ab15e4b6daf92c7&startblock=9612019&endblock=9619126&sort=asc&apikey=YOUR_ETHERSCAN_API_KEY_HERE

Looking at the returned JSON, we can see that there are 113 transactions where the transaction.to == '0xe81d6fce840ab873c7bccb6c2ab15e4b6daf92c7', one of which is transaction 0x8c04e9c806fd7a3273d8a13b54239ab42a5f0b534520e760ccab920bc3d8d59c

Not the answer you're looking for? Browse other questions tagged or ask your own question.