How does Bitcoin-qt technically check for receives to it's own addresses. I know it has a list of addresses loaded in from the wallet.dat, but when a new block or new transaction arrives, what logic increments the wallet balance you see and how? I've been told that it uses some merkle tree stuff.
1 Answer
the Blockchain contains all necessary info to know the balance of every address, including "it's own". When it downloads the next block, it updates all known balances by adjusting them based on every transaction in the block. This repeats.
-
Are you saying the Bitcoin-qt keeps a database of all addresses every used in the blockchain?– John TCommented Jan 21, 2014 at 8:15
-
1Yes - that's why it takes so long to start up the first time. It is downloading all transactions ever (the blockchain). In this way it can operate on it's own (that's what decentralised means) and check it's own copy to know "the balance" (which for the record is the total of the unspent outputs at a particular address). It can do that for all addresses not just its own addresses– T9bCommented Jan 21, 2014 at 11:29