0

I am trying to build some low-level provider stuff and I am wondering what I should sign when I try to implement personal_signMessage and eth_sign.

Basically, every windows.ethereum.request() has a method and a params object. When the method is sendTransaction it is very clear what the params are. They are to, from, data and so on. But when the method is eth_sign, personal_sign, eth_signTypedData what should be signed from the params object? Most of the times it's just an array with string like 0x123 or something.

Is there a standart for what should be signed?

Thanks!

1 Answer 1

1

Read the relevant docs here and here

In regards to eth_sign and eth_signTypedData, which were implemented in EIP712, these params are address and typedData where the latter is a JSON object, the schema for which can be seen in the docs linked above.

You can follow these docs to see what the params are in order to architect your implementation.

For personal_sign, for example, it requires you use web3.toHex in encoding your function's param:

web3.personal.sign(web3.toHex("signing message goes here"), <FROM-ADDRESS>, function(err, 
signature) {
      console.log(signature);
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.