Skip to content

Instantly share code, notes, and snippets.

@vincenzopalazzo
Last active September 6, 2019 18:59
Show Gist options
  • Save vincenzopalazzo/a1b7cb6c8d8facd63ade19a93579067f to your computer and use it in GitHub Desktop.
Save vincenzopalazzo/a1b7cb6c8d8facd63ade19a93579067f to your computer and use it in GitHub Desktop.
This code calculate the year in which the bitcoin mining ends
def calculatesYear():
numbersBlock = 0
blockToHeaving = 210000
starYear = 2008
buildBitcoin = 50
print("-------- Value to start ----------")
print("Num. block: ", numbersBlock)
print("Num. Block: ", blockToHeaving)
print("Miner build bitcoin: ", buildBitcoin)
print("Minus value bitcoin: ", format(0.00000001, '.8f'))
while buildBitcoin >= float(format(0.00000001, '.8f')):
numbersBlock += 1
#print("Block: ", numbersBlock)
if numbersBlock > blockToHeaving:
print("-------- Having ----------")
blockToHeaving += 210000
starYear += 4
buildBitcoin = float(format(buildBitcoin / 2, '.9f'))
print("To year", starYear)
print("Now the miner build this value bitcoin: ", buildBitcoin)
print("Next heaving: ", blockToHeaving)
print("-------- Result -------")
print("The year finisch bitcoin: ", starYear)
if __name__ == '__main__':
calculatesYear()
@vincenzopalazzo
Copy link
Author

fixed english word

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment