Advertisement
Guest User

Untitled

a guest
Jul 14th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #! /usr/bin/python3
  2.  
  3. from peercoin_rpc import Client
  4.  
  5. number_of_blocks = 100
  6.  
  7. ppcnode = Client(testnet=True, username="testnet", password="testnetpw", ip="localhost", port=8888)
  8.  
  9. last_block_hash = ppcnode.getblockhash(ppcnode.getblockcount())
  10. block_versions = []
  11.  
  12. for i in range(0, number_of_blocks):
  13. block = ppcnode.getblock(last_block_hash)
  14. last_block_hash = block['previousblockhash']
  15. block_versions.append(block['version'])
  16.  
  17. fork_perc = block_versions.count(2) * 100 / number_of_blocks
  18. print(fork_perc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement