<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>

CC BY-SA 3.0
2018-01-11T18:57:52.553Z
2018-01-11T18:57:52.553Z
inersha
<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>

CC BY-SA 3.0
2018-01-11T18:56:54.940Z
2018-01-12T05:13:19.930Z
2018-01-12T05:13:19.930Z
Michał Zabielski
<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>

<signature><ecdsa>
How can I fix this: (Non-canonical signature: S value is unnecessarily high)
inersha
# How can I fix this: (Non-canonical signature: S value is unnecessarily high)

(Asked by: username_0 on 2018-01-11)

I've written a small script that will create a bitcoin transaction from scratch, using an [ECDSA library](https://github.com/DavidEGrayson/ruby_ecdsa). 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](https://bitcointalk.org/index.php?topic=1356430.msg13810572#msg13810572):

> 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`?

**Tags:** signature, ecdsa


---

## 2 answers

### Answer by username_0 on 2018-01-11. Score: 3

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

```


---

### Answer by username_1 on 2018-01-11. Score: 2

This is one of the parameters of elliptic curve. The [secp256k1](https://en.bitcoin.it/wiki/Secp256k1) curve used in bitcoin have parameter N set to:

N = FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141


---

