def sign(self, solver, hash_type=SIGHASH_ALL):
        """Sign a standard transaction.
        solver:
            A function solver(tx_out_script, signature_hash, signature_type)
            that accepts the tx_out_script, the signature hash, and a signature
            type, and returns a script that "solves" the tx_out_script.
            Normally you would use an instance of a SecretExponentSolver object
            (which has a __call__ method declared)."""

        blank_txs_in = [TxIn(unsigned_tx_out.previous_hash, unsigned_tx_out.previous_index) for unsigned_tx_out_idx, unsigned_tx_out in enumerate(self.unsigned_txs_out)]
        tx = Tx(self.version, blank_txs_in, self.new_txs_out, self.lock_time)

        new_txs_in = []
        for unsigned_tx_out_idx, unsigned_tx_out in enumerate(self.unsigned_txs_out):
            # Leave out the signature from the hash, since a signature can't sign itself.
            # The checksig op will also drop the signatures from its hash.
            signature_hash = tx.signature_hash(unsigned_tx_out.script, unsigned_tx_out_idx, hash_type=hash_type)
            new_script = solver(unsigned_tx_out.script, signature_hash, hash_type)
            new_txs_in.append(TxIn(unsigned_tx_out.previous_hash, unsigned_tx_out.previous_index, new_script))
            if not verify_script(new_script, unsigned_tx_out.script, signature_hash, hash_type=0):
                raise ValidationFailureError("just signed script Tx %s TxIn index %d did not verify" % (b2h_rev(tx_in.previous_hash), unsigned_tx_out_idx))

        # we have our solutions! Fill them in
        tx.txs_in = new_txs_in
        return tx
dataset/ETHPy150Open maraoz/proofofexistence/pycoin/tx/UnsignedTx.py/UnsignedTx.sign/original