<blockquote>
  <p>What can this error mean?</p>
</blockquote>

<p>This error can only mean that <a href="https://github.com/bitcoin/bitcoin/blob/ce74799a3c21355b35fed923106d13a0f8133721/src/script/interpreter.cpp#L108" rel="nofollow noreferrer">this function</a> returned false:</p>

<pre><code>bool static IsValidSignatureEncoding(const std::vector&lt;unsigned char&gt; &amp;sig) {
</code></pre>

<p>When does this function return true? When all of these conditions are satisfied:</p>

<pre><code>/**
 * A canonical signature exists of: &lt;30&gt; &lt;total len&gt; &lt;02&gt; &lt;len R&gt; &lt;R&gt; &lt;02&gt; &lt;len S&gt; &lt;S&gt; &lt;hashtype&gt;
 * Where R and S are not negative (their first byte has its highest bit not set), and not
 * excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
 * in which case a single 0 byte is necessary and even required).
</code></pre>

<p>How are you generating your signature?</p>

CC BY-SA 3.0
2017-08-16T22:10:22.013Z
2017-08-16T22:10:22.013Z
Nick ODell
<p>What <em>can</em> this error mean?  I've read through the code for it, and several of my transactions have not met the criteria for the error, yet are still rejected.  I've tried decoding via several means (none are super detailed though) to no avail in discerning the problem.  Some have claimed by reading the bitcoin debug log one can find a more detailed reason, but my log says nothing about my rejected raw transaction.</p>

<p>Yes, there is another question very similar to this, but he provided code so as to get an answer for his specific code and the answers didn't address what <em>could</em> have caused it nor how to discern, more specifically, what may be causing it within the code.</p>

<p>Everything in my transactions that I've been trying are manually created.  But they meet those criteria specified.  I'm remaking some right now, but I was kind of wondering if there are other checks being done besides those you have referenced for this particular error.</p>

<p>I have even considered I got the wrong numbers in my manual creation of the variables, but I would think that would cause it to fail under a different error if that were the case.</p>

<signature><raw-transaction><signature-operations>
What does "16: mandatory-script-verify-flag-failed (Non-canonical DER signature)" error mean?
Mine
# What does "16: mandatory-script-verify-flag-failed (Non-canonical DER signature)" error mean?

(Asked by: username_0 on 2017-08-16)

What *can* this error mean? I've read through the code for it, and several of my transactions have not met the criteria for the error, yet are still rejected. I've tried decoding via several means (none are super detailed though) to no avail in discerning the problem. Some have claimed by reading the bitcoin debug log one can find a more detailed reason, but my log says nothing about my rejected raw transaction.

Yes, there is another question very similar to this, but he provided code so as to get an answer for his specific code and the answers didn't address what *could* have caused it nor how to discern, more specifically, what may be causing it within the code.

Everything in my transactions that I've been trying are manually created. But they meet those criteria specified. I'm remaking some right now, but I was kind of wondering if there are other checks being done besides those you have referenced for this particular error.

I have even considered I got the wrong numbers in my manual creation of the variables, but I would think that would cause it to fail under a different error if that were the case.

**Tags:** signature, raw-transaction, signature-operations


---

## 1 answers

### Answer by username_1 on 2017-08-16. Score: 3 | Accepted answer

> What can this error mean?

This error can only mean that [this function](https://github.com/bitcoin/bitcoin/blob/ce74799a3c21355b35fed923106d13a0f8133721/src/script/interpreter.cpp#L108) returned false:

```
bool static IsValidSignatureEncoding(const std::vector<unsigned char> &sig) {

```

When does this function return true? When all of these conditions are satisfied:

```
/**
 * A canonical signature exists of: <30> <total len> <02> <len R> <R> <02> <len S> <S> <hashtype>
 * Where R and S are not negative (their first byte has its highest bit not set), and not
 * excessively padded (do not start with a 0 byte, unless an otherwise negative number follows,
 * in which case a single 0 byte is necessary and even required).

```

How are you generating your signature?


---

