Package org.bitcoinj.core
Class UTXO
java.lang.Object
org.bitcoinj.core.UTXO
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 free standing outputs.
-
Constructor Summary
ConstructorDescriptionUTXO
(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, String address) Creates a stored transaction output. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static UTXO
The address of this output, can be the empty string if none was provided at construction time or was deserializedgetHash()
The hash of the transaction which holds this output.int
Gets the height of the block that created this output.long
getIndex()
The index of this output in the transaction which holds it.The Script object which you can use to get address, script bytes or script type.getValue()
The value which this Transaction output holds.int
hashCode()
boolean
Gets the flag of whether this was created by a coinbase tx.void
toString()
-
Constructor Details
-
UTXO
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, 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 Details
-
getValue
The value which this Transaction output holds. -
getScript
The Script object which you can use to get address, script bytes or script type. -
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
The address of this output, can be the empty string if none was provided at construction time or was deserialized -
toString
-
hashCode
public int hashCode() -
equals
-
serializeToStream
- Throws:
IOException
-
fromStream
- Throws:
IOException
-