Class UTXO


  • public class UTXO
    extends java.lang.Object
    A UTXO message contains the information necessary to check a spending transaction. It avoids having to store the entire parentTransaction just to get the hash and index. Useful when working with freestanding outputs.
    • Constructor Summary

      Constructors 
      Constructor Description
      UTXO​(Sha256Hash hash, long index, Coin value, int height, boolean coinbase, Script script)
      Creates a stored transaction output.
      UTXO​(Sha256Hash hash, long index, Coin value, int height, boolean coinbase, Script script, java.lang.String address)
      Creates a stored transaction output.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getAddress()
      The address of this output, can be the empty string if none was provided at construction time or was deserialized
      Sha256Hash getHash()
      The hash of the transaction which holds this output.
      int getHeight()
      Gets the height of the block that created this output.
      long getIndex()
      The index of this output in the transaction which holds it.
      Script getScript()
      The Script object which you can use to get address, script bytes or script type.
      Coin getValue()
      The value which this Transaction output holds.
      int hashCode()  
      boolean isCoinbase()
      Gets the flag of whether this was created by a coinbase tx.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • UTXO

        public UTXO​(Sha256Hash hash,
                    long index,
                    Coin value,
                    int height,
                    boolean coinbase,
                    Script script)
        Creates a stored transaction output.
        Parameters:
        hash - The hash of the containing transaction.
        index - The outpoint.
        value - The value available.
        height - The height this output was created in.
        coinbase - The coinbase flag.
      • UTXO

        public UTXO​(Sha256Hash hash,
                    long index,
                    Coin value,
                    int height,
                    boolean coinbase,
                    Script script,
                    java.lang.String address)
        Creates a stored transaction output.
        Parameters:
        hash - The hash of the containing transaction.
        index - The outpoint.
        value - The value available.
        height - The height this output was created in.
        coinbase - The coinbase flag.
        address - The address.
    • Method Detail

      • getValue

        public Coin getValue()
        The value which this Transaction output holds.
      • getScript

        public Script getScript()
        The Script object which you can use to get address, script bytes or script type.
      • getHash

        public Sha256Hash getHash()
        The hash of the transaction which holds this output.
      • getIndex

        public long getIndex()
        The index of this output in the transaction which holds it.
      • getHeight

        public int getHeight()
        Gets the height of the block that created this output.
      • isCoinbase

        public boolean isCoinbase()
        Gets the flag of whether this was created by a coinbase tx.
      • getAddress

        public java.lang.String getAddress()
        The address of this output, can be the empty string if none was provided at construction time or was deserialized
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object