我的目标是使用导入的私钥根据EIP712从python代码中签名一条消息。
构造要签名的消息,我使用:https://github.com/ConsenSys/py-eip712-structs
在创建正确的对象之后,我可以将其转换为:
# Into a message dict - domain required
my_msg = mine.to_message(domain)
# Into message JSON - domain required.
# This method converts bytes types for you, which the default JSON encoder won't handle.
my_msg_json = mine.to_message_json(domain)
# Into signable bytes - domain required
my_bytes = mine.signable_bytes(domain)然而,我不清楚如何从这里着手。这3种输出中的哪一种可以作为输入:https://web3py.readthedocs.io/en/stable/web3.eth.account.html?highlight=sign#sign-a-message
还是我需要使用:https://web3py.readthedocs.io/en/stable/web3.eth.html?highlight=structured#web3.eth.Eth.sign_打字_数据
不幸的是,这显然只是转发到一个中华人民共和国-节点,所以不可能使用它只是在python。
发布于 2022-08-25 17:39:34
“可指示字节”可能需要传递到keccak256()中,如果EIP712库还没有这样做的话。对keccak256哈希签名以进行签名。
https://ethereum.stackexchange.com/questions/107678
复制相似问题