在使用 python 对接 web3 的时候,需要对 address 先进行检查。
- Web3.toChecksumAddress
这里面需要注意的是
- for contract address we should accept lower case address because ganache, at the moment, print contract address in lower case.
- for account address we should accept only checksum address.
就是说,如果地址是合约地址,那么地址最好全部小写,否则会出错。账户地址不用考虑大小写。
Web3.py only accepts checksum addresses...Or, if you must accept lower safety, use Web3.toChecksumAddress(lower_case_address).
上述参考资料来自于啊