-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
methode to list all transactions of an account ? #580
Comments
I ran into this problem myself today, sadly there is not such a method. This can be done by going through the blockchain yourself and recording the transactions pertaining to your address. You can do this with the
|
I am looking into this and still looks like there is no API for this. |
@danuker I tested the code to checking past transactions, but it cost me 100 seconds to find out an address even with only 1 block. It's too slow, slower than new block appears, so it's impossible to check all blocks...... @CoderXpert for(var i = 4905820; i < 4905822; i++) { |
@fredzhu it’s not impossible, just slow unless you do clever things. QuickBlocks does all of those clever things. Check it out. |
Is there a particular reason as to why is this not in the API? |
@Dylan-Phoon There is no implementation for this API in any ethereum client. |
To add an API, the node itself would have to keep an indexed list of transactions per account. This would increase the data requirements on the node, which are already very onerous, dramatically. The index would have to be maintained at each block, which means either inserting items into the index or sorting the index at each block. As the chain grows this would overwhelm the node and make decentralization more and more difficult. Because the blockchain is basically an append-only log, the node simply has to append data to the end of the database which is much less resource intensive. At least that's my guess. I'm not a core developer. |
@tjayrush The necessity of an index shouldn't prevent this feature from being included in a client, just disabled by default. You could have an option --index-transactions=true or somesuch. However, the problem is one of incentives; the client devs think this feature request has a lower priority for their project, compared to other features (i.e. client scalability and performance). I think it's a courtesy that they left this ticket open (they might consider it further in the future). See the last comment here. Thank you for your referral to QuickBlocks!!! It is just what I am looking for in the near future. @CoderXpert What I proposed is painfully slow, and is not really worth implementing. In December when I tested it took about 10 minutes to go through an hour of the blockchain, on my SSD laptop. And unless you only check a fixed set of addresses, or a very short timeframe, you'll have to go through the blockchain from scratch again. The only way to make the lookup faster (for random addresses) is to build an index for ALL transactions. I recommend that you use QuickBlocks which @tjayrush posted, and it does just that! |
@danuker Thanks for replying. Yeah I also did test around the proposal and it was too slow. Now I am working on creating an index of all transactions and create a db so I can query with different addresses and also different time periods. Thanks for mentioning QuickBlocks, I will have a look :) |
I think if we can make bloom filters cache the I didn't have a research on the transaction distribution for accounts, but from my experience of Ethereum, most accounts have transactions sparsely scattered on the blockchain. So using the bloom filters would save us the query time. This need us to build our own bloom filters, however. |
@jayphbee
This would yield 16x16=256 address prefixes requiring storage.
This would mean for the current blockchain length of 5909736 blocks, we would need about 2.82 GB to store the bloom indices of block<->addresses. It may be worth an extra 2.82 GB for a transaction index like this, compared to having to re-scan the blockchain for the addresses you're interested in. You'd save 95% of the time. |
There's a very long discussion of doing exactly what you're discussing here: Adaptive Bloom Filters to Identify Transactions of Interest per Account. Ethereum already has a fixed-width bloom filter at each block and then again another fixed-width filter at each receipt, but it's over-saturated at the block level and under-utilized at the receipt level. Adaptive blooms grow as space is need to ensure a consistent saturation level which means you can remove the receipt-level blooms and replace them with one or more at the block level. It allows for very fast scanning of the chain looking for blocks of interest. Also, just FYI. QuickBlocks provides a command line tool called |
is anyone implementing elastic search? |
Do we have the listtransactions method for the address yet? |
Any updates on this? If not, possibly efficient implementations? |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions |
You guys might wanna check on Etherscan API. They provide a function that might satisfy your needs. |
Sure, but the idea of cryptocurrencies is to work without middlemen, and Etherscan is a middleman. |
This issue is still a nightmare |
You should definitely check out TrueBlocks. This is exactly what TrueBlocks does -- fully decentrally. |
@tjayrush sadly this doesn't work for sidechains. Also, the link to "Adaptive Bloom Filters to Identify Transactions of Interest per Account." - doesn't work, could you please share the lastest working one? |
@lebed2045 Here's a better link to some papers (https://trueblocks.io/papers/) and a blog discussing (https://trueblocks.io/blog/). The ideas there work with any EVM-based chain. Not sure if that includes sidechains, but if they are EVM-based it works. Sorry for the shill everyone, but it does actually work. I'm using it every day. |
no solution yet? |
Somebody knows if there is actually a way to easily listed all transactions of an account/address or if this method is in work in progress ?
like:
web3.eth.getTransactionList(address)
Thanks !
output : all transactions hash for
web3.eth.account[x]
The text was updated successfully, but these errors were encountered: