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

{'error': 'SubmitTransaction: Problem processing transaction: VerifyAndBroadcastTransaction: Problem validating txn: ValidateTransaction: Problem validating transaction: : ConnectTransaction: : _connectSubmitPost: : _connectBasicTransfer: Problem verifying txn signature: : _verifySignature: high-S deteceted: RuleErrorTxnSigHasHighS'} #478

Closed
nheffelman opened this issue Feb 26, 2023 · 6 comments

Comments

@nheffelman
Copy link

I'm getting this intermittently when submitting a transaction from a python app built with desopy.
I'm using the actual seedhex and public Key
Can anyone explain why or help out?

@starykolarz
Copy link

If desopy is what I think it is - add this:

if bytes.fromhex(hexify(s))[0] >= 0x80:
s = n - s

before the line:
signature = to_DER(hexify(r), hexify(s))

Some knowledge:
https://www.advancingbitcoin.com/blog/evolution-of-the-signature-size-in-bitcoin/
https://www.rfc-editor.org/rfc/rfc6979
https://github.com/karask/python-bitcoin-utils/blob/master/bitcoinutils/keys.py

@nheffelman
Copy link
Author

Thanks, I don't know if this exactly translates, but I will fafo with what I've got

@nheffelman
Copy link
Author

Ok in the desopy library the code is like this

    s = inverse_mod(k, n) * (r * int(seedHex, 16) + int(s256.hex(), 16))
    s = s % n
    # Enforce low-s
    if s > n // 2:
        s = n - s
    signature = to_DER(hexify(r), hexify(s))

@lazynina
Copy link
Member

@nheffelman - were you able to resolve the issue related to signatures?

@nheffelman
Copy link
Author

yes, it was a problem with signing through desopy involving readerpublickey @itsaditya fixed the issue there after I brought it to his attention.

@lazynina
Copy link
Member

@nheffelman - thanks! I'm going to go ahead and close out this issue then.

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

3 participants