Exemplo n.º 1
0
    def setUp(self):
        super(TestMultisigMofN, self).setUp()
        self.storage = WalletStorage(self.fake_config)
        self.storage.put_above_chain('multisig_m', 3)
        self.storage.put_above_chain('multisig_n', 4)
        self.wallet = Wallet_MofN(self.storage)

        # set cosigner master privkey
        cosigner1_master_privkey = bip32_private_derivation(self.cosigner1_root_privkey, "m/", "m/1491'/0'")[0]
        self.cosigner1_master_pubkey = xpub_from_xprv(cosigner1_master_privkey)

        cosigner2_master_privkey = bip32_private_derivation(self.cosigner2_root_privkey, "m/", "m/1491'/0'")[0]
        self.cosigner2_master_pubkey = xpub_from_xprv(cosigner2_master_privkey)

        cosigner3_master_privkey = bip32_private_derivation(self.cosigner3_root_privkey, "m/", "m/1491'/0'")[0]
        self.cosigner3_master_pubkey = xpub_from_xprv(cosigner3_master_privkey)


        self.wallet.set_chain("BTC")
        self.wallet.add_seed(self.seed_text, self.password)
        self.wallet.create_master_keys(self.password)
        self.wallet.add_master_public_key("x2/", self.cosigner1_master_pubkey)
        self.wallet.add_master_public_key("x3/", self.cosigner2_master_pubkey)
        self.wallet.add_master_public_key("x4/", self.cosigner3_master_pubkey)
        self.wallet.create_main_account(self.password)
Exemplo n.º 2
0
    def setUp(self):
        super(TestMultisigWallet, self).setUp()
        self.storage = WalletStorage(self.fake_config)
        self.wallet = Wallet_2of2(self.storage)

        # set cosigner master privkey
        cosigner_master_privkey = bip32_private_derivation(self.cosigner_root_privkey, "m/", "m/1491'/0'")[0]
        self.cosigner_master_pubkey = xpub_from_xprv(cosigner_master_privkey)

        self.wallet.set_chain("BTC")
        self.wallet.add_seed(self.seed_text, self.password)
        self.wallet.create_master_keys(self.password)
        self.wallet.add_master_public_key("x2/", self.cosigner_master_pubkey)
        self.wallet.create_main_account(self.password)
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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