From f1b78f3a2a12d9bcdf1dc198504644b95898df4b Mon Sep 17 00:00:00 2001 From: Efe Date: Mon, 16 Dec 2019 21:03:45 +0300 Subject: [PATCH] code is complete --- bitcoin_blockreward_calculator.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 bitcoin_blockreward_calculator.py diff --git a/bitcoin_blockreward_calculator.py b/bitcoin_blockreward_calculator.py new file mode 100644 index 0000000..7cbc282 --- /dev/null +++ b/bitcoin_blockreward_calculator.py @@ -0,0 +1,12 @@ +from helpers import mainnet +from decimal import Decimal + +#This little program tells you the bitcoin's cycle count and the bitcoin block reward amount + +initial_subsidy = Decimal(50) +blocks_per_halvening = 210000 +last_block = mainnet.getblockchaininfo()["blocks"] +cycle = int(last_block/blocks_per_halvening) +initial_subsidy /= cycle*2 + +print(f"Bitcoin is in the {cycle+1}. halvening cycle and the block reward is {initial_subsidy} btc right now.") \ No newline at end of file