def test_electrum_multisig_seed_standard(self): seed_words = 'blast uniform dragon fiscal ensure vast young utility dinosaur abandon rookie sure' self.assertEqual(seed_type(seed_words), 'standard') ks1 = keystore.from_seed(seed_words, '', True) self._check_seeded_keystore_sanity(ks1) self.assertTrue(isinstance(ks1, keystore.BIP32_KeyStore)) self.assertEqual( ks1.xpub, 'xpub661MyMwAqRbcGNEPu3aJQqXTydqR9t49Tkwb4Esrj112kw8xLthv8uybxvaki4Ygt9xiwZUQGeFTG7T2TUzR3eA4Zp3aq5RXsABHFBUrq4c' ) ks2 = keystore.from_xpub( 'xpub661MyMwAqRbcGfCPEkkyo5WmcrhTq8mi3xuBS7VEZ3LYvsgY1cCFDbenT33bdD12axvrmXhuX3xkAbKci3yZY9ZEk8vhLic7KNhLjqdh5ec' ) self._check_xpub_keystore_sanity(ks2) self.assertTrue(isinstance(ks2, keystore.BIP32_KeyStore)) w = self._create_multisig_wallet(ks1, ks2) self.assertEqual( w.get_receiving_addresses()[0], address_from_string('32ji3QkAgXNz6oFoRfakyD3ys1XXiERQYN')) self.assertEqual( w.get_change_addresses()[0], address_from_string('36XWwEHrrVCLnhjK5MrVVGmUHghr9oWTN1'))
def test_bip39_multisig_seed_bip45_standard(self): seed_words = 'treat dwarf wealth gasp brass outside high rent blood crowd make initial' self.assertEqual(keystore.bip39_is_checksum_valid(seed_words), (True, True)) ks1 = keystore.from_bip39_seed(seed_words, '', "m/45'/0") self.assertTrue(isinstance(ks1, keystore.BIP32_KeyStore)) self.assertEqual( ks1.xpub, 'xpub69xafV4YxC6o8Yiga5EiGLAtqR7rgNgNUGiYgw3S9g9pp6XYUne1KxdcfYtxwmA3eBrzMFuYcNQKfqsXCygCo4GxQFHfywxpUbKNfYvGJka' ) ks2 = keystore.from_xpub( 'xpub6Bco9vrgo8rNUSi8Bjomn8xLA41DwPXeuPcgJamNRhTTyGVHsp8fZXaGzp9ypHoei16J6X3pumMAP1u3Dy4jTSWjm4GZowL7Dcn9u4uZC9W' ) self._check_xpub_keystore_sanity(ks2) self.assertTrue(isinstance(ks2, keystore.BIP32_KeyStore)) w = self._create_multisig_wallet(ks1, ks2) self.assertEqual( w.get_receiving_addresses()[0], address_from_string('3H3iyACDTLJGD2RMjwKZcCwpdYZLwEZzKb')) self.assertEqual( w.get_change_addresses()[0], address_from_string('31hyfHrkhNjiPZp1t7oky5CGNYqSqDAVM9'))
def test_multisig(self, tmp_storage) -> None: wallet = Wallet(tmp_storage) seed_words = ( 'blast uniform dragon fiscal ensure vast young utility dinosaur abandon ' + 'rookie sure') ks1 = from_seed(seed_words, '') ks2 = from_xpub( 'xpub661MyMwAqRbcGfCPEkkyo5WmcrhTq8mi3xuBS7VEZ3LYvsgY1cCFDben' + 'T33bdD12axvrmXhuX3xkAbKci3yZY9ZEk8vhLic7KNhLjqdh5ec') keystore = Multisig_KeyStore({'m': 2, 'n': 2, "cosigner-keys": []}) keystore.add_cosigner_keystore(ks1) keystore.add_cosigner_keystore(ks2) assert not keystore.is_watching_only() assert 2 == len(keystore.get_cosigner_keystores()) masterkey_row = wallet.create_masterkey_from_keystore(keystore) account_row = AccountRow(1, masterkey_row.masterkey_id, ScriptType.MULTISIG_BARE, 'text') account = MultisigAccount(wallet, account_row, [], []) wallet.register_account(account.get_id(), account) check_legacy_parent_of_multisig_wallet(wallet) check_create_keys(wallet, account_row.default_script_type)
def test_multisig(self, tmp_storage) -> None: parent_wallet = ParentWallet.as_legacy_wallet_container(tmp_storage) seed_words = ( 'blast uniform dragon fiscal ensure vast young utility dinosaur abandon ' + 'rookie sure') ks1 = from_seed(seed_words, '', True) ks2 = from_xpub( 'xpub661MyMwAqRbcGfCPEkkyo5WmcrhTq8mi3xuBS7VEZ3LYvsgY1cCFDben' + 'T33bdD12axvrmXhuX3xkAbKci3yZY9ZEk8vhLic7KNhLjqdh5ec') keystores = [ks1, ks2] keystore_usages = [] for i, k in enumerate(keystores): keystore_usage = parent_wallet.add_keystore(k.dump()) keystore_usage['name'] = f'x{i+1}/' keystore_usages.append(keystore_usage) child_wallet = Multisig_Wallet.create_within_parent( parent_wallet, keystore_usage=keystore_usages, wallet_type="2of2") check_legacy_parent_of_multisig_wallet(parent_wallet)