1

I am trying to retrieve all transactions for a particular address at once.

My current approach is to collect all transactions of all blocks in MySQL DB and issue a query like "SELECT * FROM table WHERE from = ***** OR to = ***********;". However, collecting all transactions of all blocks would require too long a time. Is there any way to get all transactions issued by a particular address in a much shorter time?

I'm using web3js and web3j.

6
  • What blockchain are we talking about here?
    – Sky
    Feb 7, 2023 at 8:03
  • @Sky this is Ethereum stack exchange
    – user253751
    Feb 7, 2023 at 9:12
  • Your node surely has this ability, but will it let you use it? A lot of public nodes don't allow heavy queries through web3. You might want to run your own node, which indexes all the transactions using your own computing power
    – user253751
    Feb 7, 2023 at 9:13
  • I have a private node(Geth) running in full sync mode on my home PC.
    – Pierogi
    Feb 7, 2023 at 14:14
  • use the website called Dune Analytics
    – Nulik
    Feb 7, 2023 at 17:26

3 Answers 3

0

You can use https://www.etherscan.io for this approach.

Enter the address in the search bar and then open the transactions tab. under Transactions in the menu, there is a text Latest 25 from a total of xxx transactions.

Click on the total number (xxx) and this will bring you to a page showing complete list of transactions. On the bottom, there is an Export to CSV option.

0

Use a node as a service. Alchemy has a endpoint that does the job really quickly. They simply have more hardware capabilities than you can possibly have at your home and its free. If you insist in using your own computer you could explore TrueBlocks or some other local explorer.

0

I am actually working on an API that much more convenient / faster to use for this task than web3.js.

Just run the request below (and replace the placeholder address 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D with the address you have in mind in both places). This should get you all transactions an address has made in a single request (if there are more than 100,000 transactions you can use the cursor to fetch the next page of results - docs here: syve.ai).

curl --location --request POST 'https://api.syve.ai/v1/transactions' \
--header 'Content-Type: application/json' \
--data-raw '{
        "filter": {
            "type": "or",
            "params": {
                "filters": [
                    {
                        "type": "eq",
                        "params": {
                            "field": "to_address",
                            "value": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
                        }
                    },
                    {
                        "type": "eq",
                        "params": {
                            "field": "from_address",
                            "value": "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D"
                        }
                    }
                ]
            }
        },
        "options" : [
            {
                "type" : "size",
                "params" : {
                    "value" : 100000
                }
            }
        ]
    }'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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