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 ?
Asked
Active
Viewed 376 times
0
user2284570
- 1,008
- 1
- 12
- 30
-
This doesn't answer your question but why would you want to do this? – Edmund Edgar May 24 '18 at 01: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. – user2284570 May 24 '18 at 10:13
1 Answers
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.
Edmund Edgar
- 16,897
- 1
- 29
- 58
-
I’m forced to use solidity because I cannot modify the smart contract in order to get it working with web3js – user2284570 May 24 '18 at 09:57