我想知道为什么我不能创建正确的以太坊合约地址。我遵循了 https://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed
中的代码结果:
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
有什么问题...