BIP-383: fix output scripts #1860

pull dr-orlovsky wants to merge 1 commits into bitcoin:master from dr-orlovsky:patch-15 changing 1 files +9 −4
  1. dr-orlovsky commented at 2:10 pm on May 29, 2025: 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.

  2. BIP-383: fix output scripts a92c34ec4b
  3. jonatack added the label Proposed BIP modification on May 29, 2025
  4. jonatack added the label Pending acceptance on May 29, 2025
  5. jonatack commented at 4:04 pm on May 29, 2025: member
    cc BIP authors @achow101 @sipa for feedback
  6. in bip-0383.mediawiki:53 in a92c34ec4b
    52 
    53-if <tt>k</tt> is greater than 16:
    54+if <tt>n</tt> is greater than 16:
    55 <pre>
    56-k KEY_1 KEY_2 ... KEY_n OP_CHECKMULTISIG
    57+k KEY_1 KEY_2 ... KEY_n n OP_CHECKMULTISIG
    


    achow101 commented at 10:05 pm on June 3, 2025:
    This is k and n is greater than 16
  7. achow101 commented at 10:12 pm on June 3, 2025: member

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

  8. jonatack added the label Bug fix on Jun 4, 2025
  9. jonatack commented at 8:34 pm on June 5, 2025: member
    Superseded by #1865 (thanks!)
  10. jonatack closed this on Jun 5, 2025


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bips. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-12 21:10 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me