Esempio n. 1
0
 /**
  * Create a program that satisfies a pay-to-script hashed OP_CHECKMULTISIG program. If given
  * signature list is null, incomplete scriptSig will be created with OP_0 instead of signatures
  */
 public static Script createP2SHMultiSigInputScript(
     @Nullable List<TransactionSignature> signatures, Script multisigProgram) {
   List<byte[]> sigs = new ArrayList<byte[]>();
   if (signatures == null) {
     // create correct number of empty signatures
     int numSigs = multisigProgram.getNumberOfSignaturesRequiredToSpend();
     for (int i = 0; i < numSigs; i++) sigs.add(new byte[] {});
   } else {
     for (TransactionSignature signature : signatures) {
       sigs.add(signature.encodeToPeercoin());
     }
   }
   return createMultiSigInputScriptBytes(sigs, multisigProgram.getProgram());
 }
Esempio n. 2
0
 /** Creates a scriptPubKey for the given redeem script. */
 public static Script createP2SHOutputScript(Script redeemScript) {
   byte[] hash = Utils.sha256hash160(redeemScript.getProgram());
   return ScriptBuilder.createP2SHOutputScript(hash);
 }