deso-protocol / core

DeSo core node
https://docs.deso.org
MIT License
325 stars 107 forks source link

{'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 closed 1 year ago

nheffelman commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

nheffelman commented 1 year ago

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 commented 1 year ago

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

nheffelman commented 1 year ago

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

lazynina commented 1 year ago

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