Esempio n. 1
0
    def sign_transaction(self, tx, master_password, path=''):
        """
        Args:
            tx: hex transaction to sign
            master_password: master password for BIP32 wallets. Can be either a
                master_secret or a wif
            path (Optional[str]): optional path to the leaf address of the
                BIP32 wallet. This allows us to retrieve private key for the
                leaf address if one was used to construct the transaction.
        Returns:
            signed transaction

        .. note:: Only BIP32 hierarchical deterministic wallets are currently
            supported.

        """
        netcode = 'XTN' if self.testnet else 'BTC'

        # check if its a wif
        try:
            BIP32Node.from_text(master_password)
            return pybitcointools.signall(tx, master_password)
        except EncodingError:
            # if its not get the wif from the master secret
            return pybitcointools.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())
Esempio n. 2
0
    def sign_transaction(self, tx, master_password, path=''):
        # master_password can be either a master_secret or a wif
        netcode = 'XTN' if self.testnet else 'BTC'

        # check if its a wif
        try:
            BIP32Node.from_text(master_password)
            return pybitcointools.signall(tx, master_password)
        except EncodingError:
            # if its not get the wif from the master secret
            return pybitcointools.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())
Esempio n. 3
0
    def sign_transaction(self, tx, master_password, path=''):
        # master_password can be either a master_secret or a wif
        netcode = 'XTN' if self.testnet else 'BTC'

        # check if its a wif
        try:
            BIP32Node.from_text(master_password)
            return pybitcointools.signall(tx, master_password)
        except EncodingError:
            # if its not get the wif from the master secret
            return pybitcointools.signall(
                tx,
                BIP32Node.from_master_secret(
                    master_password,
                    netcode=netcode).subkey_for_path(path).wif())
Esempio n. 4
0
 def sign_transaction(self, tx, master_password, path=''):
     netcode = 'XTN' if self.testnet else 'BTC'
     return pybitcointools.signall(
         tx,
         BIP32Node.from_master_secret(
             master_password, netcode=netcode).subkey_for_path(path).wif())
Esempio n. 5
0
 def sign_transaction(self, tx, master_password):
     return pybitcointools.signall(tx, BIP32Node.from_master_secret(master_password).wif())
Esempio n. 6
0
 def sign_transaction(self, tx, master_password, path=''):
     netcode = 'XTN' if self.testnet else 'BTC'
     return pybitcointools.signall(tx, BIP32Node.from_master_secret(master_password, netcode=netcode).subkey_for_path(path).wif())