Looking to create 2 of 3 multisig addresses with the electrum console with public keys (not the master public keys):

electrum createmultisig 2 '["1st public key wallet 1", "1st public key wallet 2", "1st public key wallet 3"]'

This will out put an p2sh address and a redeemScript. The address however only match the first address in an electrum 2 of 3 multisig wallet if public keys are entered in the right order (that has a one in six chance).

Electrum's 2 of 3 multisig wallets have consistent p2sh addresses no matter what order the master public keys are entered. How can createmultisig be used to be consistent with electrum's multisig wallets?

Edit: The suggested answer is the addmultisigaddress command from bitcoin-core (as I understand it correctly), thank you for the suggestion. However the question was how to do so with Electrum console (if possible).

The question is how to (re)create the correct first p2sh address of Electrum's multisig (2 of 3) wallet with master public keys as input, with only the first public keys of each of the master public keys and be consistent with Electrum's multisig (2 of 3) wallet all the time.

Edit2: An example with actual master public keys and there public keys:

Master public key a: xpub661MyMwAqRbcFRS9DDMPDGhicAnYcsELaWwWSviE3nETgBBW6P6FqXCxDobD9h1BqXbjbMEsXkeXyrLUmxANvBw9hi4jxZKjLDyZk3hK7nT  
a's first public key a1: 03722ef79a70b43843c642f3495d2b9b8a6403189d52a04ecac652c133f7940fed

Master public key b: xpub661MyMwAqRbcEqNp5KidkrqspVy5HmMTwuQguSa8LSu6WWDdYMMD13appqVrMgAZyc5FKxSnxuTqNoT2j9PYtFtF67MUNBEzifV6vnd5qW2  
b's first public key b1: 03f9652bfbbfb426eb2011db774c97866e00effdf954cc225807f89b23150dda3a

Master public key c: xpub661MyMwAqRbcEpBbahsh3vPcooVMbEfKAWCx7VNAyGokuShDN2FocJEa7mkcSAkWbkhbewN9TBW9AkoSJPGJoktCXZL98BGTCdZaspiebrA  
c's first public key c1: 03f5ce19296793c6695bfefd7ead459a3f88ef776d8fc08b470dbc749d266d519f

The electrum's (GUI) option to create a multisig (2 of 3) wallet will take master public key a,b and c in any order and give a wallet with the first p2sh address:


Electrum's console command createmultisig will output different p2sh address depending on the order of public keys. Trail and error will get the same p2sh address as the GUI, however my goal is to get the correct address without verifying consistently.

With '["a1", "b1", "c1"]':

electrum createmultisig 2 -o '["03722ef79a70b43843c642f3495d2b9b8a6403189d52a04ecac652c133f7940fed", "03f9652bfbbfb426eb2011db774c97866e00effdf954cc225807f89b23150dda3a", "03f5ce19296793c6695bfefd7ead459a3f88ef776d8fc08b470dbc749d266d519f"]'

    "address": "3EKHKsgn2smYcpeiD6zfR9sgrEp6PrqCTw", 
    "redeemScript": "522102ae1359d50bdc7d5b61c3bab9f293fc01cdab3c2b1151a7309fb2e28540d94e842102b0b20cb5e55204f63c016c3df94c3aadaed931370e49bb94097c97dff485032d2103d5196cd7f661deedb3f27fce93095554e72032c7fd26b1ddfaeac8d6f5d56d0553ae"

With '["a1", "c1", "b1"]':

electrum createmultisig 2 -o '["03722ef79a70b43843c642f3495d2b9b8a6403189d52a04ecac652c133f7940fed", "03f5ce19296793c6695bfefd7ead459a3f88ef776d8fc08b470dbc749d266d519f", "03f9652bfbbfb426eb2011db774c97866e00effdf954cc225807f89b23150dda3a"]'

    "address": "3HRmAEyoBwdHhdntJHFMeR8DxZyCgiaKzV", 
    "redeemScript": "522103722ef79a70b43843c642f3495d2b9b8a6403189d52a04ecac652c133f7940fed2103f5ce19296793c6695bfefd7ead459a3f88ef776d8fc08b470dbc749d266d519f2103f9652bfbbfb426eb2011db774c97866e00effdf954cc225807f89b23150dda3a53ae"

In this example I got "lucky" after the 2nd try and get the same p2sh address after 2 tries of the possible 6 permutations. My question however is how to get the correct order of public keys without verifying the GUI multi (2 of 3) wallet?

  • Are you seeking to use bitcoin-core's addmultisigaddress in a way consistent with electrum, or to use electrum's createmultisig in a way consistent with bitcoin-core?
    – Nick ODell
    Commented Sep 3, 2015 at 21:10
  • 1
    Neither. Seeking to use electrum's createmultisig (console) to be consistent with electrum's multisig wallet (GUI). Want to get the first p2sh address of the electrum's multisig wallet (GUI) by using the first public key of each master public key used to create the electrum's multisig wallet (GUI) with electrum's createmultisig (console). The problem I encounter is that the multisig wallet accept master public key a,b and c in all possible orders and give the same first p2sh address. The createmultisig command with a1, b1 and c1 only one of the permutations give the same p2sh address Commented Sep 3, 2015 at 21:17

1 Answer 1


See BIP45.

Electrum is ordering the pubkeys lexicographically, ie

  1. 03722ef79a70b43843c642f3495d2b9b8a6403189d52a04ecac652c133f7940fed
  2. 03f5ce19296793c6695bfefd7ead459a3f88ef776d8fc08b470dbc749d266d5
  3. 03f9652bfbbfb426eb2011db774c97866e00effdf954cc225807f89b23150dda3a

Note they're all 03, so it's 72=>f5=>f9


Your Answer

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

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