def mine():
    header
    response = requests.get(Last_Proof, headers=header)
    print(response, "LOOKIE!")
    last_block = response['proof']
    new_proof = proof_of_work(last_block)
    data = {'proof': new_proof}
    response = requests.post(Mine, headers=header, data=data)
    return response
def mine(player):
        header = {
        "Authorization": f"Token {API_KEY}",
        "Content-Type": "application/json",
        }
        response = dreamy.get(
        f"{URL}/api/bc/last_proof/", headers=header)
        last_bl = response["proof"]
        new_proof = proof_of_work(last_bl)
        data = {"proof": new_proof}
        response = dreamy.post(
        f"{URL}/api/bc/mine/", headers=header, data=data)
        print(response)
예제 #3
0
def mine(player):
    header = {
        "Authorization": f"Token {API_KEY}",
        "Content-Type": "application/json",
    }
    response = dreamy.get(f"{URL}/api/bc/last_proof/", headers=header)
    last_bl = response["proof"]
    difficulty = response["difficulty"]
    new_proof = proof_of_work(last_bl, difficulty)
    data = {"proof": new_proof}
    print(f"Submitting proof: {new_proof}")
    response = dreamy.post(f"{URL}/api/bc/mine/", headers=header, data=data)

    # print(response)
    time.sleep(response["cooldown"])
    return response
def mine(player):
    print(
        f"\n⛏️  MINING for a LambdaCoin...", end="", flush=True)
    header = {
        "Authorization": f"Token {API_KEY}",
        "Content-Type": "application/json",
    }
    response = dreamy.get(
        f"{URL}/api/bc/last_proof/", headers=header)
    last_bl = response["proof"]
    difficulty = response["difficulty"]
    new_proof = proof_of_work(last_bl, difficulty)
    data = {"proof": new_proof}
    response = dreamy.post(
        f"{URL}/api/bc/mine/", headers=header, data=data)

    status_message(response)

    # print(response)
    time.sleep(response["cooldown"])
    return response
if status['name'][:4] != 'User':
    while True:
        to_go = int(input('Which room would you like to go to? '))
        to_go_room = gr.get_path_to_room(data, to_go)
        data = to_go_room
        balance = get(end['bal'])
        print('balance ---->', balance)
        if to_go == 55:
            examine = post(end['examine'], {'name': 'well'})
            print('examine well ---->', examine)
            ls8 = examine['description'][39:].split('\n')
            with open('ls8.ls8', 'w') as ls:
                ls.truncate()
                for line in ls8:
                    if line != '':
                        json.dump(int(line), ls)
                        ls.write('\n')
            os.system('python ls8.py ls8.ls8')
        else:
            mining = True
            while mining:
                last_proof = get(end['lp'])
                next_proof = proof_of_work(last_proof)
                check_proof = post(end['mine'], {'proof': next_proof})
                mine_status = post(end['status'], {})
                print('mine_status ---->', mine_status)
                balance = get(end['bal'])
                print('balance ---->', balance)
                if not len(check_proof['errors']):
                    mining = False