0

I've a full node running in a AWS vm. I want to develop an app which would be able to provide balance for a given btc address. I know blockchain.info and blockexplorer.com exists but I want to do my own but a simple one, just to do the balance query. I want to support a high request bandwidth and each request to work in O(1) complexity. Towards that goal, I'm thinking if

  1. I can extract out all the unique btc addresses from blockchain
  2. run a script which takes btc address and runs "bitcoin-cli getbalance" from my node to obtain balance for that address
  3. Build a in-memory cache of address->balance or in mongodb, then I can do it. Does this plan look good? Is there a better alternative? Are there existing open-source solutions that I can use to do this all, saving me lot of development work? How do I go about each step? Once the infra is set, it should be easy to keep it uptodate since blocks are added every 10mins. I think a event based system can be setup to trigger when blocks added. But setting up the infra is the problem here.

Please help. Much appreciated.

kdas
  • 141
  • 2
  • You only need to getbalance for addresses in the UTXO. All other addresses found on the blockchain will have balance 0. – bordalix Nov 17 '21 at 10:14
  • this required years of calculation :) – vincenzopalazzo Nov 17 '21 at 10:49
  • there are parser of the bitcoin block data that can do somethings like that, or maybe could be do something like that faster. A worked on a draft and it is available https://github.com/vincenzopalazzo/SpyCblock and an analysis of the bitcoin scrip with the result it did with https://github.com/vincenzopalazzo/AnalyticsPyBlock – vincenzopalazzo Nov 17 '21 at 10:51
  • Hi @bordalix How can I obtain all the addresses in UTXO? Is there a script that I can run on the bitcoin data I've in my node? – kdas Nov 17 '21 at 19:34
  • @kdas, check this answer: https://bitcoin.stackexchange.com/questions/51387/how-does-bitcoin-read-from-write-to-leveldb/52167#52167 – bordalix Nov 18 '21 at 05:58

0 Answers0