<p>Since the activation of BIP147 (nulldummy softfork) in 2017, the answer is <strong>no</strong>, this will fail. Before that point it would have been generally non-standard but allowed.</p>
<p>An input to <code>OP_CHECKMULISIG</code> expects on the stack: (from back to front):</p>
<ul>
<li>the number <em>n</em></li>
<li><em>n</em> public keys</li>
<li>the number <em>k</em></li>
<li><em>k</em> signatures</li>
<li>a dummy element (ignored pre-BIP147, must be 0 post-BIP147)</li>
</ul>
<p>In your example, n=6 is read, followed by 6 keys, then k=3, and then 3 signatures. These 3 signatures <em>do</em> match the penultimate 3 keys, which on itself would work. However, after that a 0 is expected, yet instead there is another signature, which fails.</p>
<p>Before BIP147, the signature_2 would function as the dummy, and signature_1, plus a 1 (from the evaluation of <code>OP_CHECKMULTISIG</code>) and 0 would be left on the stack.</p>

CC BY-SA 4.0
2023-11-24T20:02:13.517Z
Actually I provided just 5 signatures (not 6) and the last one is signature_5 (not signature_6). Thus, (before BIP147) signature_3, signature_4 and signature_5 would be taken by the OP_CHECKMULTISIG, signature_2 is dummy (instead of zero), signature_1 plus 1 (as a result of OP_CHECKMULTISIG) would left on the stack. Also zero would left on the stack. Is that more correct or I missed something?
Cosmos
CC BY-SA 4.0
2023-11-24T20:03:57.977Z
@MudjaAdjum That sounds right.
Pieter Wuille
CC BY-SA 4.0
2023-11-24T18:36:19.977Z
2023-11-24T20:06:24.773Z
2023-11-24T20:06:24.773Z
Pieter Wuille
<p>Asked <a href="https://bitcoin.stackexchange.com/questions/34001/multisignature-what-happens-if-the-number-of-signatures-exceeds-the-threshold">here</a> but still no answer.</p>
<p>What would happen if we provide to OP_CHECKMULTISIG opcode more than threshold number (m) of signatures?</p>
<p>For example, if the <code>m = 3</code> and <code>n = 6</code> and the output script is:</p>
<pre><code>3 &lt;pubkey_1&gt; ... &lt;pubkey_6&gt; 6 CHECKMULTISIG
</code></pre>
<p>And we provide, for example, this input script (or witness stack for segWit 0):</p>
<pre><code>0 &lt;signature_1&gt; &lt;signature_2&gt; &lt;signature_3&gt; &lt;signature_4&gt; &lt;signature_5&gt;
</code></pre>
<p>Will it pass or fail?</p>

<script><multi-signature>
What would happen if we provide to OP_CHECKMULTISIG more than threshold number (m) of signatures?
Cosmos
# What would happen if we provide to OP_CHECKMULTISIG more than threshold number (m) of signatures?

(Asked by: username_0 on 2023-11-24)

Asked here but still no answer.
What would happen if we provide to OP_CHECKMULTISIG opcode more than threshold number (m) of signatures?
For example, if the m = 3 and n = 6 and the output script is:
3  ...  6 CHECKMULTISIG

And we provide, for example, this input script (or witness stack for segWit 0):
0     

Will it pass or fail?

**Tags:** script, multi-signature


---

## 1 answers

### Answer by username_1 on 2023-11-24. Score: 4 | Accepted answer

Since the activation of BIP147 (nulldummy softfork) in 2017, the answer is **no**, this will fail. Before that point it would have been generally non-standard but allowed.

An input to `OP_CHECKMULISIG` expects on the stack: (from back to front):

* the number *n*
* *n* public keys
* the number *k*
* *k* signatures
* a dummy element (ignored pre-BIP147, must be 0 post-BIP147)

In your example, n=6 is read, followed by 6 keys, then k=3, and then 3 signatures. These 3 signatures *do* match the penultimate 3 keys, which on itself would work. However, after that a 0 is expected, yet instead there is another signature, which fails.

Before BIP147, the signature\_2 would function as the dummy, and signature\_1, plus a 1 (from the evaluation of `OP_CHECKMULTISIG`) and 0 would be left on the stack.

> **Comments:**
> **username_0**: Actually I provided just 5 signatures (not 6) and the last one is signature_5 (not signature_6). Thus, (before BIP147) signature_3, signature_4 and signature_5 would be taken by the OP_CHECKMULTISIG, signature_2 is dummy (instead of zero), signature_1 plus 1 (as a result of OP_CHECKMULTISIG) would left on the stack. Also zero would left on the stack. Is that more correct or I missed something?  
> **username_1**: @MudjaAdjum That sounds right.  

---

