And can we add somthing on the clients to keep an eye for that?
Wow, lots of heat in this discussion but not much light.
First, to all the nay-sayers: chill out guys. It's a legitimate question, and just because the chances of collisions happening are extremely small it
is important to think about these things. I've seen many references to Steve Gibson's "Security Now" podcast, and those of you who listen regularly will know that Steve beat the odds big time, and generated a block within a couple of weeks, just by CPU mining.
If there is a non-zero chance of something happening, we must analyze it to see if it can have any negative effects.
And, by the way, as the number of hashes in the system increases, the probability of a collision drops dramatically, as the birthday problem (
http://en.wikipedia.org/wiki/Birthday_problem) demonstrates.
Now, as theymos pointed out, there are several things that can collide. Let's examine them one at a time.
Block hashIf a miner generates a block that has the same hash as an existing block, it will not get accepted into the block chain. The code that accepts blocks checks the block hash to see if it already has that block. The hash will match an existing block, so the new block will be rejected. This will happen at the mining machine, since the generated block is treated exactly as an incoming block by the software.
Transaction hashThe standard client will reject a new transaction that has the same hash as an existing transaction. Each incoming transaction (including transactions generated by the client) is checked to see if the client currently has it. If it does, the client rejects it as a duplicate. Now, there is a wrinkle to this - one of the optimizations under way is to store only the block headers, and only retrieve transactions that the client actually requires.
Unfortunately, I have to leave for work now. I will finish the rest of this analysis later, unless someone else would care to take it on and continue this for me.Edit: finishing the rest of it now.
Merkle hashThe Merkle hash for a newly-generated block exactly matches the Merkle hash of an existing block. I can't see any problems with that scenario. The block hash will still be unique, so the new block will be accepted.
One possible attack would be for someone to create a Merkle tree containing a fraudulent transaction, then try to convince other nodes to accept his Merkle tree instead of the actual one. This would only work for clients which store transaction headers only (which is something still in development). However, the whole purpose of hash algorithms is to make it "computationally infeasible" to deliberately create a hash that matches the hash of a different chunk of data. If the current hash algorithm becomes less secure, it's not too hard to switch to a newer algorithm.
AddressesThis has been fairly well covered by others, particularly Nicholas Bell's calculations on how long it would take to generate sufficient addresses to deliberately try to grab someone else's money. So it's not feasible as an attack.
Now, let's examine what would happen if it happened by chance. Suppose you and I hit that once in a billion billion lifetimes of a universe chance, and we both generate the same address. Someone sends 100BTC to that address. Both of our clients would say "Aha, that's for me!" and each of our wallets would show an increase of 100BTC. One of us would be pleasantly surprised that 100BTC suddenly appeared. Whoever spent it first would be successful, and the other one would see a mysterious disappearance of 100BTC.
So this is a theoretical possibility, but there is a far greater probability that you will lose your money through bank error or the bank going bankrupt (which is possible even in countries with strong economies and strong banks - just think of what happened to Lloyd's Bank in England 15 or 20 years ago).
So the bottom line is, yes it is possible that there will be collisions, but there is only one scenario where that could actually do any harm, and the chances of it happening are so close to zero it's not worth worrying about.
I think that covers the possible collisions. Have I missed any?