How does MultiBit figure out balance of an imported address?

2

MultiBit is a Simplified Payment Verification (SPV) client that uses the merkle root of block headers to validate transactions. I'm wondering however, when an address (private key) is imported into MultiBit, how does it know its balance without going through all the transactions within the blockchain?

Luca Matteis

Posted 2014-08-25T17:45:37.417

Reputation: 4 924

Question was closed 2014-09-22T11:13:57.110

Answers

2

When MultiBit imports a private key also in the import file is the key birthdate I.e when it was first generated.

From that date it looks up the most recent checkpoint (about every 2000 blocks) in a list of checkpoints it stores.

Then it contacts a bitcoind and says 'give me all the blocks from block (say) 200,000. Here is the bloom filter I want you to use to filter the blocks'.

This is fairly time consuming compared to if you have a blockstore. (Or something like a remote server like Electrum and Mycelium do). The advantage is that it only uses the Bitcoin Network.

It now has all the relevant transactions for that private key and hence can calculate the overall balance.

jim618

Posted 2014-08-25T17:45:37.417

Reputation: 3 265

In short: it does go through all blocks in the chain. However, this happens on another machine, it skips parts from before wallet creation, and uses Bloom filters to speed up the communication. – Pieter Wuille – 2014-08-26T07:37:26.293

1But how do you verify the integrity of a block without all of its contents; only with a filtered portion? Couldn't a dishonest bitcoind report incorrect filtered content? Or does the bloom filter simply ask bitcoind "Give me only the blocks where my address appears"? – Luca Matteis – 2014-08-26T11:07:59.390