mine.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:two1-python 作者: 21dotco 项目源码 文件源码
def set_payout_address(client, wallet):
    """ Set a new address from the HD wallet for payouts.

    Note that is set server-side on a per-account basis. Thus, in the
    case where a single user has different wallets on different
    machines, all mining proceeds on all machines are sent to this
    address.

    Args:
        client (TwentyOneRestClient): rest client used for communication with the backend api
        wallet (two1.wallet.Wallet): a user's wallet instance

    Returns:
        bytes: extra nonce 1 which is required for computing the coinbase transaction
        int: the size in bytes of the extra nonce 2
        int: reward amount given upon successful solution found
    """
    payout_address = wallet.current_address
    auth_resp = client.account_payout_address_post(payout_address)

    user_info = json.loads(auth_resp.text)
    enonce1_base64 = user_info["enonce1"]
    enonce1 = base64.decodebytes(enonce1_base64.encode())
    enonce2_size = user_info["enonce2_size"]
    reward = user_info["reward"]

    return enonce1, enonce2_size, reward
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号