Class Tx

    • Method Detail

      • getCommand

        public byte[] getCommand()

        getCommand.

        Specified by:
        getCommand in interface Message
        Returns:
        an array of byte objects
      • id

        public String id()
        Human-readable hexadecimal of the transaction hash
        Returns:
        a String object
      • hash

        public byte[] hash()
        Binary hash of the legacy serialization
        Returns:
        an array of byte objects
      • parse

        public static Tx parse​(byte[] rawTx,
                               Boolean testnet)
      • serialize

        public byte[] serialize()

        serialize.

        Specified by:
        serialize in interface Message
        Returns:
        an array of byte objects
      • hexString

        public String hexString()
      • sizeBytes

        public int sizeBytes()
      • sizeWeightUnits

        public int sizeWeightUnits()
      • sizeVirtualBytes

        public int sizeVirtualBytes()
      • fee

        public Int fee​(Map<String,​String> cache)
        Returns the fee of this transaction in satoshi
        Returns:
        a Int object
      • sigHash

        public Int sigHash​(int inputIndex,
                           Script redeemScript,
                           Map<String,​String> cache)
        Returns the integer representation of the hash that needs to get signed for index input_index
        Parameters:
        inputIndex - a int
        redeemScript - a Script object
        Returns:
        a Int object
      • sigHashBip143

        public Int sigHashBip143​(int inputIndex,
                                 Script redeemScript,
                                 Script witnessScript,
                                 Map<String,​String> cache)
        Returns the integer representation of the hash that needs to get signed for index input_index
        Parameters:
        inputIndex - a int
        redeemScript - a Script object
        witnessScript - a Script object
        Returns:
        a Int object
      • verifyInput

        public boolean verifyInput​(int inputIndex,
                                   Map<String,​String> cache)
        Returns whether the input has a valid signature
        Parameters:
        inputIndex - a int
        Returns:
        a boolean
      • verify

        public boolean verify​(Map<String,​String> cache)
        Verify this transaction
        Returns:
        a boolean
      • signInput

        public boolean signInput​(int inputIndex,
                                 PrivateKey privateKey,
                                 Map<String,​String> cache)
        Signs the input using the private key
        Parameters:
        inputIndex - a int
        privateKey - a PrivateKey object
        Returns:
        a boolean
      • isCoinbase

        public boolean isCoinbase()
        Returns whether this transaction is a coinbase transaction or not
        Returns:
        a boolean
      • coinbaseHeight

        public Int coinbaseHeight()
        Returns the height of the block this coinbase transaction is in Returns None if this transaction is not a coinbase transaction
        Returns:
        a Int object
      • getTxOuts

        public List<TxOut> getTxOuts()

        Getter for the field txOuts.

        Returns:
        a List object
      • getSegwit

        public Boolean getSegwit()

        Getter for the field segwit.

        Returns:
        a Boolean object
      • getLocktime

        public Int getLocktime()

        Getter for the field locktime.

        Returns:
        a Int object
      • setLocktime

        public void setLocktime​(Int locktime)

        Setter for the field locktime.

        Parameters:
        locktime - a Int object
      • getTxIns

        public List<TxIn> getTxIns()

        Getter for the field txIns.

        Returns:
        a List object
      • getVersion

        public Int getVersion()

        Getter for the field version.

        Returns:
        a Int object
      • getTestnet

        public Boolean getTestnet()

        Getter for the field testnet.

        Returns:
        a Boolean object
      • getMarker

        public Int getMarker()
      • setMarker

        public void setMarker​(Int marker)
      • getFlag

        public Int getFlag()
      • setFlag

        public void setFlag​(Int flag)