def test_bip32_extended_version_bytes(self, mock_write): seed_words = 'crouch dumb relax small truck age shine pink invite spatial object tenant' self.assertEqual(keystore.bip39_is_checksum_valid(seed_words), (True, True)) bip32_seed = keystore.bip39_to_seed(seed_words, '') self.assertEqual('0df68c16e522eea9c1d8e090cfb2139c3b3a2abed78cbcb3e20be2c29185d3b8df4e8ce4e52a1206a688aeb88bfee249585b41a7444673d1f16c0d45755fa8b9', bh2u(bip32_seed)) def create_keystore_from_bip32seed(xtype): ks = keystore.BIP32_KeyStore({}) ks.add_xprv_from_seed(bip32_seed, xtype=xtype, derivation='m/') return ks ks = create_keystore_from_bip32seed(xtype='standard') self.assertEqual('033a05ec7ae9a9833b0696eb285a762f17379fa208b3dc28df1c501cf84fe415d0', ks.derive_pubkey(0, 0)) self.assertEqual('02bf27f41683d84183e4e930e66d64fc8af5508b4b5bf3c473c505e4dbddaeed80', ks.derive_pubkey(1, 0)) ks = create_keystore_from_bip32seed(xtype='standard') # p2pkh w = WalletIntegrityHelper.create_standard_wallet(ks) self.assertEqual(ks.xprv, 'tprv8ZgxMBicQKsPecD328MF9ux3dSaSFWci7FNQmuWH7uZ86eY8i3XpvjK8KSH8To2QphiZiUqaYc6nzDC6bTw8YCB9QJjaQL5pAApN4z7vh2B') self.assertEqual(ks.xpub, 'tpubD6NzVbkrYhZ4Y5Epun1qZKcACU6NQqocgYyC4RYaYBMWw8nuLSMR7DvzVamkqxwRgrTJ1MBMhc8wwxT2vbHqMu8RBXy4BvjWMxR5EdZroxE') self.assertEqual(w.get_receiving_addresses()[0], 'yUyx5hJsEwAukTdRy7UihU57rC37Y4y2ZX') self.assertEqual(w.get_change_addresses()[0], 'yZYxxqJNR6fJ3fAT4Kyhye3A7G9kC19B9q') ks = create_keystore_from_bip32seed(xtype='standard') # p2sh w = WalletIntegrityHelper.create_multisig_wallet([ks], '1of1') self.assertEqual(ks.xprv, 'tprv8ZgxMBicQKsPecD328MF9ux3dSaSFWci7FNQmuWH7uZ86eY8i3XpvjK8KSH8To2QphiZiUqaYc6nzDC6bTw8YCB9QJjaQL5pAApN4z7vh2B') self.assertEqual(ks.xpub, 'tpubD6NzVbkrYhZ4Y5Epun1qZKcACU6NQqocgYyC4RYaYBMWw8nuLSMR7DvzVamkqxwRgrTJ1MBMhc8wwxT2vbHqMu8RBXy4BvjWMxR5EdZroxE') self.assertEqual(w.get_receiving_addresses()[0], '8soEYefwj7c3QZt43M3UptCZVhduigoYNs') self.assertEqual(w.get_change_addresses()[0], '8zsBhqSouWyYgSjJWwevRKh4BDCySjizKi')
def test_bip32_extended_version_bytes(self, mock_write): seed_words = 'crouch dumb relax small truck age shine pink invite spatial object tenant' self.assertEqual(keystore.bip39_is_checksum_valid(seed_words), (True, True)) bip32_seed = keystore.bip39_to_seed(seed_words, '') self.assertEqual('0df68c16e522eea9c1d8e090cfb2139c3b3a2abed78cbcb3e20be2c29185d3b8df4e8ce4e52a1206a688aeb88bfee249585b41a7444673d1f16c0d45755fa8b9', bh2u(bip32_seed)) def create_keystore_from_bip32seed(xtype): ks = keystore.BIP32_KeyStore({}) ks.add_xprv_from_seed(bip32_seed, xtype=xtype, derivation='m/') return ks ks = create_keystore_from_bip32seed(xtype='standard') self.assertEqual('033a05ec7ae9a9833b0696eb285a762f17379fa208b3dc28df1c501cf84fe415d0', ks.derive_pubkey(0, 0)) self.assertEqual('02bf27f41683d84183e4e930e66d64fc8af5508b4b5bf3c473c505e4dbddaeed80', ks.derive_pubkey(1, 0)) ks = create_keystore_from_bip32seed(xtype='standard') # p2pkh w = WalletIntegrityHelper.create_standard_wallet(ks) self.assertEqual(ks.xprv, 'tprv8ZgxMBicQKsPecD328MF9ux3dSaSFWci7FNQmuWH7uZ86eY8i3XpvjK8KSH8To2QphiZiUqaYc6nzDC6bTw8YCB9QJjaQL5pAApN4z7vh2B') self.assertEqual(ks.xpub, 'tpubD6NzVbkrYhZ4Y5Epun1qZKcACU6NQqocgYyC4RYaYBMWw8nuLSMR7DvzVamkqxwRgrTJ1MBMhc8wwxT2vbHqMu8RBXy4BvjWMxR5EdZroxE') self.assertEqual(w.get_receiving_addresses()[0], 'yUyx5hJsEwAukTdRy7UihU57rC37Y4y2ZX') self.assertEqual(w.get_change_addresses()[0], 'yZYxxqJNR6fJ3fAT4Kyhye3A7G9kC19B9q') ks = create_keystore_from_bip32seed(xtype='standard') # p2sh w = WalletIntegrityHelper.create_multisig_wallet([ks], '1of1') self.assertEqual(ks.xprv, 'tprv8ZgxMBicQKsPecD328MF9ux3dSaSFWci7FNQmuWH7uZ86eY8i3XpvjK8KSH8To2QphiZiUqaYc6nzDC6bTw8YCB9QJjaQL5pAApN4z7vh2B') self.assertEqual(ks.xpub, 'tpubD6NzVbkrYhZ4Y5Epun1qZKcACU6NQqocgYyC4RYaYBMWw8nuLSMR7DvzVamkqxwRgrTJ1MBMhc8wwxT2vbHqMu8RBXy4BvjWMxR5EdZroxE') self.assertEqual(w.get_receiving_addresses()[0], '8soEYefwj7c3QZt43M3UptCZVhduigoYNs') self.assertEqual(w.get_change_addresses()[0], '8zsBhqSouWyYgSjJWwevRKh4BDCySjizKi')
def test_bip32_extended_version_bytes(self, mock_write): seed_words = 'crouch dumb relax small truck age shine pink invite spatial object tenant' self.assertEqual(keystore.bip39_is_checksum_valid(seed_words), (True, True)) bip32_seed = keystore.bip39_to_seed(seed_words, '') self.assertEqual('0df68c16e522eea9c1d8e090cfb2139c3b3a2abed78cbcb3e20be2c29185d3b8df4e8ce4e52a1206a688aeb88bfee249585b41a7444673d1f16c0d45755fa8b9', bh2u(bip32_seed)) def create_keystore_from_bip32seed(xtype): ks = keystore.BIP32_KeyStore({}) ks.add_xprv_from_seed(bip32_seed, xtype=xtype, derivation='m/') return ks ks = create_keystore_from_bip32seed(xtype='standard') self.assertEqual('033a05ec7ae9a9833b0696eb285a762f17379fa208b3dc28df1c501cf84fe415d0', ks.derive_pubkey(0, 0)) self.assertEqual('02bf27f41683d84183e4e930e66d64fc8af5508b4b5bf3c473c505e4dbddaeed80', ks.derive_pubkey(1, 0)) ks = create_keystore_from_bip32seed(xtype='standard') # p2pkh w = WalletIntegrityHelper.create_standard_wallet(ks) self.assertEqual(ks.xprv, 'xprv9s21ZrQH143K3nyWMZVjzGL4KKAE1zahmhTHuV5pdw4eK3o3igC5QywgQG7UTRe6TGBniPDpPFWzXMeMUFbBj8uYsfXGjyMmF54wdNt8QBm') self.assertEqual(ks.xpub, 'xpub661MyMwAqRbcGH3yTb2kMQGnsLziRTJZ8vNthsVSCGbdBr8CGDWKxnGAFYgyKTzBtwvPPmfVAWJuFmxRXjSbUTg87wDkWQ5GmzpfUcN9t8Z') self.assertEqual(w.get_receiving_addresses()[0], 'XjMM4kERoPWqQihtQGAKfSemZuYk36oeBr') self.assertEqual(w.get_change_addresses()[0], 'XovMwtDvyZ1DhvEuVUfJwccopyfNbuheco') ks = create_keystore_from_bip32seed(xtype='standard') # p2sh w = WalletIntegrityHelper.create_multisig_wallet([ks], '1of1') self.assertEqual(ks.xprv, 'xprv9s21ZrQH143K3nyWMZVjzGL4KKAE1zahmhTHuV5pdw4eK3o3igC5QywgQG7UTRe6TGBniPDpPFWzXMeMUFbBj8uYsfXGjyMmF54wdNt8QBm') self.assertEqual(ks.xpub, 'xpub661MyMwAqRbcGH3yTb2kMQGnsLziRTJZ8vNthsVSCGbdBr8CGDWKxnGAFYgyKTzBtwvPPmfVAWJuFmxRXjSbUTg87wDkWQ5GmzpfUcN9t8Z') self.assertEqual(w.get_receiving_addresses()[0], '7fnRbKn5baDQxGTny63XNWPCcBs5dQEBtK') self.assertEqual(w.get_change_addresses()[0], '7nrNkWYwmyavE9K3SgexxwshHhS9DvyeGK')
def test_bip32_extended_version_bytes(self, mock_write): seed_words = 'crouch dumb relax small truck age shine pink invite spatial object tenant' self.assertEqual(keystore.bip39_is_checksum_valid(seed_words), (True, True)) bip32_seed = keystore.bip39_to_seed(seed_words, '') self.assertEqual('0df68c16e522eea9c1d8e090cfb2139c3b3a2abed78cbcb3e20be2c29185d3b8df4e8ce4e52a1206a688aeb88bfee249585b41a7444673d1f16c0d45755fa8b9', bh2u(bip32_seed)) def create_keystore_from_bip32seed(xtype): ks = keystore.BIP32_KeyStore({}) ks.add_xprv_from_seed(bip32_seed, xtype=xtype, derivation='m/') return ks ks = create_keystore_from_bip32seed(xtype='standard') self.assertEqual('033a05ec7ae9a9833b0696eb285a762f17379fa208b3dc28df1c501cf84fe415d0', ks.derive_pubkey(0, 0)) self.assertEqual('02bf27f41683d84183e4e930e66d64fc8af5508b4b5bf3c473c505e4dbddaeed80', ks.derive_pubkey(1, 0)) ks = create_keystore_from_bip32seed(xtype='standard') # p2pkh w = WalletIntegrityHelper.create_standard_wallet(ks) self.assertEqual(ks.xprv, 'xprv9s21ZrQH143K3nyWMZVjzGL4KKAE1zahmhTHuV5pdw4eK3o3igC5QywgQG7UTRe6TGBniPDpPFWzXMeMUFbBj8uYsfXGjyMmF54wdNt8QBm') self.assertEqual(ks.xpub, 'xpub661MyMwAqRbcGH3yTb2kMQGnsLziRTJZ8vNthsVSCGbdBr8CGDWKxnGAFYgyKTzBtwvPPmfVAWJuFmxRXjSbUTg87wDkWQ5GmzpfUcN9t8Z') self.assertEqual(w.get_receiving_addresses()[0], 'XjMM4kERoPWqQihtQGAKfSemZuYk36oeBr') self.assertEqual(w.get_change_addresses()[0], 'XovMwtDvyZ1DhvEuVUfJwccopyfNbuheco') ks = create_keystore_from_bip32seed(xtype='standard') # p2sh w = WalletIntegrityHelper.create_multisig_wallet([ks], '1of1') self.assertEqual(ks.xprv, 'xprv9s21ZrQH143K3nyWMZVjzGL4KKAE1zahmhTHuV5pdw4eK3o3igC5QywgQG7UTRe6TGBniPDpPFWzXMeMUFbBj8uYsfXGjyMmF54wdNt8QBm') self.assertEqual(ks.xpub, 'xpub661MyMwAqRbcGH3yTb2kMQGnsLziRTJZ8vNthsVSCGbdBr8CGDWKxnGAFYgyKTzBtwvPPmfVAWJuFmxRXjSbUTg87wDkWQ5GmzpfUcN9t8Z') self.assertEqual(w.get_receiving_addresses()[0], '7fnRbKn5baDQxGTny63XNWPCcBs5dQEBtK') self.assertEqual(w.get_change_addresses()[0], '7nrNkWYwmyavE9K3SgexxwshHhS9DvyeGK')