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

Can not get address use hash and signature, got "[libsecp256k1] illegal argument: recid >= 0 && recid <= 3"error. #206

Closed
stroyBoard opened this issue Jun 15, 2019 · 3 comments
Assignees

Comments

@stroyBoard
Copy link

stroyBoard commented Jun 15, 2019

Here is my code :

let web3Rinkeby = Web3.InfuraRinkebyWeb3()
let address = try? web3Rinkeby.personal.ecrecover(hash: hash, signature: signature)

hash hex string:
836f4d7315fba68b0f583304b1d2ec79023e55ad858b6751f0933e24fa842410
signature hex string:
4d5bc8ffcbc0a1bb7e5f582a1869ac11d235421b54c156da36a4d9ca08cbae5d1e802d33fafa13b2e5efda4aa00a8efd97cc557bbdff62a118a430d2b7c7b4121b

Is this code right or I should use another method?
I need some help thanks!

@shamatar
Copy link
Contributor

@stroyBoard how did you generate a signature?

@shamatar
Copy link
Contributor

I suspect it’s related to #201, @BaldyAsh

@BaldyAsh BaldyAsh self-assigned this Jun 15, 2019
@stroyBoard
Copy link
Author

@shamatar I may know what is wrong. My coworker generate this signature use java script web3 method, if I make the signature like: 4d5bc8ffcbc0a1bb7e5f582a1869ac11d235421b54c156da36a4d9ca08cbae5d1e802d33fafa13b2e5efda4aa00a8efd97cc557bbdff62a118a430d2b7c7b41200, I can got the right address, the last two character 1b should minus 27 become 00. When I sign a message ,my java coworker told me the same error, I plus 27 to my signature to fix that error.

@yaroslavyaroslav yaroslavyaroslav closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants