Package ch.bitagent.bitcoin.lib.tx
Class Tx
- java.lang.Object
-
- ch.bitagent.bitcoin.lib.tx.Tx
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IntcoinbaseHeight()Returns the height of the block this coinbase transaction is in Returns None if this transaction is not a coinbase transactionIntfee(Map<String,String> cache)Returns the fee of this transaction in satoshibyte[]getCommand()getCommand.IntgetFlag()IntgetLocktime()Getter for the fieldlocktime.IntgetMarker()BooleangetSegwit()Getter for the fieldsegwit.BooleangetTestnet()Getter for the fieldtestnet.List<TxIn>getTxIns()Getter for the fieldtxIns.List<TxOut>getTxOuts()Getter for the fieldtxOuts.IntgetVersion()Getter for the fieldversion.byte[]hash()Binary hash of the legacy serializationStringhexString()Stringid()Human-readable hexadecimal of the transaction hashbooleanisCoinbase()Returns whether this transaction is a coinbase transaction or notstatic Txparse(byte[] rawTx, Boolean testnet)static Txparse(String rawTx, Boolean testnet)byte[]serialize()serialize.voidsetFlag(Int flag)voidsetLocktime(Int locktime)Setter for the fieldlocktime.voidsetMarker(Int marker)IntsigHash(int inputIndex, Script redeemScript, Map<String,String> cache)Returns the integer representation of the hash that needs to get signed for index input_indexIntsigHashBip143(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_indexbooleansignInput(int inputIndex, PrivateKey privateKey, Map<String,String> cache)Signs the input using the private keyintsizeBytes()intsizeVirtualBytes()intsizeWeightUnits()StringtoString()booleanverify(Map<String,String> cache)Verify this transactionbooleanverifyInput(int inputIndex, Map<String,String> cache)Returns whether the input has a valid signature
-
-
-
Field Detail
-
COMMAND
public static final String COMMAND
ConstantCOMMAND="tx"- See Also:
- Constant Field Values
-
-
Method Detail
-
getCommand
public byte[] getCommand()
getCommand.
- Specified by:
getCommandin interfaceMessage- Returns:
- an array of
byteobjects
-
hash
public byte[] hash()
Binary hash of the legacy serialization- Returns:
- an array of
byteobjects
-
serialize
public byte[] serialize()
serialize.
-
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
Intobject
-
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
-
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
-
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
-
signInput
public boolean signInput(int inputIndex, PrivateKey privateKey, Map<String,String> cache)Signs the input using the private key- Parameters:
inputIndex- a intprivateKey- aPrivateKeyobject- 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
Intobject
-
setLocktime
public void setLocktime(Int locktime)
Setter for the field
locktime.- Parameters:
locktime- aIntobject
-
getMarker
public Int getMarker()
-
setMarker
public void setMarker(Int marker)
-
getFlag
public Int getFlag()
-
setFlag
public void setFlag(Int flag)
-
-