Skip to content

BIP-383: fix output scripts #1860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dr-orlovsky
Copy link
Contributor

The output scripts given in the specification are invalid for the bitcoin OP_CHECKMULTISIG.

The operator must be preceded with a push of the total number of keys - see https://bitcoin.stackexchange.com/questions/40669/checkmultisig-a-worked-out-example and https://en.bitcoin.it/wiki/OP_CHECKMULTISIG for the details.

@jonatack jonatack added Proposed BIP modification Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified labels May 29, 2025
@jonatack
Copy link
Member

cc BIP authors @achow101 @sipa for feedback

Comment on lines +51 to +53
if <tt>n</tt> is greater than 16:
<pre>
k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
k KEY_1 KEY_2 ... KEY_n n OP_CHECKMULTISIG
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is k and n is greater than 16

@achow101
Copy link
Member

achow101 commented Jun 3, 2025

The script is indeed incorrect and this does fix it.

However, perhaps instead of exhaustively listing the possible k and n values when greater/less than 16, maybe reword it something like "k and n must be minimally encoded, i.e. values less than or equal to 16 are encoded with OP_0 through OP_16, while values greater than 16 are as a push of the signed little endian value with no leading 0's".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Pending acceptance This BIP modification requires sign-off by the champion of the BIP being modified Proposed BIP modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants