Esempio n. 1
0
    def test_bip39_seed_bip44_standard_passphrase(self, mock_write):
        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))

        ks = keystore.from_bip39_seed(seed_words, UNICODE_HORROR,
                                      "m/44'/4242'/0'")

        self.assertTrue(isinstance(ks, keystore.BIP32_KeyStore))

        self.assertEqual(
            ks.xprv,
            'xprv9ypGP66GQorSCmsjoVq29dN6E95skPH6DBESdDy9LL1gktSU2VknYBxANoqBKyV8XxGiuLp4FuQdsFshLBeaYkSKJ2QXRkYZATHVT8reEyF'
        )
        self.assertEqual(
            ks.xpub,
            'xpub6CocnbdAFBQjRFxCuXN2WmJpnAvN9qzwaQA3RcNktfYfdgmca3535zGeE4NBRzW51nqF5ZSUaLPDEZmvPkX7d9R8ZUerovyMTGjp5M5fJ3A'
        )

        w = WalletIntegrityHelper.create_standard_wallet(ks)
        self.assertEqual(w.txin_type, 'p2pkh')

        self.assertEqual(w.get_receiving_addresses()[0],
                         'PKw29oaGehGgwxMxch4Q5sLrqq1nhArwXY')
        self.assertEqual(w.get_change_addresses()[0],
                         'PG3hNC2ENBk4susfcfTmyjfsAe5szFbghu')
Esempio n. 2
0
    def test_bip39_multisig_seed_bip45_standard(self, mock_write):
        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'/4242")
        self.assertTrue(isinstance(ks1, keystore.BIP32_KeyStore))
        self.assertEqual(
            ks1.xprv,
            'xprv9vyEFyXf7pbiKy3pDC6qTX6jah2yrYFKhzHnoXXm1FU7fHDbFxR3Tdho91atnqN8EPTSut4t4xgTRkBoS7PjHN8tDfseZooqCsrVx6Dn3Cb'
        )
        self.assertEqual(
            ks1.xpub,
            'xpub69xafV4YxCA1YT8HKDdqpf3U8isUFzyB5DDPbuwNZb16Y5YjoVjJ1S2GzHTY5oUgpQAjzRxWGw4YA3sqdQ9f9hP2gog7uLbNV3Jm4sjSfFj'
        )

        # bip39 seed: tray machine cook badge night page project uncover ritual toward person enact
        # der: m/45'/0
        ks2 = keystore.from_xpub(
            'xpub6Bco9vrgo8rNUSi8Bjomn8xLA41DwPXeuPcgJamNRhTTyGVHsp8fZXaGzp9ypHoei16J6X3pumMAP1u3Dy4jTSWjm4GZowL7Dcn9u4uZC9W'
        )
        WalletIntegrityHelper.check_xpub_keystore_sanity(self, ks2)
        self.assertTrue(isinstance(ks2, keystore.BIP32_KeyStore))

        w = WalletIntegrityHelper.create_multisig_wallet([ks1, ks2], '2of2')
        self.assertEqual(w.txin_type, 'p2sh')

        self.assertEqual(w.get_receiving_addresses()[0],
                         '7dTFS18zaHNT67z54NWLUshtKs6FnPo7iu')
        self.assertEqual(w.get_change_addresses()[0],
                         '7Z8vUdV1WzTQqNqcW6MizSSP96HpBvwMcS')
Esempio n. 3
0
    def test_bip39_seed_bip44_standard(self, mock_write):
        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))

        ks = keystore.from_bip39_seed(seed_words, '', "m/44'/4242'/0'")

        self.assertTrue(isinstance(ks, keystore.BIP32_KeyStore))

        self.assertEqual(
            ks.xprv,
            'xprv9z3dKeoZEe6oPP3HGUiwGuDirB6otu4FaitvyztdXFbtNTM8Q2oWm8iAwELb4wVL7mYpzoT3YAMnkyEW8wzobLaFXrU9fdS6egiXgp7Xq8s'
        )
        self.assertEqual(
            ks.xpub,
            'xpub6D2yjALT51f6bs7kNWFwe3ATQCwJJMn6wwpXnPJF5b8sFFgGwa7mJw2enYSrng7a4UrGaSea7ADbbiciBojB8w8qAXfNfctrCGGicTqWfGa'
        )

        w = WalletIntegrityHelper.create_standard_wallet(ks)
        self.assertEqual(w.txin_type, 'p2pkh')

        self.assertEqual(w.get_receiving_addresses()[0],
                         'PAcFhYAdadySYQ3f6xQX3btQbQDfCVVzn7')
        self.assertEqual(w.get_change_addresses()[0],
                         'PSjEodULoy8W3GMnxPSi14ku2b8Y1yhRBS')