Exemple #1
0
 def solve(self, digest):
     from .transaction import Witness
     pubkey = self.privk.pub()
     sig = self.privk.sign(digest)
     return (ScriptSig.from_stack_data([
         StackData.from_bytes(sig + self.sighash.as_byte()),
         StackData.from_bytes(pubkey.compressed)
     ]), Witness([]))
Exemple #2
0
 def solve(self, *digests):
     from .transaction import Witness
     if len(digests) != len(self.privkeys):
         raise ValueError('{} privkeys provided and {} digests'.format(
             len(self.privkeys), len(digests)))
     script_sig_data = [StackData.zero()]
     for priv, digest, sighash in zip(self.privkeys, digests,
                                      self.sighashes):
         sig = priv.sign(digest)
         script_sig_data.append(
             StackData.from_bytes(sig + sighash.as_byte()))
     return ScriptSig.from_stack_data(script_sig_data), Witness([])
Exemple #3
0
 def solve(self, *digests):
     script_sig, witness = self.inner_solver.solve(*digests)
     script_sig_data = script_sig.get_data()
     script_sig_data.append(StackData.from_bytes(self.preimage))
     return ScriptSig.from_stack_data(script_sig_data), witness
Exemple #4
0
 def solve(self, *digests):
     script_sig, witness = self.inner_solver.solve(*digests)
     script_sig_data = script_sig.get_data()
     script_sig_data.append(StackData.from_int(self.branch.value))
     return ScriptSig.from_stack_data(script_sig_data), witness
Exemple #5
0
 def solve(self, *digests):
     script_sig, witness = self.redeem_script_solver.solve(*digests)
     script_sig_data = script_sig.get_data()
     script_sig_data.append(self.redeem_script.to_stack_data())
     return ScriptSig.from_stack_data(script_sig_data), witness