Beispiel #1
0
    # We are going to loop indefinitely
    while True:

        # Get chain properies to identify the
        # head/last reversible block
        props = rpc.get_dynamic_global_properties()

        # Get block number
        # We here have the choice between
        #  * head_block_number: the last block
        #  * last_irreversible_block_num: the block that is confirmed by
        #    2/3 of all block producers and is thus irreversible!
        # We recommend to use the latter!
        # block_number = props['head_block_number']
        block_number = props['last_irreversible_block_num']

        # We loop through all blocks we may have missed since the last
        # block defined above
        while (block_number - last_block) > 0:
            last_block += 1

            # Get full block
            block = rpc.get_block(last_block)

            # Process block
            process_block(block, last_block)

        # Sleep for one block
        time.sleep(block_interval)
        # Get chain properies to identify the 
        # head/last reversible block
        props = rpc.get_dynamic_global_properties()

        # Get block number
        block_number = props['head_block_number']


        # We loop through all blocks we may have missed since the last
        # block defined above
        while (block_number - last_block) > 0:
            last_block += 1

            # Get full block
            block = rpc.get_block(last_block)
            
            #Match witness from block to witness from list and increase block production count of that witness
            for witness in watch_accounts:
                if block["witness"] == witness:
                    count[witness] = count[witness] + 1
       
        os.system('clear')
        
        print("{:^17} {:^17} {:^17} {:^17}".format("witness","produced","missed","reliability"))
        for witness in watch_accounts:
            
            #Gets missed block count from blockchain(for each witness)
            witness_info = rpc.get_witness_by_account(witness)
            missed_count = witness_info["total_missed"]            
            
Beispiel #3
0
    'firstclass', 'enki', 'clayop', 'wackou', 'steemit200', 'kushed', 'xeldal',
    'arhag', 'fuzzyvest', 'pharesim', 'steempty', 'bitcube', 'onceuponatime',
    'witnes.svk', 'abit', 'berniesanders', 'ned', 'dan', 'val-a', 'itsascam',
    'skywalker', 'smooth.witness', 'datasecuritynode', 'au1nethyb1',
    'bitcoin2016', 'analisa', 'paladin', 'satoshifund', 'alphabet',
    'excalibur', 'recursive', 'lafona-miner', 'badassmother', 'xeroc'
]

voterlst = []
authorlst = []
permlinklst = []

# parsing the blocks between Sept 27 - Oct 3 (end of day)

for i in range(5320393, 5521856):
    dys = rpc.get_block(i)['transactions']
    for tx in dys:
        for operation in tx['operations']:
            if operation[0] == 'vote' and operation[1]['voter'] in voters:
                voter = operation[1]['voter']
                author = operation[1]['author']
                permlink = operation[1]['permlink']

                # we're looking for votes on posts, not on comments

                if permlink[:3] != "re-":
                    voterlst.append(voter)
                    authorlst.append(author)

voteCounts = Counter(voterlst)
authorCounts = Counter(authorlst)