for i in range(n):
        print("{}. {}".format(i + 1, client._wallet._addresses[i]['address']))
    user_input = input("Select an address (1-{}): ".format(n))
    try:
        val = int(user_input)
    except ValueError:
        print("Input error")
        raise

    if val > 0 and val <= n:
        address = client._wallet._addresses[val - 1]['address']
        client.set_address(address)
        print("Selected address = ", client.address)
        pwd = input("Enter your anonymizer password: "******"", "", "", "")
        out = phone.fetch_asset_data(pwd)
        operation = "phone:battery"
        recipient = "Bis1QPHone8oYrrDRjAFW1sNjyJjUqHgZhgAw"
        data = json.dumps(out)
        print(data)
        user_input = input("Submit this data (y/n) ? ")
        if user_input == "y":
            client.send(recipient=recipient,
                        amount=1.0,
                        operation=operation,
                        data=data)
            print("Sent")
    else:
        print("Input error")
示例#2
0
"""
Demo Script, send a Bismuth transaction
"""

from bismuthclient.bismuthclient import BismuthClient

if __name__ == "__main__":
    client = BismuthClient(wallet_file='wallet.der')
    if not client.address:
        client.new_wallet()
        client.load_wallet()
    """
    BismuthClient does the heavy lifting of finding and connecting to a working wallet server.
    """
    print(f"My address is {client.address}")  #
    txid = client.send(recipient=client.address, amount=0)  # sends 0 to self
    print(f"Txid is {txid}")

    # client.send(recipient="9ba0f8ca03439a8b4222b256a5f56f4f563f6d83755f525992fa5daf", operation='dragg:transfer', data='draggon_adn')