refactor: use deterministic k-value for ECDSA signing to fix bad-protx-sig error#303
Open
LexxXell wants to merge 3 commits intodashpay:masterfrom
Open
refactor: use deterministic k-value for ECDSA signing to fix bad-protx-sig error#303LexxXell wants to merge 3 commits intodashpay:masterfrom
LexxXell wants to merge 3 commits intodashpay:masterfrom
Conversation
- Introduced `ECDSA.prototype.signDeterministicK` method. - Ensures the use of deterministic k-value during the signing me process.
- Replaced `signRandomK()` with `signDeterministicK()` in `Message.prototype._sign`. - This fixes “bad-protx-sig” error on transaction broadcast. Also ensures consistent and deterministic signing for enhanced security and compliance with best practices.
Collaborator
|
We couldn't make a ProRegTx transaction in the JS for a quite time, because of bad-protx-sig error hapenning each time, and we couldn't understand, but Konstantin helped us with getting legit buffer / hash / signature data that made us find the mistake. It seems that function was ported from bitcore, but nobody really have gotten to use it. The Message class implement signing in the randomK mode, which returns you different signature result each time, while Core is working in the deterministic mode. Once we switched the modes, we have been able to correctly sign the payloadSig of ProRegTx and successfully broadcasted transaction in the testnet network. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue being fixed or feature implemented
This change fixes the “bad-protx-sig” error that occurred during transaction broadcasts. It improves the signing process by replacing
signRandomK()withsignDeterministicK(), ensuring deterministic k-value generation for enhanced security and compliance with best practices.What was done?
Message.prototype._signto replaceecdsa.signRandomK()withecdsa.signDeterministicK().How Has This Been Tested?
Breaking Changes
None. The change is backward-compatible, and no breaking changes are introduced.
Checklist: