Exemplo n.º 1
0
 def _create_standard_wallet(self, ks):
     store = storage.WalletStorage(
         'if_this_exists_mocking_failed_648151893')
     store.put('keystore', ks.dump())
     store.put('gap_limit', self.gap_limit)
     w = wallet.Standard_Wallet(store)
     w.synchronize()
     return w
Exemplo n.º 2
0
 def setUp(self):
     bitcoin.set_testnet()
     self.user_dir = tempfile.mkdtemp()
     self.wallet_path = os.path.join(self.user_dir, "testwallet")
     self.storage = WalletStorage(self.wallet_path)
     k = keystore.from_seed('absent feel require game library trade march seven quantum recycle warfare tomorrow', '')
     self.storage.put('seed_type', 'standard')
     self.storage.put('keystore', k.dump())
     self.wallet = wallet.Standard_Wallet(self.storage)
     for i in range(2):
         self.wallet.create_new_address(False)       # normal addresses
         self.wallet.create_new_address(True)        # change addresses
     self.wallet.storage.write()
Exemplo n.º 3
0
    def test_electrum_seed_old(self, mock_write):
        seed_words = 'powerful random nobody notice nothing important anyway look away hidden message over'
        self.assertEqual(bitcoin.seed_type(seed_words), 'old')

        ks = keystore.from_seed(seed_words, '')

        self._check_seeded_keystore_sanity(ks)
        self.assertTrue(isinstance(ks, keystore.Old_KeyStore))

        self.assertEqual(
            ks.mpk,
            'e9d4b7866dd1e91c862aebf62a49548c7dbf7bcc6e4b7b8c9da820c7737968df9c09d5a3e271dc814a29981f81b3faaf2737b551ef5dcc6189cf0f8252c442b3'
        )

        store = storage.WalletStorage(
            'if_this_exists_mocking_failed_648151893')
        store.put('keystore', ks.dump())
        w = wallet.Standard_Wallet(store)
        w.synchronize()

        self.assertEqual(w.get_receiving_addresses()[0],
                         '1FJEEB8ihPMbzs2SkLmr37dHyRFzakqUmo')
        self.assertEqual(w.get_change_addresses()[0],
                         '1KRW8pH6HFHZh889VDq6fEKvmrsmApwNfe')
Exemplo n.º 4
0
    def test_electrum_seed_segwit(self, mock_write):
        seed_words = 'bitter grass shiver impose acquire brush forget axis eager alone wine silver'
        self.assertEqual(bitcoin.seed_type(seed_words), 'segwit')

        ks = keystore.from_seed(seed_words, '')

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

        self.assertEqual(
            ks.xpub,
            'zpub6jftahH18ngZyLeqfLBFAm7YaWFVttE9pku5pNMX2qPzTjoq1FVgZMmhjecyB2nqFb31gHE9vNvbaggU6vvWpNZbXEWLLUjYjFqG95LNyT8'
        )

        store = storage.WalletStorage(
            'if_this_exists_mocking_failed_648151893')
        store.put('keystore', ks.dump())
        w = wallet.Standard_Wallet(store)
        w.synchronize()

        self.assertEqual(w.get_receiving_addresses()[0],
                         'bc1qtt5msqvcqyvuu7hq7urwgraqqyq2yhtuzdpwc4')
        self.assertEqual(w.get_change_addresses()[0],
                         'bc1q9wlrynvj7qz7x4fs29d8dnje0zdevj5vmenter')
Exemplo n.º 5
0
    def test_electrum_seed_standard(self, mock_write):
        seed_words = 'cycle rocket west magnet parrot shuffle foot correct salt library feed song'
        self.assertEqual(bitcoin.seed_type(seed_words), 'standard')

        ks = keystore.from_seed(seed_words, '')

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

        self.assertEqual(
            ks.xpub,
            'xpub661MyMwAqRbcFWohJWt7PHsFEJfZAvw9ZxwQoDa4SoMgsDDM1T7WK3u9E4edkC4ugRnZ8E4xDZRpk8Rnts3Nbt97dPwT52CwBdDWroaZf8U'
        )

        store = storage.WalletStorage(
            'if_this_exists_mocking_failed_648151893')
        store.put('keystore', ks.dump())
        w = wallet.Standard_Wallet(store)
        w.synchronize()

        self.assertEqual(w.get_receiving_addresses()[0],
                         '1NNkttn1YvVGdqBW4PR6zvc3Zx3H5owKRf')
        self.assertEqual(w.get_change_addresses()[0],
                         '1KSezYMhAJMWqFbVFB2JshYg69UpmEXR4D')