• About
  • FAQ
  • Earn Bitcoin while Surfing the net
  • Buy & Sell Crypto on Paxful
Newsletter
Approx Foundation
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
  • Home
    • Home – Layout 1
  • Bitcoin
  • Ethereum
  • Regulation
  • Market
  • Blockchain
  • Business
  • Guide
  • Contact Us
No Result
View All Result
Approx Foundation
No Result
View All Result
Home Bitcoin

transactions – I Get “Non-canonical DER signature” Error

Moussa by Moussa
February 12, 2024
in Bitcoin
0
peer discovery – how to obtain the IP addresses of nodes for mining pools?
189
SHARES
1.5k
VIEWS
Share on FacebookShare on Twitter


As the error message says, your signature is not DER encoded.

An ECDSA signature is composed of two integers, R and s. DER is a method of encoding them. DER for a signature specifies that the signature begin with the byte 0x30, followed by the length in bytes of the rest of the signature, then we have a 0x02 byte followed by R‘s length in bytes followed by R itself as a signed integer, and lastly we have a 0x02 byte followed by s‘s length in bytes, followed by s itself as a signed integer.

For Bitcoin specifically, this is then followed by a single byte to indicate the sighash type.

Let’s try to decode your signature to see where it went wrong:

  • 30 – That’s good, that’s the prefix we expect for proper DER encoding
  • 46 – The length of the signature should be 70 bytes. This looks correct as 70 bytes later we are at the end of the signature
  • 02 – This is the correct prefix for an integer
  • 21 – This tells us the length of R, 33 bytes
  • 009b3beae48e8b1cf4224c2b608815fb67a26f5f006feed0a66ec50e17863175c4 – R itself
  • 02 – This is the correct prefix for an integer
  • 20 – This tells us the length of s, 32 bytes
  • 2029edc4dcb9d7545185c56490ae44b3fad5da1df67d5b773b1fb14a9723e68f – s itself

But we’re actually not at the end of the signature, we have an extra byte of 0x05.

The question is, is one of the lengths wrong, or is the s wrong. My supposition is that the s is wrong. For the secp256k1 curve that Bitcoin uses, both R and s are 256 bit integers. This means that their maximum value is 32 bytes long. Since DER uses signed integers where it interprets the most significant bit as the signedness indicator, we can get 33 byte R and s values only when that MSB is set, and the resulting 33 bytes will always begin with a 0x00 byte. That most significant byte cannot be anything other than 0, otherwise the value would be larger than 256 bits.

Since your s begins with a 0x20 byte, it could not have actually been a 33 byte s. That would mean it’s larger than 256 bits and therefore invalid. However, considering that it is 0x20 I think what could have happened is that you’ve accidentally duplicated the 0x20 size prefix for DER encoding.

If that is what happened, then dropping that first 0x20 from your s should fix the problem. Don’t forget that doing so will change the size of your signature, so you will need to modify the DER size value as well as the size in the Bitcoin script.


Original Answer

As the error message says, your signature is not DER encoded. The length of the DER sequence is short by one byte. You have 0x44 but it should be 0x45.

However I think your signature just has an actual extra 0x20 in it prefixing the second integer, rather than your signature actually being one byte short.



Source link

Related articles

Is Bitcoin Dominance Back? Altcoin Social Media Interest Falls to 2-Year Low

Is Bitcoin Dominance Back? Altcoin Social Media Interest Falls to 2-Year Low

March 9, 2026
Ethereum Price Extends Pullback, $1,920 Support Now Under Threat

Ethereum Price Extends Pullback, $1,920 Support Now Under Threat

March 9, 2026
Share76Tweet47

Related Posts

Is Bitcoin Dominance Back? Altcoin Social Media Interest Falls to 2-Year Low

Is Bitcoin Dominance Back? Altcoin Social Media Interest Falls to 2-Year Low

by Moussa
March 9, 2026
0

Bitcoin just pulled off a massive, nearly 10% rally, briefly touching $74,000 yesterday before settling around its current trading price...

Ethereum Price Extends Pullback, $1,920 Support Now Under Threat

Ethereum Price Extends Pullback, $1,920 Support Now Under Threat

by Moussa
March 9, 2026
0

Ethereum price started a fresh decline below $2,000. ETH is now correcting gains above $1,920 and might decline further in...

US Dollar Climbs to Multi-Month Highs as Iran Conflict and Oil Spike Rattle Markets

US Dollar Climbs to Multi-Month Highs as Iran Conflict and Oil Spike Rattle Markets

by Moussa
March 9, 2026
0

The U.S. dollar is flexing its muscles in early March as geopolitical tensions and rising energy prices have been sending...

How do Bitcoin mining pools typically handle payout frequency versus thresholds?

Multibit seed/ or files to Electrum wallet

by Moussa
March 9, 2026
0

i tried moving multibit wallet as explained here but failed. https://youtu.be/E-KcY6KUVnY i have the seed and password from Multibit wallet...

Hidden Bitcoin Is Creating Chaos in Divorce Courts – What Happens When a Spouse Hides Crypto?

Hidden Bitcoin Is Creating Chaos in Divorce Courts – What Happens When a Spouse Hides Crypto?

by Moussa
March 8, 2026
0

Hiding cash under the mattress is outdated. Hiding Bitcoin in a hardware wallet is the modern version, at least until...

Load More

youssufi.com

sephina.com

[vc_row full_width="stretch_row" parallax="content-moving" vc_row_background="" background_repeat="no-repeat" background_position="center center" footer_scheme="dark" css=".vc_custom_1517813231908{padding-top: 60px !important;padding-bottom: 30px !important;background-color: #191818 !important;background-position: center;background-repeat: no-repeat !important;background-size: cover !important;}" footer_widget_title_color="#fcbf46" footer_button_bg="#fcb11e"][vc_column width="1/4"]

We bring you the latest in Crypto News

[/vc_column][vc_column width="1/4"][vc_wp_categories]
[/vc_column][vc_column width="1/4"][vc_wp_tagcloud taxonomy="post_tag"][/vc_column][vc_column width="1/4"]

Newsletter

[vc_raw_html]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJT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• Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News