How to get archive txs by the ETH address?

i don not understand what method should I use to get list of txs-hashes by eth-address from archive data

if is use eth_getLogs i get empty array. sample:
params= [{“address”: “0x69…6”, “fromBlock”:“earliest”}]

thx

2 Likes

Hi @user27 you can check this post and this article how to get the tx hashes in the blocks with web3.js

Let us know if it helps.
Thanks

3 Likes

ways suggested do not address my task.
the ways constantly poll the network and look for the address whithin block or wait for the event about the address.

There is archive data in archive nodes. I need do one call func to get thx hashes to process. Light wallets do this - they show all thxs. It’s not effective poll the network via websockets or any ways if I know that I will never do the thx using the address.

I thought your service has indexed data from network in db.
But I think it’s more profit to you:
poll the network = more requests more profits :frowning:
or I don’t see how to solve the task

your docs: “Archive data is automatically enabled and no further action is required by the user.”

3 Likes

Hi @user27 ,

I think we’d need to see the exact request you are trying.

When I use this:

curl https://mainnet.infura.io/v3/$ETH \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock": "earliest", "topics":["0x241ea03ca20251805084d27d4440371c34a0b85ff108f6bb5611248f73818b80"]}],"id":1}

which is a modified version of the example query here, I get a message:

{"jsonrpc":"2.0","id":1,"error":{"code":-32005,"data":{"from":"0x46523C","limit":10000,"to":"0x46DF5B"},"message":"query returned more than 10000 results. Try with this block range [0x46523C, 0x46DF5B]."}}

Obviously there’s a lot more than 10,000 TX from the earliest block to the latest! When I use the suggested block ids then I don’t hit the 10,000 limit and I get lot’s of TX logs back.

However, like you I am also not getting anything back for something like this:

curl https://mainnet.infura.io/v3/$ETH \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"fromBlock": "earliest", "address": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"}],"id":1}'

and I’m not sure why (that’s uniswap contract address). Let me try a few things and get back to you,.

4 Likes

Hi @user27 ,

now that I re-read your question I think you are after a list of transactions involving a particular Eth address. eth_getLogs is not for that. eth_getLogs returns the logs that are created when a contract emits events. Events are indexed by topic and are therefore fairly inexpensive to retrieve using a filter. Some contracts don’t emit events at all (like the one I chose above) and EOA’s don’t have events associated with them, they are not smart contracts.

In order to get a list of transactions for an address (ether in or out or both?) you would have to iterate over a range of blocks and look for transactions in each that match the address of interest. Probably you would pick a range for a time period rather than all 16 million (17 by the time you read this!) blocks to reduce the work involved, say only the last year.

Infura are looking at providing a special API to do this but I don’t have a time for delivery yet.

Do I understand correctly? Are you after transactions and not events emitted by a smart contract?

2 Likes

@chris.paterson

yes, I need a list of transactions involving a particular Eth address (not smart-contract, not uniswap etc).

eth_getLogs was the closiest metod to my task that is why i choose it

yes I understand, In order to get a list of transactions for an eth-address I have to iterate over a range of blocks and look for transactions in each that match the address of interest.

yes I would pick a range for a time period rather than all 16 million (17 by the time you read this!) blocks to reduce the work involved, say only the last year. For example, from the beginning of the year or by the ranges - quaters.

Yes, you understand correctly.
Yes, I am after transactions and not events emitted by a smart contract.

I collect TXS to evaluate the taxes.

wait for a new features from infura to solve this task

2 Likes

This topic was automatically closed after 30 days. New replies are no longer allowed.