Bitcoin Forum
September 27, 2024, 01:54:06 AM *
News: Latest Bitcoin Core release: 27.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Transaction problem with converting a high-S value to a low-S value  (Read 62 times)
Gniat93 (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
September 10, 2024, 06:01:26 PM
Last edit: September 15, 2024, 07:09:18 AM by Gniat93
 #1

I created a bitcoin transaction but I'm getting an error when trying to broadcast it:

mandatory-script-verify-flag-failed (Non-canonical signature: S value is unnecessarily high) (code 16)


HEX-WITH-HIGH-S

Code:
0100000001fe84d378379a44b5751e89f5145916abe2ec18c03735ad811fc656a34628dd22000000008c493046022100ac792f9d39b644835b9eabbeba9d48897385c721291267d07a850fbb07e5d9a1022100a552e1f28efb3dbd3ca6a360bc0e28f5cf0d73f4ba96202451be1129433a67b501410493249c6c4b75ce574e4f1ecc07117668f5ca7fd73ead514843ad4a9d4195c8f7b41662586dc61bcf920ef53031770afa183be244e88d6cc75d16de97f2da6d1dfeffffff02006d7c4d00000000160014bce56fa1231ff207fee8c421060faeb08f47813cf09c8a29000000001976a914687ff91a13091d31303c1bd7d27f23b610d52ac488ace2220d00

I googled it and seems the problem is that S value in ScriptSig is High. I probably found a working method to convert my High-S value
Code:
a552e1f28efb3dbd3ca6a360bc0e28f5cf0d73f4ba96202451be1129433a67b501
to Low-s value
Code:
aad1e0d7104c242c3595c9f43f1d708eba168f1f4b280176e144d638cfbd98c01
, but im not sure does it implement it well, because it still doesn't work.


HEX-WITH-LOW-S

Code:
0100000001fe84d378379a44b5751e89f5145916abe2ec18c03735ad811fc656a34628dd22000000008c493046022100ac792f9d39b644835b9eabbeba9d48897385c721291267d07a850fbb07e5d9a1022100a552e1f28efb3dbd3ca6a360bc0e28f5cf0d73f4ba96202451be1129433a67b501410493249c6c4b75ce574e4f1ecc07117668f5ca7fd73ead514843ad4a9d4195c8f7b41662586dc61bcf920ef53031770afa183be244e88d6cc75d16de97f2da6d1dfeffffff02006d7c4d00000000160014bce56fa1231ff207fee8c421060faeb08f47813cf09c8a29000000001976a914687ff91a13091d31303c1bd7d27f23b610d52ac488ace2220d00

Could someone help me with that? Any help would be appreciated.

BitMaxz
Legendary
*
Offline Offline

Activity: 3388
Merit: 3111


Is the $100k BTC possible?


View Profile WWW
September 10, 2024, 07:41:11 PM
 #2

I'm not familiar with the error code is this from openssl when broadcasting a transaction?

I tried to search a bit and I found a similar issue but the error code is different. I tried to search here on the forum and  I found a similar error code he fixed the issue so it might also work for you check the post from this link below

- https://bitcointalk.org/index.php?topic=5226185.msg53958884#msg53958884

pooya87
Legendary
*
Offline Offline

Activity: 3584
Merit: 10903



View Profile
September 11, 2024, 04:56:18 AM
Merited by ABCbits (3), nc50lc (1)
 #3

In ECDSA when you create a signature (r,s) using your private key, the (r,-s) signature is also a valid signature and anybody can compute -s without needing your private key.
That creates a malleability issue. Meaning any node receiving your transaction can just negate the s value in your signature(s) and create a malleated transaction that would also have a different transaction ID for legacy transactions.

To prevent that, the nodes only accept one of the two equivalent "s" values that is considered a "low s" meaning a value that is lower than half the curve order and reject the other one with the error message you saw.

So whenever you sign a transaction, you just need to check your final s value and if it were bigger than N/2 you simply negate it.
Code:
s ≡ -s ≡ N - s (mod N)

Gniat93 (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
September 11, 2024, 07:37:12 AM
 #4

Thank You BitMaxz and pooya87 for your replays.

To clarify, I am not the creator of the transaction or the owner of the wallet, but the recipient of the transaction.

I've looked through all the topics with similar problems, probably I'm making a mistake by adding the s-value manually, because I have no idea about how to do it correctly.

In this post https://bitcointalk.org/index.php?topic=1356430.0, user luv2drnkbr corrected and broadcasted this transaction by having only hex. I'm following this but I'm not sure if I did everything right, but since I don't have access to wallet, I assume this is my only hope.

Assuming I calculated the low-S value correctly, what should I do to add it to the hex properly?

BTW.
I'm also considering the possibility that I was scammed... any help figuring this out would be greatly appreciated.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!