Exemple #1
0
    def test_with_pub(self):
        path = "m/0/0/0"
        m = Mnemonic()
        seed = m.to_seed(words)
        key = BIP32Key.fromEntropy(seed)
        m = key
        for n in parse_path(path):
            m = m.ChildKey(n)
        self.assertEqual(m.ExtendedKey(), "xprv9yK7bXqEnmCpHMV4NM7FKj1vsiXQ14h6W8Bn5jkAHHBqrm2CSy82Wpb3FXHaG39v6zt3YCKiqNz4ydx3BNtgvDmU2bxXz1RJ9TXL7N91bTL")
        self.assertEqual(m.ExtendedKey(private=False, encoded=True), "xpub6CJU13N8d8m7VqZXUNeFgrxfRkMtQXQwsM7Nt89mqcipjZMLzWSH4cuX6mWj3XohyuCBRK7cpkAq59XBLRqqjQJGieg2qHaEeRS8dBrGgZu")

        path = "m/0/0/0"
        key2 = BIP32Key.fromExtendedKey(key.ExtendedKey(encoded=True))
        m = key2
        for n in parse_path(path):
            m = m.ChildKey(n)
        self.assertEqual(m.ExtendedKey(), "xprv9yK7bXqEnmCpHMV4NM7FKj1vsiXQ14h6W8Bn5jkAHHBqrm2CSy82Wpb3FXHaG39v6zt3YCKiqNz4ydx3BNtgvDmU2bxXz1RJ9TXL7N91bTL")
        self.assertEqual(m.ExtendedKey(private=False, encoded=True), "xpub6CJU13N8d8m7VqZXUNeFgrxfRkMtQXQwsM7Nt89mqcipjZMLzWSH4cuX6mWj3XohyuCBRK7cpkAq59XBLRqqjQJGieg2qHaEeRS8dBrGgZu")
Exemple #2
0
    def test_with_sec(self):
        path = "m/44'/0'/0'/0'/0"
        m = Mnemonic()
        seed = m.to_seed(words)
        key = BIP32Key.fromEntropy(seed)
        self.assertEqual(key.ExtendedKey(), "xprv9s21ZrQH143K3EGRfjQYhZ6fA3HPPiw6rxopHKXfWTrB66evM4fDRiUScJy5RCCGz98nBaCCtwpwFCTDiFG5tx3mdnyyL1MbHmQQ19BWemo")
        m = key
        for n in parse_path(path):
            m = m.ChildKey(n)
        self.assertEqual(m.ExtendedKey(), "xprvA3Fu8ZNFZDn3S24jWzHCLGsX9eSUcpvFY2FFKLzessSEkk1KQLhHpyG7rnfYtx7txBupUY546PT5tjb4kwXghpd1rRw1Xw8nAqS19EZuPSu")
        self.assertEqual(m.ExtendedKey(private=False), "xpub6GFFY4u9PbLLeW9Cd1pChQpFhgGy2He6uFAr7jQGSCyDdYLTwt1YNmabi4aRfHRxwiEEhwu2Bjm3ypHaWHXbmr48QP4Fd8PXcw1o9qpdLSQ")

        m = key.ChildKey(
            44 + BIP32_HARDEN
        ).ChildKey(
            0 + BIP32_HARDEN
        ).ChildKey(
            0 + BIP32_HARDEN
        ).ChildKey(0 + BIP32_HARDEN).ChildKey(0)      
        self.assertEqual(m.ExtendedKey(), "xprvA3Fu8ZNFZDn3S24jWzHCLGsX9eSUcpvFY2FFKLzessSEkk1KQLhHpyG7rnfYtx7txBupUY546PT5tjb4kwXghpd1rRw1Xw8nAqS19EZuPSu")
        self.assertEqual(m.ExtendedKey(private=False), "xpub6GFFY4u9PbLLeW9Cd1pChQpFhgGy2He6uFAr7jQGSCyDdYLTwt1YNmabi4aRfHRxwiEEhwu2Bjm3ypHaWHXbmr48QP4Fd8PXcw1o9qpdLSQ")