Creating a list of non-zero wallets and their balances using Python

4 replies 344 views
bull_gangFull Member
Posts: 92 · Reputation: 447
#1Jul 3, 2026, 06:48 PM
I'm looking to scrape the blockchain to create a list of all wallets that have a balance greater than zero, and maybe add some extra info like last transaction in/out, and public keys if that’s possible. Seems like a pretty standard project. Kind of like those old bitcoin rich list websites where you could sort by different columns and had more options than what we have now. I was hoping some of you could share how you’d tackle this or at least point me to some resources. I’ve got a fully synced Bitcoin Core running with the RPC server set up. Here’s what I’ve tried in Python so far, just to show I’m not coming here empty-handed.
5 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#2Jul 4, 2026, 12:52 AM
Not wallets, but addresses. I don't think RPC is the most efficient way of doing that. If the node is synched then you should try to manually read the files from disk and parse them instead. You used >= in a couple of places like this which is wrong. The length of standard output scripts is fixed. Like P2PKH which is 25 bytes (50 hex). If the length is anything else then it is non-standard and there is no address equivalent for it and they may even be unspendable. If I understood your code correctly, you are fetching each block then processing them creating a database. Your full node has already done that and created a database of UTXOs named chainstate. You have to check bitcoin core to see how this file is stored. As I said before, you should read this file and parse that if you want the current balance of each addresses instead of processing all blocks from #1 yourself fetching them from RPC one by one. ... or you can skip all that and get the same result you are looking for from here: https://bitcointalk.org/index.php?topic=5254914.0
2 Reply Quote Share
hash_bossLegendary
Posts: 1166 · Reputation: 5261
#3Jul 4, 2026, 06:45 AM
If you need real-time update, how about running one of Electrum server implementation? All of them have address index. You just need to either access their database directly or communicate with it using Electrum protocol[1]. [1] https://electrumx-spesmilo.readthedocs.io/en/latest/protocol.html
4 Reply Quote Share
bull_gangFull Member
Posts: 92 · Reputation: 447
#4Jul 6, 2026, 03:31 PM
Thank you that topic seems to be what I'm looking for. A bit disappointing I couldn't figure out how to do it myself though.
1 Reply Quote Share
humbleledgerLegendary
Posts: 1027 · Reputation: 6554
#5Jul 6, 2026, 04:11 PM
I've seen several options to export the UTXO list, but never had to use them myself. Bitcoin-utxo-dump for instance (use at your own risk, do your own research).
0 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics