Skip to content

Instantly share code, notes, and snippets.

@scmorse
Created February 10, 2015 22:30
Show Gist options
  • Save scmorse/ecd204f0a0974270ba90 to your computer and use it in GitHub Desktop.
Save scmorse/ecd204f0a0974270ba90 to your computer and use it in GitHub Desktop.
Block height attack
// Assume difficulty retargets every 5 blocks for illustrative purposes
// Assume difficulty retargeting is done with block pairs (0, 5), (5, 10), (10, 15), ...
// (i.e. assuming we don't have to worry about time warp bug)
Block # Timestamp (relative to start)
0 0
1 1
2 2
3 3
4 4
5 5 * target block time
6 6
7 7
8 8
9 9
10 10 * target block time
11 11
This still meets the block timestamp > median(past 11 blocks' timestamp) requirement along the whole chain, but allows someone to create an extremely long chain while still keeping the tip of the chain's time stamp sufficiently far back in time to be accepted. To fix this, you would need at least
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment