Exemple #1
0
async def fetch():
    # WIF private keys
    keys = ["cVks5KCc8BBVhWnTJSLjr5odLbNrWK9UY4KprciJJ9dqiDBenhzr"]

    # Convert them to addresses
    addrs = [wallet.key_to_address(key) for key in keys]
    print("Our addresses:", addrs)

    async with nym_proxy.NymProxy(9001) as nym:
        nym_address = await nym.details()

        multi = multipart.Multipart(nym)

        blockchain_request = {
            "command": "fetch_history",
            "addrs": addrs,
            "return-recipient": nym_address
        }
        print("Sending:", blockchain_request)

        nym_server_address = "AGdb5ZwZBpazKysh9ijCwgzCVRYcvadEhvaxQ3mkBnur"
        await multi.send(blockchain_request, nym_server_address)

        history = await multi.receive()
        display_history(history)
async def client():
    recipient = "kauuj71-RPvETjz8FMQugnsNSDJ8033E4lNS_anMFD0="
    async with nym_proxy.NymProxy(9001) as nym:
        multipart = Multipart(nym)
        message = ["hello world"]
        print("Sending:", message)
        await multipart.send(message, recipient, 5)
Exemple #3
0
async def accept():
    async with nym_proxy.NymProxy(9001) as nym:
        print("Server address =", await nym.details())

        multi = multipart.Multipart(nym)

        while True:
            message = await multi.receive()
            await process(message, multi)
            await asyncio.sleep(0.1)
Exemple #4
0
async def broadcast(tx_data):
    async with nym_proxy.NymProxy(9001) as nym:
        multi = multipart.Multipart(nym)

        request = {"command": "broadcast", "tx_data": tx_data}

        nym_server_address = "kauuj71-RPvETjz8FMQugnsNSDJ8033E4lNS_anMFD0="
        await multi.send(request, nym_server_address)

        print("Sent.")
        await asyncio.sleep(4)
 def __init__(self):
     self.nym = nym_proxy.NymProxy()
async def server():
    async with nym_proxy.NymProxy(9002) as nym:
        #print("Server:", await nym.details())
        multipart = Multipart(nym)
        message = await multipart.receive()
        print("Received:", message)