Post
Topic
Board Announcements (Altcoins)
Re: [ANN][GAP] Gapcoin - Prime Gap Search - New Math Algo - CPU / GPU - Zero Premine
by
sparkster
on 24/09/2024, 22:35:57 UTC
So with python2 and pyjsonrpc I can collect data about how many times blocks with each shift had been mined, but it works veeeeeery slow. Almost 1 min for 1000 blocks, so something like 1.5 days for the whole blockchain. And I don't know any better. I do not want to try this, for now at least. First time in my life i'm writing something in python.

Code:
#!/usr/bin/env python
# coding: utf-8

import pyjsonrpc

http_client = pyjsonrpc.HttpClient(
    url = "http://localhost:31397",
    username = "username_here",
    password = "password_here"
)
blockcountvar = http_client.call("getblockcount")
shift_array = [0]*1024
current_block = 0
while current_block < blockcountvar:
    hashvar = http_client.call("getblockhash",blockcountvar)
    block_data = http_client.call("getblock",hashvar)
    current_shift = block_data["shift"]
    shift_array[current_shift] += 1
    current_block += 1
for x in range (16,1024):
    print ("shift %d:" % (x))
    print shift_array[x]

#werks