0

There are many answer which explain how to compute _r, _s, _v with an other language. But how to compute parameters in solidity itself ? Is there a built-in function like ecrecover ?

2
  • This doesn't answer your question but why would you want to do this? Commented May 24, 2018 at 1:55
  • @EdmundEdgar I´m having really a hard time at doing it with web3. Converting hex values to a binary form usable by web3 is an example. I think I need to find a way at doing it with solidity since I'm unable to get the exact code. Commented May 24, 2018 at 10:13

1 Answer 1

1

Computing the v, r, s inputs to ecrecover is another way of saying "create a signature". Normally you wouldn't want to do this in Solidity, as it would imply that the private key was recoverable from the blockchain, and private keys aren't usually useful unless they're private.

Accordingly, Solidity has no built-in function to sign data. I'm not sure if anyone has written a library to do this, and I can't imagine what it would be useful for, but in principle it should be possible.

1

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.