Abi
如何在 Python 或 PHP 中執行 abi.encodePacked?
僅僅連接字元串是行不通的。
Keccak::hash(10 . $address, 256)
是我正在做的自動取款機。
實際上,您可以簡單地連接字元串,如問題所示(這就是 abi.encodePacked 正在做的事情)。
但是,我的問題是數字。
This is because solidity's sha3 function hashes its inputs based on the argument types. Thus the value 1 will generate a different hash if it is stored as bytes8, bytes16, bytes32, etc. Since sha3(1) is being passed 1 as a number literal, it is converted into the smallest necessary type, uint81.