Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation of ecrecover #681

Closed
graup opened this issue Jun 23, 2016 · 17 comments
Closed

Documentation of ecrecover #681

graup opened this issue Jun 23, 2016 · 17 comments
Assignees

Comments

@graup
Copy link
Contributor

graup commented Jun 23, 2016

It would be nice if the documentation would explain the parameters and maybe give an example on how you would use this function.

http://solidity.readthedocs.io/en/latest/units-and-global-variables.html#mathematical-and-cryptographic-functions

@Denton-L
Copy link
Contributor

For now, take a look at this. Hopefully it'll tide you over until I can properly document this.

@Denton-L
Copy link
Contributor

@VoR0220, do you think this should be explicitly stated in these docs or is a quick link to the web3 docs sufficient?

@chriseth
Copy link
Contributor

It does not hurt to mention it explicitly.

@chriseth
Copy link
Contributor

Also either mention or fix the "invalid input" bug for ecrecover.

@Denton-L
Copy link
Contributor

@chriseth, what is this "invalid input" bug?

@axic
Copy link
Member

axic commented Jul 25, 2016

Perhaps including (a link to) https://gist.github.com/axic/5b33912c6f61ae6fd96d6c4a47afde6d could be useful.

@graup
Copy link
Contributor Author

graup commented Jul 25, 2016

I wish the code @axic posted was part of the standard library. Without it ecrecover is pretty useless to the normal developer.

@chriseth chriseth added this to the 4-ecre milestone Aug 11, 2016
@jackliu8722
Copy link

when i use the function ecrecover in solidity, there is something wrong , which i can not get the right result?

@clowdrgn
Copy link

There is a wrong answer when I use ecrecover,the address always be different.but when I use personal_ecRecover,it's right. Is there something different between those two method? I have try those method upstair,web3.eth.sign has the same result with personal.sign.but can't pass solidity ecrecover method too.

@danmermel
Copy link

danmermel commented Apr 22, 2017

Hello, apologies if this is not the correct place to comment on this (and please direct me elsewhere if necessary), but I am having the same issue - following all the examples, including the one linked to from here #2151 , I am unable to get ecrecover to work as documented (i.e. it does not return the signing address). I have posted a more detailed question here https://ethereum.stackexchange.com/questions/15364/totally-baffled-by-ecrecover with details of what I am doing. Can anyone explain what may be wrong?
Thanks!

@axic axic removed this from the 4-ecrecover milestone Jul 30, 2018
@axic axic removed the accepted label Aug 1, 2018
axic pushed a commit that referenced this issue Nov 20, 2018
EIP-681: Payment request URL specification
axic pushed a commit that referenced this issue Nov 20, 2018
@chriseth
Copy link
Contributor

I'm not sure how much detail we would like to mention here. We should mention that a return value of zero means "invalid input" and that the ecrecover builtin still has the "high s" issue, i.e. you can take an existing signature and modify both v and s (IIRC) in a certain way, to get a different but equally valid signature.

@ChrisChinchilla ChrisChinchilla self-assigned this Jan 21, 2019
@ChrisChinchilla
Copy link
Contributor

@chriseth I'm also not very sure of the level of detail here. I can find a lot of questions, but I'm also not sure how many still apply. e.g.

https://ethereum.stackexchange.com/questions/15364/ecrecover-from-geth-and-web3-eth-sign

Also because we bump into the issue of Solidity being part of a toolchain again, most of the examples to show how to use ecrecover properly use something else alongside, I can do that if you think it's a good idea?

@gumb0 had no recollection of the "high s" issue still existing, and neither of us can find any reference to it either.

@chriseth
Copy link
Contributor

"high s" still not documented.

@chriseth chriseth reopened this Feb 27, 2019
@ChrisChinchilla
Copy link
Contributor

@chriseth My comment from the last time we spoke about this remains. There are no search results for "high s", and no one else I spoke to at EF knew what was meant by it. So I am happy to document, but need a little guidance.

@chriseth
Copy link
Contributor

chriseth commented Mar 4, 2019

Openzeppelin are about to fix it in the helper library: OpenZeppelin/openzeppelin-contracts#1622

We should say something along the lines of "if you use the low-level ecrecover function, be aware that a valid signature can be turned into a different valid signature without requiring knowledge of the corresponding private key. This is usually not a problem unless if you require signatures to be unique or use them to identify items."

@ChrisChinchilla
Copy link
Contributor

Does this help @leonardoalt and @chriseth ?

And I wonder if we should hold off on merging until that OZ PR is merged? As I'm not sure this doc is true until that point?

@cdetrio
Copy link
Member

cdetrio commented Mar 27, 2019

(copying from a comment on the PR): the "high s" problem, and why the ecrecover precompile behavior was left unchanged when high s became invalid for transactions, is discussed in the Homestead EIP http://eips.ethereum.org/EIPS/eip-2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants