1

Say Alice and Bob are part of a partnership business that accepts Bitcoin. They store all their main funds in cold storage until the end of 3 months, when they cash out and use a new address. This cold storage is in a single address.

Both Alice and Bob have full nodes, running Bitcoin Core. They use the console feature to generate a 2-of-2 P2SH multisig address, using addmultisignature.

They exchange each other's public keys, and input them as arguments.

If Alice used the following syntax:

addmultisignature 2 '[<alice's key>,<bob's key>]'

and Bob used:

addmultisignature 2 '[<bob's key>,<alice's key>]'

Will they end up with the script hash and address?

Follow up questions:

Can you give certain keys more "weighting" by specifying them more than once?

Does the same logic apply to SegWit (P2WSH) multisigs?

1 Answer 1

3

Is the addmultisignature API call dependent on order of public keys in the array? Or is it lexicographically sorted?

Yes. It is not sorted according to BIP67 automatically.

How did I confirm?

I used the below command in bitcoin core:


addmultisigaddress 2 "[\"0318370919cfceb3d260081eeca3cae19f941eec321f597c48a64839178ea1e3e0\",\"03e783b8cf0474f732cc5d89cc893c25ab8a487785eb541a3ba0b26cfdd38c5c19\",\"02667b6e09a4a82b12cc8e5611373f28673f2cdd2e42b2f7e89825ec82b7f9b054\"]"

to get the multisig address details:


{
  "address": "tb1qlfu3fy8apmm4j73kzlxh9s09rtu6vzeru3l0asfd5ylwfqs7e0zs3hfdpt",
  "redeemScript": "52210318370919cfceb3d260081eeca3cae19f941eec321f597c48a64839178ea1e3e02103e783b8cf0474f732cc5d89cc893c25ab8a487785eb541a3ba0b26cfdd38c5c192102667b6e09a4a82b12cc8e5611373f28673f2cdd2e42b2f7e89825ec82b7f9b05453ae",
  "descriptor": "wsh(multi(2,[85ac4db2]0318370919cfceb3d260081eeca3cae19f941eec321f597c48a64839178ea1e3e0,[90060439]03e783b8cf0474f732cc5d89cc893c25ab8a487785eb541a3ba0b26cfdd38c5c19,[98725f4c]02667b6e09a4a82b12cc8e5611373f28673f2cdd2e42b2f7e89825ec82b7f9b054))#qmw7suql"
}

Tried using the same public keys and the order to create a multisig address in caravan and got the warning that keys are not ordered.

caravan-multisig

Multisig address and Witness script returned are same for both. It changes when I order the keys in caravan:

Address:

 tb1q6xnkaa3sej2x580yjc5j20pcy6x0ddxxc8a9ajlvvn2de2htvvpsnp95vd 

Witness Script:

522102667b6e09a4a82b12cc8e5611373f28673f2cdd2e42b2f7e89825ec82b7f9b054210318370919cfceb3d260081eeca3cae19f941eec321f597c48a64839178ea1e3e02103e783b8cf0474f732cc5d89cc893c25ab8a487785eb541a3ba0b26cfdd38c5c1953ae

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.