Python 通过eth地址确定合同地址
我想知道为什么我不能确定以太坊的合同地址。我遵循了 结果:Python 通过eth地址确定合同地址,python,Python,我想知道为什么我不能确定以太坊的合同地址。我遵循了 结果: def mk_contract_address(sender: str, nonce: int) -> str: """Create a contract address using eth-utils. # https://ethereum.stackexchange.com/a/761/620 """ sender_bytes = t
def mk_contract_address(sender: str, nonce: int) -> str:
"""Create a contract address using eth-utils.
# https://ethereum.stackexchange.com/a/761/620
"""
sender_bytes = to_bytes(hexstr=sender)
raw = rlp.encode([sender_bytes, nonce])
h = keccak(raw)
address_bytes = h[12:]
return to_checksum_address(address_bytes)
print(to_checksum_address(mk_contract_address(to_checksum_address("0xCcE984c41630878b91E20c416dA3F308855E87E2"), 0)))
但返回:
0x10f08E4A832891f27A170031536cAdd3B190D250
正确的结果是:
0xdac17f958d2ee523a2206206994597c13d831ec7
有什么问题吗