You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bytes32 base_message = keccak256(abi.encodePacked(recipient , amount));
function prefixed(bytes32 hash) public returns (bytes32) {
return keccak256(abi.encodePacked( "\x19Ethereum Signed Message:\n32" , hash ));
}
base_message , message_hash
# 0xbccf9f6664ef1f771e15d448d5cccf44e50b6c71a510dc2cb13935e316685e22
# 0x38f9b8b605686af16619c42841e230228373d357f7633f2c91bc9e99329f279a
For python(web3py) I also tried using encode_intended_validator but that also didn't help me at the end. Problem was the same: message Hash was not matching.
Results
We can see here that the hashes of the web3py and solidity matches. Which I was trying, following what @carver suggested, because I want to recover the signer at the end. So, if the messagehash will match the correct signer we will get.
The text was updated successfully, but these errors were encountered:
This is a bug. The code converts the message to a hex-encode string, and then asks encode_defunct() to interpret it as unicode text. Try leaving base_message as pure bytes and simply:
message = encode_defunct(base_message)
Which is equivalent to message = encode_defunct(primitive=base_message)
Let's start with comparing results of solidity, web3py and web3js
Writing a signed message
For python(web3py) I also tried using
encode_intended_validator
but that also didn't help me at the end. Problem was the same: message Hash was not matching.Results
We can see here that the hashes of the web3py and solidity matches. Which I was trying, following what @carver suggested, because I want to recover the signer at the end. So, if the messagehash will match the correct signer we will get.
The text was updated successfully, but these errors were encountered: