Beispiel #1
0
def addNewClient(role, looper, creatorClient: Client, creatorWallet: Wallet,
                 name: str):
    wallet = Wallet(name)
    wallet.addIdentifier()
    idr = wallet.defaultId

    op = {
        TXN_TYPE: NYM,
        ROLE: role,
        TARGET_NYM: idr,
        ALIAS: name,
        VERKEY: wallet.getVerkey(idr)
    }

    req = creatorWallet.signOp(op)
    creatorClient.submitReqs(req)

    nodeCount = len(creatorClient.nodeReg)
    looper.run(
        eventually(checkSufficientRepliesRecvd,
                   creatorClient.inBox,
                   req.reqId,
                   1,
                   retryWait=1,
                   timeout=3 * nodeCount))
    return wallet
Beispiel #2
0
def add_and_sign(signersNum=10):
    beforeSignTimeBasedId = getTimeBasedId()
    wallet = Wallet("shared wallet")
    idrs = []
    for i in range(signersNum):
        identifier = "signer_{}".format(i)
        idrs.append(identifier)
        wallet.addIdentifier(identifier)
    for idr in idrs:
        signed = wallet.signOp(op={}, identifier=idr)
        afterSignTimeBasedId = getTimeBasedId()
        assert beforeSignTimeBasedId < signed.reqId < afterSignTimeBasedId
Beispiel #3
0
def add_and_sign(signersNum = 10):
    beforeSignTimeBasedId = getTimeBasedId()
    wallet = Wallet("shared wallet")
    idrs = []
    for i in range(signersNum):
        identifier = "signer_{}".format(i)
        idrs.append(identifier)
        wallet.addIdentifier(identifier)
    for idr in idrs:
        signed = wallet.signOp(op={}, identifier=idr)
        afterSignTimeBasedId = getTimeBasedId()
        assert beforeSignTimeBasedId < signed.reqId < afterSignTimeBasedId
Beispiel #4
0
def addNewClient(role, looper, creatorClient: Client, creatorWallet: Wallet,
                 name: str):
    wallet = Wallet(name)
    wallet.addIdentifier()
    idr = wallet.defaultId

    op = {
        TXN_TYPE: NYM,
        ROLE: role,
        TARGET_NYM: idr,
        ALIAS: name,
        VERKEY: wallet.getVerkey(idr)
    }

    req = creatorWallet.signOp(op)
    creatorClient.submitReqs(req)

    nodeCount = len(creatorClient.nodeReg)
    looper.run(eventually(checkSufficientRepliesRecvd, creatorClient.inBox,
                          req.reqId, 1,
                          retryWait=1, timeout=3 * nodeCount))
    return wallet
Beispiel #5
0
 """
 for node in alpha, beta, gamma, delta:
     node.clientAuthNr.addIdr(*idAndKey)
 """
 We give the client a little time to connect
 """
 looper.runFor(3)
 """
 Create a simple message.
 """
 msg = {'life_answer': 42}
 """
 Before sending this message to the pool, the message needs to be signed
 first with a key from the wallet
 """
 request = wallet.signOp(msg, identifier=wallet.defaultId)
 """
 And submit the request to the pool.
 """
 client.submitReqs(request)
 """
 Allow some time for the request to be executed.
 """
 looper.runFor(3)
 """
 Let's get the reply.
 """
 reply, status = client.getReply(request.reqId)
 """
 Check the reply and see if consensus has been reached.
 """
Beispiel #6
0
def sendRandomRequests(wallet: Wallet, client: Client, count: int):
    reqs = [wallet.signOp(randomOperation()) for _ in range(count)]
    return client.submitReqs(*reqs)
Beispiel #7
0
        """
        We give the client a little time to connect
        """
        looper.runFor(3)

        """
        Create a simple message.
        """
        msg = {'life_answer': 42}

        """
        Before sending this message to the pool, the message needs to be signed
        first with a key from the wallet
        """
        request = wallet.signOp(msg, identifier=wallet.defaultId)

        """
        And submit the request to the pool.
        """
        client.submitReqs(request)

        """
        Allow some time for the request to be executed.
        """
        looper.runFor(3)

        """
        Let's get the reply.
        """
        reply, status = client.getReply(request.reqId)
Beispiel #8
0
def sendRandomRequests(wallet: Wallet, client: Client, count: int):
    logger.debug('{} random requests will be sent'.format(count))
    reqs = [wallet.signOp(randomOperation()) for _ in range(count)]
    return client.submitReqs(*reqs)