• 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

XRP A Strong Buy Before 2027 Despite 27% Drop: Finance Firm

XRP A Strong Buy Before 2027 Despite 27% Drop: Finance Firm

April 20, 2026
Lydian Launches Visa Platinum Crypto Card To Enable Everyday Spending Of Digital Assets

Lydian Launches Visa Platinum Crypto Card To Enable Everyday Spending Of Digital Assets

April 20, 2026
Share76Tweet47

Related Posts

XRP A Strong Buy Before 2027 Despite 27% Drop: Finance Firm

XRP A Strong Buy Before 2027 Despite 27% Drop: Finance Firm

by Moussa
April 20, 2026
0

They say journalists never truly clock out. But for Christian, that's not just a metaphor, it's a lifestyle. By day,...

Lydian Launches Visa Platinum Crypto Card To Enable Everyday Spending Of Digital Assets

Lydian Launches Visa Platinum Crypto Card To Enable Everyday Spending Of Digital Assets

by Moussa
April 20, 2026
0

Lydian has launched the Lydian Card, a co-branded Visa Platinum card issued by Rain that allows users to spend more...

OKX Launches Simplified ‘Event Contracts’ for Bitcoin and Ether Price Predictions

OKX Launches Simplified ‘Event Contracts’ for Bitcoin and Ether Price Predictions

by Moussa
April 20, 2026
0

Key Takeaways: OKX launched Event Contracts on April 20, 2026, for users to predict BTC and ETH price movements. The...

Ripple CTO Emeritus Warns RLUSD Review Exposed A DeFi Security Red Flag

Ripple CTO Emeritus Warns RLUSD Review Exposed A DeFi Security Red Flag

by Moussa
April 20, 2026
0

Trusted Editorial content, reviewed by leading industry experts and seasoned editors. Ad Disclosure Ripple CTO Emeritus David Schwartz, said his...

Solana (SOL) Faces Another Rejection, Is A Deeper Correction Ahead?

Solana (SOL) Faces Another Rejection, Is A Deeper Correction Ahead?

by Moussa
April 20, 2026
0

Solana failed to settle above $90 and extended losses. SOL price is now consolidating losses below $85 and might struggle...

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]JTNDcCUzRSUzQ2RpdiUyMGNsYXNzJTNEJTIydG5wJTIwdG5wLXN1YnNjcmlwdGlvbiUyMiUzRSUwQSUzQ2Zvcm0lMjBtZXRob2QlM0QlMjJwb3N0JTIyJTIwYWN0aW9uJTNEJTIyaHR0cHMlM0ElMkYlMkZhcHByb3gub3JnJTJGJTNGbmElM0RzJTIyJTNFJTBBJTBBJTNDaW5wdXQlMjB0eXBlJTNEJTIyaGlkZGVuJTIyJTIwbmFtZSUzRCUyMm5sYW5nJTIyJTIwdmFsdWUlM0QlMjIlMjIlM0UlM0NkaXYlMjBjbGFzcyUzRCUyMnRucC1maWVsZCUyMHRucC1maWVsZC1maXJzdG5hbWUlMjIlM0UlM0NsYWJlbCUyMGZvciUzRCUyMnRucC0xJTIyJTNFRmlyc3QlMjBuYW1lJTIwb3IlMjBmdWxsJTIwbmFtZSUzQyUyRmxhYmVsJTNFJTBBJTNDaW5wdXQlMjBjbGFzcyUzRCUyMnRucC1uYW1lJTIyJTIwdHlwZSUzRCUyMnRleHQlMjI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c_row]
No Result
View All Result
  • Contact Us
  • Homepages
  • Business
  • Guide

© 2024 APPROX FOUNDATION - The Crypto Currency News