print("hive_acc.rep {}".format(hive_acc.rep))
 # balances
 print("bhive_acc.balances  {}".format(bhive_acc.balances))
 print("hive_acc.balances {}".format(hive_acc.balances))
 # get_balances()
 print("bhive_acc.get_balances()  {}".format(bhive_acc.get_balances()))
 print("hive_acc.get_balances() {}".format(hive_acc.get_balances()))
 # reputation()
 print("bhive_acc.get_reputation()  {}".format(bhive_acc.get_reputation()))
 print("hive_acc.reputation() {}".format(hive_acc.reputation()))
 # voting_power()
 print("bhive_acc.get_voting_power()  {}".format(
     bhive_acc.get_voting_power()))
 print("hive_acc.voting_power() {}".format(hive_acc.voting_power()))
 # get_followers()
 print("bhive_acc.get_followers()  {}".format(bhive_acc.get_followers()))
 print("hive_acc.get_followers() {}".format(hive_acc.get_followers()))
 # get_following()
 print("bhive_acc.get_following()  {}".format(bhive_acc.get_following()))
 print("hive_acc.get_following() {}".format(hive_acc.get_following()))
 # has_voted()
 print("bhive_acc.has_voted()  {}".format(
     bhive_acc.has_voted("@thecrazygm/api-methods-list-for-appbase")))
 print("hive_acc.has_voted() {}".format(
     hive_acc.has_voted(
         hivePost("@thecrazygm/api-methods-list-for-appbase"))))
 # curation_stats()
 print("bhive_acc.curation_stats()  {}".format(bhive_acc.curation_stats()))
 print("hive_acc.curation_stats() {}".format(hive_acc.curation_stats()))
 # virtual_op_count
 print("bhive_acc.virtual_op_count()  {}".format(
예제 #2
0
파일: views.py 프로젝트: holgern/hiveview
def followers(request, author):
    account = Account(author, hive_instance=hv)
    followers = account.get_followers(raw_name_list=True, limit=100)
    return render(request, 'blog/follower.html', {'followers': followers})
예제 #3
0
 # balances
 print("bsteem_acc.balances  {}".format(bsteem_acc.balances))
 print("steem_acc.balances {}".format(steem_acc.balances))
 # get_balances()
 print("bsteem_acc.get_balances()  {}".format(bsteem_acc.get_balances()))
 print("steem_acc.get_balances() {}".format(steem_acc.get_balances()))
 # reputation()
 print("bsteem_acc.get_reputation()  {}".format(
     bsteem_acc.get_reputation()))
 print("steem_acc.reputation() {}".format(steem_acc.reputation()))
 # voting_power()
 print("bsteem_acc.get_voting_power()  {}".format(
     bsteem_acc.get_voting_power()))
 print("steem_acc.voting_power() {}".format(steem_acc.voting_power()))
 # get_followers()
 print("bsteem_acc.get_followers()  {}".format(bsteem_acc.get_followers()))
 print("steem_acc.get_followers() {}".format(steem_acc.get_followers()))
 # get_following()
 print("bsteem_acc.get_following()  {}".format(bsteem_acc.get_following()))
 print("steem_acc.get_following() {}".format(steem_acc.get_following()))
 # has_voted()
 print("bsteem_acc.has_voted()  {}".format(
     bsteem_acc.has_voted("@thecrazygm/api-methods-list-for-appbase")))
 print("steem_acc.has_voted() {}".format(
     steem_acc.has_voted(
         hivePost("@thecrazygm/api-methods-list-for-appbase"))))
 # curation_stats()
 print("bsteem_acc.curation_stats()  {}".format(
     bsteem_acc.curation_stats()))
 print("steem_acc.curation_stats() {}".format(steem_acc.curation_stats()))
 # virtual_op_count
예제 #4
0
def benchmark_node(node, how_many_minutes=10, how_many_seconds=30):
    block_count = 0
    history_count = 0
    access_time = 0
    follow_time = 0
    blockchain_version = u'0.0.0'
    successful = True
    error_msg = None
    start_total = timer()
    max_batch_size = None
    threading = False
    thread_num = 16

    authorpermvoter = u"@gtg/hive-pressure-4-need-for-speed|gandalf"
    [author, permlink, voter] = resolve_authorpermvoter(authorpermvoter)
    authorperm = construct_authorperm(author, permlink)
    last_block_id = 19273700
    try:
        hv = Hive(node=node, num_retries=3, num_retries_call=3, timeout=30)
        blockchain = Blockchain(hive_instance=hv)
        blockchain_version = hv.get_blockchain_version()

        last_block = Block(last_block_id, hive_instance=hv)

        stopTime = last_block.time() + timedelta(seconds=how_many_minutes * 60)
        total_transaction = 0

        start = timer()
        for entry in blockchain.blocks(start=last_block_id, max_batch_size=max_batch_size, threading=threading, thread_num=thread_num):
            block_no = entry.identifier
            block_count += 1
            if "block" in entry:
                trxs = entry["block"]["transactions"]
            else:
                trxs = entry["transactions"]

            for tx in trxs:
                for op in tx["operations"]:
                    total_transaction += 1
            if "block" in entry:
                block_time = parse_time(entry["block"]["timestamp"])
            else:
                block_time = parse_time(entry["timestamp"])

            if block_time > stopTime:
                last_block_id = block_no
                break
            if timer() - start > how_many_seconds or quit_thread:
                break
    except NumRetriesReached:
        error_msg = 'NumRetriesReached'
        block_count = -1
    except KeyboardInterrupt:
        error_msg = 'KeyboardInterrupt'
        # quit = True
    except Exception as e:
        error_msg = str(e)
        block_count = -1

    try:
        hv = Hive(node=node, num_retries=3, num_retries_call=3, timeout=30)
        account = Account("gtg", hive_instance=hv)
        blockchain_version = hv.get_blockchain_version()

        start = timer()
        for acc_op in account.history_reverse(batch_size=100):
            history_count += 1
            if timer() - start > how_many_seconds or quit_thread:
                break
    except NumRetriesReached:
        error_msg = 'NumRetriesReached'
        history_count = -1
        successful = False
    except KeyboardInterrupt:
        error_msg = 'KeyboardInterrupt'
        history_count = -1
        successful = False
        # quit = True
    except Exception as e:
        error_msg = str(e)
        history_count = -1
        successful = False

    try:
        hv = Hive(node=node, num_retries=3, num_retries_call=3, timeout=30)
        account = Account("gtg", hive_instance=hv)
        blockchain_version = hv.get_blockchain_version()

        start = timer()
        Vote(authorpermvoter, hive_instance=hv)
        stop = timer()
        vote_time = stop - start
        start = timer()
        Comment(authorperm, hive_instance=hv)
        stop = timer()
        comment_time = stop - start
        start = timer()
        Account(author, hive_instance=hv)
        stop = timer()
        account_time = stop - start
        start = timer()
        account.get_followers()
        stop = timer()
        follow_time = stop - start
        access_time = (vote_time + comment_time + account_time + follow_time) / 4.0
    except NumRetriesReached:
        error_msg = 'NumRetriesReached'
        access_time = -1
    except KeyboardInterrupt:
        error_msg = 'KeyboardInterrupt'
        # quit = True
    except Exception as e:
        error_msg = str(e)
        access_time = -1
    return {'successful': successful, 'node': node, 'error': error_msg,
            'total_duration': timer() - start_total, 'block_count': block_count,
            'history_count': history_count, 'access_time': access_time, 'follow_time': follow_time,
            'version': blockchain_version}