Last active
May 8, 2019 08:03
-
-
Save myrual/1bf215b83871766d3776cad689713518 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://twitter.com/cz_binance/status/1125996194734399488 | |
# block2reorg | |
# If you want to remove one transaction six block ago, | |
# there is one solution: | |
# buy more than half of Bitcoin hash power, calculate all transaction again, until you become the longest chain and all full node accept it | |
# Diff is the block you want to re-org | |
# k is your hash power/other hash power | |
# x is the block you need to generate | |
# diff = kx - x | |
# diff = (k-1)x | |
# x = diff/(k-1) | |
# k = reorg_hash_percent/(1-reorg_hash_percent) | |
# how to use: | |
# reorg_hash_percent is 0.6 if you have 60% hash power, you need to generate 12 block to be longest chain. | |
# how_many_block(6, 0.51) | |
# 146 | |
# how_many_block(6, 0.55) | |
# 26 | |
# how_many_block(6, 0.6) | |
# 12 | |
# how_many_block(6, 0.7) | |
# 4 | |
# how_many_block(6, 0.8) | |
# 1 | |
def how_many_block(block2reorg, reorg_hash_percent): | |
k = reorg_hash_percent/(1 - reorg_hash_percent) | |
x = block2reorg/(k - 1) | |
return int(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment