Beispiel #1
0
from eospy.cleos import Cleos
import time

ce = Cleos(url='https://api.eosnewyork.io')

f = open('result.txt', 'a')

#print(resp['id'])
#print(resp['timestamp'])

#Start from block num 30,000,000
bnStart = 30837944
bn = bnStart

while 1:
    resp = ce.get_block(bn)
    testStr = resp['timestamp'][17:]
    print(testStr)

    if testStr == '00.000' or testStr == '00.500':
        f.write(
            str(resp['block_num']) + '  ' + resp['timestamp'] + '  ' +
            resp['id'][-2:] + '\n')
        break
    else:
        bn += 1
        time.sleep(0.5)

countRe = 1
bn += 115
Beispiel #2
0
    now = datetime.now()

    while now.second != 0:
        time.sleep(0.1)
        now = datetime.now()

    resp = ce.get_info()
    blockTime = resp['head_block_time']
    blockNum = resp['head_block_num']
    lhdStr = resp['head_block_id'][-2:]

    #print(blockNum, blockTime, lhdStr)

    if blockT(blockTime) != 0:
        newBlockNum = blockNum - 1
        respNew = ce.get_block(newBlockNum)
        newBlockTime = respNew['timestamp']

        #print(newBlockNum, newBlockTime, lhdStr)

        while blockT(newBlockTime) < blockT(blockTime):
            blockNum = newBlockNum
            blockTime = newBlockTime
            lhdStr = respNew['id'][-2:]

            newBlockNum = blockNum - 1
            respNew = ce.get_block(newBlockNum)
            newBlockTime = respNew['timestamp']

            #print(newBlockNum, newBlockTime, lhdStr)