def _do_test_bip32(self, seed, sequence): xprv, xpub = bip32_root(bfh(seed), 'standard') self.assertEqual("m/", sequence[0:2]) path = 'm' sequence = sequence[2:] for n in sequence.split('/'): child_path = path + '/' + n if n[-1] != "'": xpub2 = bip32_public_derivation(xpub, path, child_path) xprv, xpub = bip32_private_derivation(xprv, path, child_path) if n[-1] != "'": self.assertEqual(xpub, xpub2) path = child_path return xpub, xprv
def _do_test_bip32(self, seed, sequence, testnet): xprv, xpub = bip32_root(seed.decode('hex'), testnet) assert sequence[0:2] == "m/" path = 'm' sequence = sequence[2:] for n in sequence.split('/'): child_path = path + '/' + n if n[-1] != "'": xpub2 = bip32_public_derivation(xpub, path, child_path, testnet) xprv, xpub = bip32_private_derivation(xprv, path, child_path, testnet) if n[-1] != "'": assert xpub == xpub2 path = child_path return xpub, xprv
def test_wallet_root_derivation(self): self.wallet.set_chain('BTC') self.assertEqual( bip32_root(self.wallet.mnemonic_to_seed(self.seed_text, ''))[0], self.actual_root_privkey)
def test_wallet_root_derivation(self): self.wallet.set_chain('BTC') self.assertEqual(bip32_root(self.wallet.mnemonic_to_seed(self.seed_text, ''))[0], self.actual_root_privkey)