I'm trying to recreate the following solidity statement in python:
I have the correct hash function, but I don't know how to recreate the input "this"
Anyone know how to do this?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
this should be the contract address, which is conventionally represented encoded in hex, prepended by
You probably have to strip the
0x and turn that into a byte array to feed to your hashing function, so if the contract address is in a variable called
addr, do something like:
from sha3 import keccak_256 from rlp.utils import encode_hex, decode_hex myhash = keccak_256(decode_hex(addr[2:])).hexdigest()