Can anyone point me to a fix for in the code of other alt coins where this [time travel exploit] was fixed please? Thanks.
I still think merged mining has more potential though.
It is not either/or. You have to fix the exploit regardless of whether you do merged mining.
I've seen the "fix" (sorry, no link handy) but am left wondering, Why not update difficulty continuously? Pseudocode:
# Constants set by chain designer
B=2016
N=600*second
DIFFICULTY[0] = 512
DIFFICULTYmin = 512
# Current difficulty as function of last block difficulty and time elapsed since last block
DIFFICULTY[i] = MAX(DIFFICULTYmin, DIFFICULTY[i-1] * B * N / ((B-1) * N + TIME[i] - TIME[i-1]))
TIME
i would be the "current" time as stored in the block header. Validation would require that "now" >= TIME
i >= TIME
i-1. (If a block appears with time in the future, the client would hold onto it in case it is part of the best chain when it becomes valid.)
Let's see how this fares in some pathological cases. 1. Difficulty too low. A long sequence of blocks with little change in time: TIME
i-TIME
i-1 is close to zero, so difficulty increases by a factor of approx. B/(B-1) with each block. Difficulty doubles every 1397 blocks (approx. B*log(2)).
2. Pool dumps coin. Difficulty too high. A long stretch of time without any blocks. Current algorithms suffer. This one decreases difficulty with the passage of time, not just the solving of blocks. Difficulty halves in 2 weeks (approx. B*N) even with zero blocks solved.
3. Miners leave block time unchanged despite passage of real time. They may gain from higher chain difficulty, but they will have to mine at an increasingly higher difficulty than the rest of us, and eventually that advantage will get us mining a block with updated time.
4. Time traveller visits. Can't do much as far as I can see. Blocks in past (before previous block) fail validation. Blocks in future must wait for their time (and hope the chain doesn't pass them) before clients recognize them. The lack of discreet difficulty jumps moderates profit. Exploit thwarted by appeal to external authority (the stars, crystal oscillations, Naval Observatory, etc.) yet without requiring absolute, network-wide agreement.
5. Computer clocks all wrong. As far as I can tell, the incentives are for accuracy.
I'm curious whether this has been proposed and discussed.
Edit: proposed in mid-2010
here, though in a simpler form suffering from use of floating-point arithmetic. To clarify: the pseudocode is not meant to suggest use of floating point or incompletely specified operations. No arguments against my form, but of course for the established chains there is inertia.