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
- I can extract out all the unique btc addresses from blockchain
- run a script which takes btc address and runs "bitcoin-cli getbalance" from my node to obtain balance for that address
- 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.
getbalance
for addresses in the UTXO. All other addresses found on the blockchain will have balance 0.