2

I would like to be able to query the balance of an address (not belonging to me). The data should come from a fully synced bitcoin full node inside the local LAN and I do not want to query any api services outside my LAN like blockchain or blockcypher. Of course, API calls inside my LAN would be fine and even preferred.

Which query technique could you recommend me? What's the minimum hardware requirement? I guess that would imply a large index of addresses, would I have to count with the same space as the blockchain data itself?

I know this question has been treated before, but most solutions posted there are not really up to date or not supported anymore. What's out there as currently supported solutions?

Thank you in advance

Edit:

So far, my research is that bitcoin-cli cannot reveal transactions based on an address, the txindex=1is only useful for using the RPC call getrawtransaction which doesn't allow searching for addresses.

On the other hand, I've installed btcd: it allows using btcctl searchrawtransactions address which at least prints out ALL transactions. That brings me closer, but still doesn't provide me the final balance. Would that have to calculated from the single transactions? If so, how?

  • I'm sorry, I wrote my reply thinking of transactions (while mentioning addresses) and you were asking about addresses. Also thanks to @Murch for pointing it out on my answer's comments. Deleted to avoid further confusion. – Jose Fonseca Oct 20 at 23:45
  • "What's out there as currently supported solutions?" -- Software recommendations are off-topic here. Please edit the question to focus on a single problem. – RedGrittyBrick Oct 21 at 13:18
0

The first problem is that Bitcoin does not use the addresses for working, so Bitcoin does not have the need to give the information for addresses.

So with your test have some problem, that is:

  • Bitcoin Core (bitcoind): not have the method for calculating the balance of the address because a wallet has more addresses and more private keys, for extract all addresses with the balance you can scanning the blockchain and store the information of the address.
  • btcd: Have the method for calculating the balance of the address but you don't have all addresses used inside the bitcoin blockchain, so for extract all address you can scan the blockchain.

So If you want to calculate the "balance" of the address, you can scan the blockchain from the genesis block to the last block and save the address (contains inside the scriptPubKey) for calculating the balance with the simple sum.

if you use the bitcoin core you can get the information with the RPC commands, but you must manage "how to calculate the balance of the address" or you can use and parser for a scan the blk file (with the parser you can be faster in your analysis).

I want to add more information to the address of bitcoin.

The bitcoin wallet works with more addresses and more private keys, so in the more cases, the balance of the wallet is different from the balance of the address.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.