Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- from random import random
- # btc_el33t.py
- # Dan Kaminsky, [email protected]
- # simple numerical sim of @el33th4xor Bitcoin attack
- # No conclusions should be drawn, except that it's
- # _really_ sensitive to whether you can always win
- # the race with the public pool.
- pubpool = 0.66666
- privpool = 0.33333
- chance_of_losing_race = 0
- prev = 0
- r =0
- pubbtc = 0
- privbtc = 0
- # honest
- if 0:
- while r<10000:
- print r, pubbtc, privbtc
- if random() < privpool:
- privbtc += 1
- else:
- if random() < pubpool:
- pubbtc += 1
- r+=1
- # dishonest
- if 1:
- while r<10000:
- print r, pubbtc, privbtc, prev
- if random() < privpool:
- prev += 1
- if random() < pubpool:
- if prev==0:
- pubbtc += 1
- if prev>0:
- if random() > chance_of_losing_race:
- privbtc += 1
- else:
- pubbtc += 1
- prev-=1
- r+=1
Advertisement
Add Comment
Please, Sign In to add comment