All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bccapi.bitlib.model.ScriptInput Maven / Gradle / Ivy

There is a newer version: 1.0.3
Show newest version
package com.bccapi.bitlib.model;

public class ScriptInput extends Script {

   public static final ScriptInput EMPTY = new ScriptInput(new byte[] {});

   public static ScriptInput fromScriptBytes(byte[] scriptBytes) throws ScriptParsingException {
      byte[][] chunks = Script.chunksFromScriptBytes(scriptBytes);
      if (ScriptInputStandard.isScriptInputStandard(chunks)) {
         return new ScriptInputStandard(chunks, scriptBytes);
      } else if (ScriptInputPubKey.isScriptInputPubKey(chunks)) {
         return new ScriptInputPubKey(chunks, scriptBytes);
      } else {
         return new ScriptInput(scriptBytes);
      }

   }

   /**
    * Construct an input script from an output script.
    * 

* This is used when verifying or generating signatures, where the input is * set to the output of the funding transaction. * * @param output script to create the input script from * @return input script */ public static ScriptInput fromOutputScript(ScriptOutput output) { return new ScriptInput(output._scriptBytes); } protected ScriptInput(byte[] scriptBytes) { super(scriptBytes, false); } /** * Special constructor for coinbase scripts * * @param script script * @param isCoinBase is coin base */ protected ScriptInput(byte[] script, boolean isCoinBase) { super(script, isCoinBase); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy