0

I am trying to make a query about a bitcoin address's btc amount. As I've read, getreceivedbyaddress rpc command can only be used for the addresses of a wallet that one owns and that command is awallet command. I want to make a query about any bitcoin addresses btc amount. Is it possible? If yes, how do I do it?

Efe
  • 407
  • 2
  • 16

1 Answers1

1

You can use the new scantxoutset method to check for UTXOs matching a given script, address, or key descriptor.

For example, to scan an address, you can use:

bitcoin-cli scantxoutset start "[\"addr(1....)\"]"
Raghav Sood
  • 17,027
  • 3
  • 22
  • 43
  • Does it scan all the txs in the bitcoin db to find that specific tx which that specific adress is in the utxo set of that tx? – Efe Feb 11 '20 at 22:35
  • It only scans the txs in the utxo set - any outputs that have already been spent will not be considered – Raghav Sood Feb 11 '20 at 22:40
  • 1
    When I run that comment, it takes 1-2 min but when I do the query on blockchain.info, it happens in seconds. Why? Can it be that they downloaded the bitcoin database and tweaked it so it computes very fast? I am asking because I need fast results too if possible. Do you have an idea? – Efe Feb 13 '20 at 22:54
  • 2
    @EfeCini Explorers extract all this information into a separate database optimized for their query patterns. You will not be able to match that speed using just Bitcoin Core, and should consider running a service such as Insight or ElectrumX on top of it – Raghav Sood Feb 14 '20 at 03:35