0

Is there any way, other than importaddress, to watch balances of specific addresses?

If not, how it is possible for wallets and explorers to give information (balance, transactions) about specific addresses even though importaddress takes some time? Because we have to rescan sooner or later.

0

Is there any way, other than importaddress, to watch balances of specific addresses?

You can import a wallet that was exported in the dumpwallet format using the importwallet command. You can also import addresses using importmulti and importpubkey. But, in general, no, there is no way to watch balances of specific addresses in Bitcoin Core without using an import* command.

With Bitcoin Core 0.17, you can use the scantxoutset command which will scan the UTXO set for the UTXOs pertaining to an output script (defined in various ways).

If not, how it is possible for wallets and explorers to give information (balance, transactions) about specific addresses even though importaddress takes some time? Because we have to rescan sooner or later.

Wallets keep track of this information themselves. They do so in the same way that the import* command work. import* commands are wallet commands to tell a wallet to keep track of certain output scripts. They keep track of these in the same way: scan incoming blocks and transactions for outputs that match what they are looking for.

Blockchain explorers do not use Bitcoin Core nor do they use the wallet for this sort of stuff. They maintain their own databases that store the information for all transactions and their outputs. They do so in a similar way to wallets, but instead of looking for specific output scripts, they just store all output scripts.

  • how Wallets are keeping track of this information? – Zohaib Sohail Sep 11 '18 at 8:09
  • any open Source block explorer you can refer? – Zohaib Sohail Sep 11 '18 at 8:10
  • Wallets keep track of this information by receiving all transactions (both in blocks and not) and then scanning the outputs of those transactions for specific scripts that they are looking for. If the scripts match, the transaction is stored and whatever internal databases are updated. As for open source block explorers, have a look at insight: github.com/bitpay/insight – Andrew Chow Sep 11 '18 at 14:16
  • I dont know what but I m missing something. Could you please help me @Andrew ??? Lets say I made a wallet and have full synced node. A user with an address which also have some coins, comes to my wallet and sign-up. Now wallet will have to show balance of his address, but in my case I could not be able to show him without rescan - which takes some time. Then how do the already running wallets are doing it? – Zohaib Sohail Sep 13 '18 at 13:33
  • Users typically don't already have an address with coins when they create an account with an online wallet service. Or if they do, they aren't bringing those with them to that online service. Many online services are already indexing the blockchain anyways for all addresses. So it is very quick for them to just search through that index instead of rescanning the blockchain if a user imports their own addresses. – Andrew Chow Sep 13 '18 at 14:14
1

Is there any way, other than importaddress, to watch balances of specific addresses?

No, creating a watch-only address is the way to do this using a wallet such as Bitcoin-core.

how it is possible for wallets and explorers to give information ... even though importaddress takes some time?

Once the blockchain has been initially scanned for transactions involving an imported address, the wallet need only check new blocks for mentions of that address as it receives the new blocks, there should be no need to rescan the blockchain.

Blockchain explorers can maintain an index per address and continuously keep track of balances for all addresses. They don't need to recompute this from scratch for every new enquiry.

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.