Skip to content
This repository was archived by the owner on May 26, 2022. It is now read-only.

Method for all transactions by address #501

Closed
konovalovvlad2 opened this issue Nov 28, 2017 · 9 comments
Closed

Method for all transactions by address #501

konovalovvlad2 opened this issue Nov 28, 2017 · 9 comments

Comments

@konovalovvlad2
Copy link

Hello. Help please, I can not find a method for taking all transactions to the address, I can not find among the methods https://infura.io/docs/#supported-json-rpc-methods

Can you help me ?

@tjayrush
Copy link

@ParthBarot-BoTreeConsulting The RPC method you point to assumes one already knows the transaction's block hash and the transaction's index in that block. I think the OP is asking for an RPC that would return a list of all transactions on a given address (in other words, they are asking for what you assume they already have).

@konovalovvlad2 There is no such function, as this would require an full index of transactions per account with is not how the data is stored. This is probably the best you'll find: https://ethereum.stackexchange.com/questions/3655/how-can-all-transactions-sent-to-an-address-be-found, but given the speed (especially when going against Infura) will be prohibitive. At QuickBlocks, we're trying to solve this exact issue, but we're pre-alpha at this point.

@ParthBarot-BoTreeConsulting
Copy link

ParthBarot-BoTreeConsulting commented Mar 1, 2018

@tjayrush What I have done in my web app is,

  1. Run a background worker using web3 APIs, I check last 5 blocks from the current block number.
  2. For each of the last 5 blocks, I find all transactions and match the to address.
  3. If to address matches with any of the to address in my node accounts, then i push that transaction to my web app.

While doing this, I found that the method @konovalovvlad2 mentioned was not working for me. Though I ran the geth properly and it synced all the default recent blocks, but it maybe missing the transactions performed. But the other method is working fine.

I hope this helps.

Thanks

@tjayrush
Copy link

tjayrush commented Mar 1, 2018

I think @konovalovvlad2 was looking for a single method that would return transactions for a given account as opposed to having to spin through transactions looking for them. Like this: eth_getTransactionsOnAddress("0x1234..."). But that doesn't exist. Your method does work, but (a) you have to spin through transactions, and (b) it will miss internal transactions (i.e. message calls initiated by smart contracts).

@ParthBarot-BoTreeConsulting

@tjayrush Ok got it, makes sense.

Similar disucssion here - web3/web3.js#580

There are two options,

  1. Record all the transactions on an address as received, that way we can build our own list of transactions for an account. - I think this is a better approach, as it would not fire any extra API call.
  2. Write a web scraping script which can access the URL https://etherscan.io/address/<ADDRESS> and fetch all the transactions from there.

Thanks

@tjayrush
Copy link

tjayrush commented May 29, 2018

Before this closes, 1) doesn’t work for acquiring transactions in the past (only works for th S moment forward), and 2) is fully centralaluzed and therefor not robust.

@jamesray I’m not sure why this is closing though. There should be a wiki entry for acquiring lists of transactions per account in both centralized and decentralized way.

@jamesray1
Copy link
Contributor

The codebase has been updated to remove all content, leaving only the README, directing people to go to wiki/wiki to fix issues themselves, or failing that, make a note on Gitter, and if that doesn't fix it, open an issue if all else fails. There are 180 issues in this repo, and unfortunately there is no automated way to bulk close issues while leaving a message.

@jamesray1
Copy link
Contributor

See https://github.com/ethereum/wiki/wiki#issues for guidelines on issues.

@jamesray1
Copy link
Contributor

Updated link: Please see https://github.com/ethereum/wiki/wiki#issues-and-pull-requests for why this was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants