Skip to content

Conversation

@greenaddress
Copy link

As per https://github.com/bitcoin/bips/blob/master/bip-0062.mediawiki#low-s-values-in-signatures, using values of s bounded by curve.order()/2 can help preventing transaction malleability, by making sure no one other than sender can make different signatures for the same transaction. Combined with additional bitcoind validation to be implemented for transactions with nVersion=3 it prevents issues with transactions modified by third parties otherwise not having control over them.

This change enables this "low S values" behaviour by default in bitcoinjs-lib, without any additional configuration. I think it is important step for compatibility with nVersion=3 and is a good idea to always do it, because there are no counterindications for it AFAICS.

@dcousens
Copy link
Contributor

Seeing as this is a modification to ecdsa, can you please move the appropriate tests to test/ecdsa.js.
It has nothing to do with ECKey, except that you are using ECKey.sign out of convenience.

Will need to review this in depth before +1.

@greenaddress
Copy link
Author

@dcousens test moved, as above.

@dcousens
Copy link
Contributor

+1 looks good to me.

edit: Just remember in future to format your code as per #56

@kyledrake
Copy link
Contributor

@greenaddress This is great, thank you so much for contributing this!

Also wanted to say Green Wallet is an excellent wallet, I really like your guys' work! Please keep sending any fixes you might run into.

kyledrake added a commit that referenced this pull request Apr 17, 2014
Uses low 's' values for signatures
@kyledrake kyledrake merged commit 669444c into bitcoinjs:master Apr 17, 2014
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 this pull request may close these issues.

3 participants