Skip to content

Conversation

@theStack
Copy link
Contributor

@theStack theStack commented Oct 18, 2021

This PR is a follow-up to #22363 and #23118 and introduces a helper keys_to_multisig_script for creating bare multisig outputs in the form of

OP_K PubKey1 PubKey2 ... PubKeyN OP_N OP_CHECKMULTISIG

The function takes a list of pubkeys (both hex- and byte-strings are accepted due to the script_util.check_key helper being used internally) and optionally a threshold k. If no threshold is passed, a n-of-n multisig output is created, with n being the number of passed pubkeys.

@DrahtBot DrahtBot added the Tests label Oct 18, 2021
@practicalswift
Copy link
Contributor

practicalswift commented Oct 19, 2021

Concept ACK

The canonical bare multisig construction in keys_to_multisig_script looks good. FWIW see #23285 for some non-canonical bare multisig constructions we also consider IsStandard :)

@theStack theStack force-pushed the 202110-test-add_helper_for_bare_multisig_scripts branch from 31ca61b to 61cf9ac Compare October 19, 2021 11:07
@theStack
Copy link
Contributor Author

Rebased on master and changed threshold parameter name from "m" to "k", to match the optech style guide (as suggested by MarcoFalke).

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 20, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

No conflicts as of last run.

@theStack theStack force-pushed the 202110-test-add_helper_for_bare_multisig_scripts branch from 61cf9ac to 4718897 Compare October 26, 2021 12:53
@theStack
Copy link
Contributor Author

Rebased on master.

Copy link
Contributor

@shaavan shaavan left a comment

Choose a reason for hiding this comment

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

utACK 4718897

This PR declares a new helper function keys_to_multisig_script in the file script_util.py, which serves two purposes:

  1. Helps simplify the code; each time, a bare multisig script needs to be created.
  2. Reduce the number of times different files have to import CScript and OP_CHECKMULTISIG as dependencies.

Copy link
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

tACK 4718897

Verified that no other bare multisig cases exists.

@maflcko maflcko merged commit ab25ef8 into bitcoin:master Oct 27, 2021
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Oct 27, 2021
…ating bare multisig scripts

4718897 test: add script_util helper for creating bare multisig scripts (Sebastian Falbesoner)

Pull request description:

  This PR is a follow-up to bitcoin#22363 and bitcoin#23118 and introduces a helper `keys_to_multisig_script` for creating bare multisig outputs in the form of
  ```
  OP_K PubKey1 PubKey2 ... PubKeyN OP_N OP_CHECKMULTISIG
  ```
  The function takes a list of pubkeys (both hex- and byte-strings are accepted due to the `script_util.check_key` helper being used internally) and optionally a threshold _k_. If no threshold is passed, a n-of-n multisig output is created, with _n_ being the number of passed pubkeys.

ACKs for top commit:
  shaavan:
    utACK 4718897
  rajarshimaitra:
    tACK bitcoin@4718897

Tree-SHA512: b452d8a75b0d17316b66ac4ed4c6893fe59c7c417719931d4cd3955161f59afca43503cd09b83a35b5a252a122eb3f0fbb9da9f0e7c944cf8da572a02219ed9d
@bitcoin bitcoin locked and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants