BaseClient.py 文件源码

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

项目:cscoins 作者: BrandonWade 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号