user24926: 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?

user50659: This is one of the parameters of elliptic curve. The secp256k1 curve used in bitcoin have parameter N set to:
N = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141

user24926: It seems as though N is the order of the elliptic curve.
Or in other words, the number of possible points on the secp256k1 curve.
N = 115792089237316195423570985008687907852837564279074904382605163141518161494337


24926: <p>I've written a small script that will create a bitcoin transaction from scratch, using an <a href="https://github.com/DavidEGrayson/ruby_ecdsa" rel="nofollow noreferrer">ECDSA library</a>. It works, but sometimes I get this error:</p>

<p><strong>64: non-mandatory-script-verify-flag (Non-canonical signature: S value is unnecessarily high)</strong></p>

<p>I found this reply answer on <a href="https://bitcointalk.org/index.php?topic=1356430.msg13810572#msg13810572" rel="nofollow noreferrer">bitcoin talk</a>:</p>

<blockquote>
  <p>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.</p>
</blockquote>

<p>But what exactly is <code>N</code>?</p>
 50659: <p>This is one of the parameters of elliptic curve. The <a href="https://en.bitcoin.it/wiki/Secp256k1" rel="nofollow noreferrer">secp256k1</a> curve used in bitcoin have parameter N set to:</p>

<p>N = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141</p>
 24926: <p>It seems as though N is the <strong>order</strong> of the elliptic curve.</p>

<p>Or in other words, the <em>number of possible points</em> on the secp256k1 curve.</p>

<pre><code>N = 115792089237316195423570985008687907852837564279074904382605163141518161494337
</code></pre>
