Created
July 14, 2017 07:34
-
-
Save hrobeers/3de9d6e8d378107fd226185c81539b76 to your computer and use it in GitHub Desktop.
Prints the percentage of version 2 blocks in last 100 blocks
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
#! /usr/bin/python3 | |
from peercoin_rpc import Client | |
number_of_blocks = 100 | |
ppcnode = Client(testnet=True, username="testnet", password="testnetpw", ip="localhost", port=8888) | |
last_block_hash = ppcnode.getblockhash(ppcnode.getblockcount()) | |
block_versions = [] | |
for i in range(0, number_of_blocks): | |
block = ppcnode.getblock(last_block_hash) | |
last_block_hash = block['previousblockhash'] | |
block_versions.append(block['version']) | |
fork_perc = block_versions.count(2) * 100 / number_of_blocks | |
print(fork_perc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment