I've written a small script that will create a bitcoin transaction from scratch, using an ECDSA library. It works, but sometimes I get this error:
64: non-mandatory-script-verify-flag (Non-canonical signature: S value is unnecessarily high)
I found this reply answer on bitcoin talk:
The signature is composed of two values, the r value and the s value. In your third input, the s value is greater than N/2, which is not allowed. Just add in some code that if s is greater than N/2, then s = N - s.
But what exactly is N
?