• 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

Why The Clarity Act Could Decide America’s Financial Future W/ John Deaton

Why The Clarity Act Could Decide America’s Financial Future W/ John Deaton

September 16, 2026
XRP Branding Comes to Louisville Basketball in New Ripple Deal

XRP Branding Comes to Louisville Basketball in New Ripple Deal

September 16, 2026
Share76Tweet47

Related Posts

Why The Clarity Act Could Decide America’s Financial Future W/ John Deaton

Why The Clarity Act Could Decide America’s Financial Future W/ John Deaton

by Moussa
September 16, 2026
0

The Senate is voting today, but not on what most people think. John Deaton joins Grace Remington and Sean Hagan...

XRP Branding Comes to Louisville Basketball in New Ripple Deal

XRP Branding Comes to Louisville Basketball in New Ripple Deal

by Moussa
September 16, 2026
0

Key TakeawaysXRP branding will appear permanently on Louisville’s home basketball court.The Ripple deal covers both Louisville men’s and women’s basketball.Ripple...

Congressman Keith Self Moves To Block US CBDC Via Defense Bill Amendment

BTC USD Analysis: Oil, Fed and Senate Uncertainty Weigh on Bitcoin

by Moussa
September 15, 2026
0

BTC USD fell below $77,000 early Tuesday, reversing Monday’s rally above $79,000, as traders watched the Senate’s scheduled procedural vote...

Bitcoin, BTC-Related Stocks Tumble After Senate Blocks Clarity Act

Bitcoin, BTC-Related Stocks Tumble After Senate Blocks Clarity Act

by Moussa
September 15, 2026
0

Bitcoin’s price tumbled — along with crypto-related stocks — following the blockage of the long-awaited Clarity Act.  The price of...

CLARITY Act Isn’t Dead, but Washington Is Running Out of Calendar

CLARITY Act Isn’t Dead, but Washington Is Running Out of Calendar

by Moussa
September 15, 2026
0

Key TakeawaysThe CLARITY Act fell 11 votes short Tuesday, losing its cloture vote 49-50.H.R. 3633 stays on the Senate calendar,...

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]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjIlMjBuYW1lJTNEJTIybm4lMjIlMjBpZC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• Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News