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

Computing recovery id for ECDSA signature #82

Open
tmpfs opened this issue Nov 23, 2022 · 3 comments · May be fixed by #83
Open

Computing recovery id for ECDSA signature #82

tmpfs opened this issue Nov 23, 2022 · 3 comments · May be fixed by #83

Comments

@tmpfs
Copy link

tmpfs commented Nov 23, 2022

The type ecdsa.Signature included R and S but no recovery id (or v) value which would be required for ethereum-style recoverable signatures.

If memory serves correctly v is just whether the y co-ordinate for the point is negative but looking at the Point type I can't see any way to compute this easily.

Any advice on how we could compute the recovery id for ecdsa.Signature please?

@tmpfs
Copy link
Author

tmpfs commented Nov 23, 2022

@tmpfs tmpfs linked a pull request Nov 23, 2022 that will close this issue
@valli0x
Copy link
Contributor

valli0x commented Jan 24, 2023

@tmpfs I was able to get the value of v and send tx-
signature := signResult.(*ecdsa.Signature)

r, _ := signature.R.MarshalBinary()
s, _ := signature.S.MarshalBinary()
rs := make([]byte, 0)

rs = append(rs, r...)
rs = append(rs, s...)

v := rs[0] - 2
copy(rs, rs[1:])
rs[64] = v

but I got another error - Invalid Signature: s-values greater than secp256k1n/2 are considered invalid https://eips.ethereum.org/EIPS/eip-2 - paragraph 2
https://ethereum.stackexchange.com/questions/55245/why-is-s-in-transaction-signature-limited-to-n-21

@valli0x
Copy link
Contributor

valli0x commented Jan 24, 2023

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

Successfully merging a pull request may close this issue.

2 participants