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
?
-
This doesn't answer your question but why would you want to do this?– Edmund EdgarCommented 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.– user2284570Commented May 24, 2018 at 10:13
1 Answer
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.
-
I’m forced to use solidity because I cannot modify the smart contract in order to get it working with web3js Commented May 24, 2018 at 9:57