def create_transaction(self, recipient, amount):
hasher = SHA256.new()
hasher.update("{0},{1},{2:.5f}".format(self.wallet_id, recipient, amount))
signature = self.sign_message(hasher)
command = {'command': 'create_transaction', 'args': {'source': self.wallet_id, 'recipient': recipient, 'amount': "{0:.5f}".format(amount), signature: signature}}
message = json.dumps(command)
await self.socket.send(message)
message = await self.socket.recv()
response = json.loads(message)
if 'error' in response:
print("Error during create_transaction : {0}".format(response['error']))
if 'id' in response:
return response['id']
return None
评论列表
文章目录