I'm attempting to clarify a few things in my mind. The wallet.dat file contains (amongst other things) my transaction history alongside the private keys associated with each address in use in the wallet.
Let's say I'm one of those open source weirdos and I use PyWallet to open the wallet.dat and pull the private keys and addresses out of my wallet. Now say my goal is to create a new wallet (called it Cwallet). Now CWallet can sign transactions for my bitcoins from bitcoin-qt, but how would it actually get an account balance?
Does CWallet have to search through the entire blockchain and find my address and then follow it to the most current block? Or is there an optimized way of determining the balance?