BIP 67 Sorted Multisig Keys: This guide explains BIP 67 Deterministic Pay-to-script-hash multi-signature addresses through public key sorting in plain English. It covers the problem behind the BIP, why it matters and whether the proposal is part of Bitcoin today.
TL;DR
- What it is: BIP 67 makes a legacy P2SH multisignature account deterministic by requiring compressed public keys to be sorted lexicographically by their binary encoding before the redeem script is built. Without a shared order, the same keys and threshold can produce many valid scripts and addresses.
- Why it matters: BIP 67 removes key-order ambiguity from legacy P2SH multisig through one simple binary sort. That determinism is valuable only when compressed keys, threshold, origins and script wrapper are all preserved and independently verified.
- Current position: The BIP is Complete as an application convention; Bitcoin consensus cannot infer or enforce the intended key order behind a script hash.
BIP 67 Sorted Multisig Keys in simple English
BIP 67 Sorted Multisig Keys: A multisig redeem script serialises M, each public key in sequence, N and CHECKMULTISIG. Reordering keys changes the script bytes, HASH160 commitment and P2SH address even though the same quorum could sign.
Simple example
A node operator is checking BIP 67 Sorted Multisig Keys. For N keys there can be many permutations, multiplied further when compressed and uncompressed encodings are mixed.
Key terms in plain English
- BIP:
- Bitcoin Improvement Proposal: a document describing a proposed rule, standard or process. Its status must be checked separately.
- Consensus:
- The shared rules full nodes use to decide whether blocks and transactions are valid.
- Node:
- A computer running Bitcoin software that checks data and communicates with other peers.
Why ordering changes the address
A multisig redeem script serialises M, each public key in sequence, N and CHECKMULTISIG. Reordering keys changes the script bytes, HASH160 commitment and P2SH address even though the same quorum could sign. For N keys there can be many permutations, multiplied further when compressed and uncompressed encodings are mixed.
Compressed keys only
BIP 67 accepts the 33-byte compressed public-key representation beginning with 02 or 03. An uncompressed key signals incompatible software and must not be silently compressed because that transformation changes the agreed script input. Participants should exchange and validate canonical public-key bytes before funding.
Binary lexicographic sorting
Implementations compare full compressed byte arrays from the first byte onward and order them ascending. Sorting displayed hexadecimal text gives the same result only when it faithfully represents those fixed-length bytes with consistent case and no prefixes. Locale-aware or natural-number sorting is incorrect.
Building the redeem script
After sorting, software inserts the threshold and ordered keys into a standard multisig script, then applies BIP 16 script hashing and network encoding. Every cosigner should derive the exact script and address independently. A matching display address is useful; a matching script hash and redeem-script bytes are stronger evidence.
Application convention, not consensus
P2SH hides the redeem script until spending, so the network cannot know whether a wallet followed BIP 67 at funding time. Enforcing a particular order globally would change validity expectations. Compatibility depends on every wallet participant and recovery tool intentionally applying the same convention.
Recovery and service independence
Sorted keys let a user with the threshold and participant public data reconstruct addresses without a specific service provider. The benefit disappears if origins, derivation paths or wrapper are missing. Modern descriptors can state sortedmulti explicitly and should be checked against historical P2SH scripts before migration.
How specialists test it
Developers test the proposal with made-up data on an isolated test network. They check normal cases and deliberately invalid cases. Different implementations should reach the same result before anyone relies on the proposal.
Frequently asked questions
What is the main point of BIP 67 Sorted Multisig Keys?
BIP 67 Sorted Multisig Keys: A multisig redeem script serialises M, each public key in sequence, N and CHECKMULTISIG.
For BIP 67 Sorted Multisig Keys, why ordering changes the address?
A multisig redeem script serialises M, each public key in sequence, N and CHECKMULTISIG.
For BIP 67 Sorted Multisig Keys, what should a beginner know about compressed keys only?
BIP 67 accepts the 33-byte compressed public-key representation beginning with 02 or 03.
For BIP 67 Sorted Multisig Keys, what should a beginner know about binary lexicographic sorting?
Implementations compare full compressed byte arrays from the first byte onward and order them ascending.
Conclusion
BIP 67 removes key-order ambiguity from legacy P2SH multisig through one simple binary sort. That determinism is valuable only when compressed keys, threshold, origins and script wrapper are all preserved and independently verified.
Primary sources
- BIP 67 Deterministic multisig key sorting
- BIP 16 Pay to Script Hash
- BIP 45 Deterministic P2SH multisignature wallets
Check the current specification status and the documentation for the exact implementation you operate before moving production funds or changing a mining node.
Join the ASIC Mining Discussion
Members can read and join the discussion
Log in to read comments from other miners. Create a free account if you would like to ask a question or share your experience.
Membership helps us protect the discussion from spam and keep answers useful.