Jim, I think I understand how bloom filter works now and it seems it's exaclty what's needed here for multibit and light clients.
However, I'm still confused on 2 points:
- Are you saying bloom filter support will go into mainline satoshi at some point?
- "Bitcoind then filters all the transactions and only sends back the ones that have a Bloom filter hit.": What about old transactions? Afaik there's currently no index for this in bitcoind, right? So will the bloom bitcoind rescan the blockchain to send info on past events concerning the filtered addresses?
Offtopic sidenote and thoughts: I also took a very rough look at bitcoinj. My idea to make a "class ElectrumWallet extends Wallet" will not work cleanly (for example, Wallet.addKey(ECKey x) would have to be implemented, which wont work for electrum wallet system because keys are generated from a seed). I was kindof expecting an "interface Wallet"... Will probably take a look at multibit wallet abstraction, maybe an electrum wallet impl could be written for multibit?
Yes my understanding is that the bloom filter support will go into bitcoind (I don't know when though). It will be very useful when it goes in.
RE: the old transactions - I think you would have to set the head of your local blockchain and work forward, unless there is something on the bloom filter API to cater for this (I don't know this).
The bitcoinj Wallet is an impl yes - the MultiBit Wallet is practically the same.
I would not copy what I have done in MultiBit actually but do what Andreas does which is:
1) Have a fork of the bitcoinj code and then add in support that you want
2) When bitcoinj changes then rebase and pick up the changes.
Wallet is a bit too tightly coupled to the current network/ datamodel at the moment - Mike has it on his TODO list to prise them apart a bit. I think a Wallet abstraction would be really useful to handle heterogenous wallets (watch only, scrypt+AES encrypted private keys, HD deterministic, Electrum deterministic) but the MultiBit code is quite a long way away from that currently.
I think for writing a Java Electrum client now, the clearest way would be to use the bitcoinj datamodel as far as possible but add in the "best" structures for Electrum's wallets. That way in the future it will be easier to determine what a Wallet really is (interface wise I mean).