1

As I understood in the following post How to get unspents for a specified bitcoin address?, we should use listunspent only on addresses that belong to our own wallet otherwise will return blank.

But let's take an example of blockchain.info or block.io. Once we type in an address - any address, even if we generate it manually (paper wallet, or algorithmically) - and transfer some BTCs, a search of the address in one of those explorers shows me the funds.

  1. How can they possibly have information from this newly generated address?
  2. How can they list the unspent transactions and the current amount of an address which "is not in their wallet"?

1 Answer 1

3

How can they list the unspent transactions and the current amount of an address which "is not in their wallet"?

Block explorer sites maintain a separate database of information which is built by continuously scanning the Bitcoin blockchain. If block explorer sites see a standard locking script in the outputs of the transactions, they scrape the addresses out of those locking script and the amount associated with that output. This information is added to their database. Also, when a user spends bitcoins, he has to reference the txid and the output index in the input of the transaction. The block explorer sites uses this information to locate that output and check the output locking script, from which they derive the 'input address'. All of this information and continuous lookups allows block explorer sites to associate funds with addresses and show whether the bitcoins sent from a transaction have been spent or not. However, if you lock a transaction in a custom script, the block explorer sites won't be able to decode this information.

How can they possibly have information from this newly generated address?

They continuously scan the blockchain from which they can get transactions included in blocks. Also block explorer sites run full nodes that helps them collect transactions relayed by other nodes in the mempool that haven't been confirmed in blocks yet.

3
  • So you mean that they have a new database (probably a NoSQL like Mongo) and they update infos like spent/unspent so we can have this info on screen? Commented Aug 16, 2019 at 12:25
  • @AllanRomanato I don't know the exact database that they use, but yes they maintain a separate one that can be easily queried when an end-user enters an address to check the transactions/addresses.
    – Ugam Kamat
    Commented Aug 16, 2019 at 12:36
  • Makes sense since using the full node is easy to query transactions but not addresses. We can get all info as well but always starting from transactions not address. Commented Aug 16, 2019 at 12:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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