I started wondering recently if generated ethereum addresses were evenly distributed in the address space and figured I could do some basic stats to see if they're clustered in one way or another.

My first thought was to run some JS code in geth that steps back through each block (using web3.eth.getBlock), adding all transactions with tx.to or tx.from addresses to a map. I tried that with a couple thousand blocks last night and it was painfully slow, there's no way I can traverse the whole blockchain history like that.

Is there a better way to accomplish this?

  • I actually did a traversal of all blocks and uncles on the blockchain a few days ago! I was able to sync and then walk all the blocks and uncles on the Ethereum and Ethereum Classic chains in 3 days (I split up my scanning into multiple chunks since I was looking for particular transactions). I did this on a DS Azure instance (I've since deleted the instances to save $$$). Don't know if there's a better way, but I'd be happy to do it again and post my results if all you want is the addresses. Edit: or not... apparently that was an expensive endeavour... need new local disks... – lungj Dec 19 '17 at 19:37
  • If you're using Parity, things are reasonably fast on an SSD if you use archive mode for syncing, you can probably complete the whole task in about 2 days. Not sure if that's what you meant by painfully slow, though. – lungj Dec 19 '17 at 19:46
  • I was hoping for faster, but 2 days could be OK. What kind of cost are you talking about @lungj? – Nick Dec 19 '17 at 20:41
  • I was being stupid last week (I was unfamiliar with the more exotic I/O options for VM construction on Azure and I got too lazy to fix it because I'm impatient :p). But you could probably do what I did for about $20-$40 USD (assuming you remember to kill your VM when you're done). Checking all transactions would take longer -- maybe two or three times longer. I happened to use Azure because I have some credits; there may be cheaper alternatives. Out of curiosity, what sort of machine/disk were you using yesterday? I can service ~100 RPC requests on my laptop. – lungj Dec 19 '17 at 21:32
  • @lungj There's a new api in geth debug.getModifiedAccountsByNumber and debug.getModifiedAccountsByHash that may help avoiding to parse block. – Ismael Dec 19 '17 at 21:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.