New answers tagged

0

However, messages sent to Smart Contracts (SC) aren't signed No. All transactions are signed by an externally owned account (EOA). Transactions sent to contracts are signed by an EOA. A contract runs code, and that might include sending a message to another contract. In this case, the message is not signed because it doesn't need to be signed. The ...


1

Ok I got this to work by hacking into geth and having it show me some debug values and changing my code until they matched. Thing is my test data was wrong because metamask wants to sign a HASH of the message and not the actual MESSAGE like geth does. Wish I had known that before! Anyway here is the working code: std::string ecrecover(std::string sig, std:...


0

Turns out the trick is in not calling Web3's transactionSigner(), it is too high level. Call the ethereumjs-tx library directly: // Regular ethereum tx object const txData = { chainId: '0x11', data: '0x', gas: '0x7530', gasPrice: '0x3b9aca00', nonce: '0x3', to: '0xb414031Aa4838A69e27Cb2AE31E709Bcd674F0Cb', value: '0x64' }; const ...


0

You don’t need to use solidity for that you can use directly web3 like: web3.eth.accounts.recover(hash, v, r, s); (to get the signer address). See https://web3js.readthedocs.io/en/v1.2.0/web3-eth-accounts.html?highlight=recover#recover But if you still want to use solidity you need to deploy the contract with the ecrecover function and call it with web3. ...


Top 50 recent answers are included