Package org.bitcoinj.core
Class TransactionWitness
- java.lang.Object
 - 
- org.bitcoinj.core.TransactionWitness
 
 
- 
public class TransactionWitness extends java.lang.Object 
- 
- 
Field Summary
Fields Modifier and Type Field Description static TransactionWitnessEMPTY 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleanequals(java.lang.Object o)intgetMessageSize()Deprecated.UsemessageSize()byte[]getPush(int i)intgetPushCount()inthashCode()intmessageSize()Return the size of the serialized message.static TransactionWitnessof(byte[]... pushes)Construct a transaction witness from a given list of arbitrary pushes.static TransactionWitnessof(java.util.List<byte[]> pushes)Construct a transaction witness from a given list of arbitrary pushes.static TransactionWitnessread(java.nio.ByteBuffer payload)Deserialize this transaction witness from a given payload.static TransactionWitnessredeemP2WPKH(TransactionSignature signature, ECKey pubKey)Creates the stack pushes necessary to redeem a P2WPKH output.static TransactionWitnessredeemP2WSH(Script witnessScript, TransactionSignature... signatures)Creates the stack pushes necessary to redeem a P2WSH output.byte[]serialize()Allocates a byte array and writes this transaction witness into it.java.lang.StringtoString()java.nio.ByteBufferwrite(java.nio.ByteBuffer buf)Write this transaction witness into the given buffer. 
 - 
 
- 
- 
Field Detail
- 
EMPTY
public static final TransactionWitness EMPTY
 
 - 
 
- 
Method Detail
- 
redeemP2WPKH
public static TransactionWitness redeemP2WPKH(@Nullable TransactionSignature signature, ECKey pubKey)
Creates the stack pushes necessary to redeem a P2WPKH output. If given signature is null, an empty push will be used as a placeholder. 
- 
redeemP2WSH
public static TransactionWitness redeemP2WSH(Script witnessScript, TransactionSignature... signatures)
Creates the stack pushes necessary to redeem a P2WSH output. 
- 
of
public static TransactionWitness of(java.util.List<byte[]> pushes)
Construct a transaction witness from a given list of arbitrary pushes.- Parameters:
 pushes- list of pushes- Returns:
 - constructed transaction witness
 
 
- 
of
public static TransactionWitness of(byte[]... pushes)
Construct a transaction witness from a given list of arbitrary pushes.- Parameters:
 pushes- list of pushes- Returns:
 - constructed transaction witness
 
 
- 
read
public static TransactionWitness read(java.nio.ByteBuffer payload) throws java.nio.BufferUnderflowException
Deserialize this transaction witness from a given payload.- Parameters:
 payload- payload to deserialize from- Returns:
 - read message
 - Throws:
 java.nio.BufferUnderflowException- if the read message extends beyond the remaining bytes of the payload
 
- 
getPush
public byte[] getPush(int i)
 
- 
getPushCount
public int getPushCount()
 
- 
write
public java.nio.ByteBuffer write(java.nio.ByteBuffer buf) throws java.nio.BufferOverflowExceptionWrite this transaction witness into the given buffer.- Parameters:
 buf- buffer to write into- Returns:
 - the buffer
 - Throws:
 java.nio.BufferOverflowException- if the serialized data doesn't fit the remaining buffer
 
- 
serialize
public byte[] serialize()
Allocates a byte array and writes this transaction witness into it.- Returns:
 - byte array containing the transaction witness
 
 
- 
messageSize
public int messageSize()
Return the size of the serialized message. Note that if the message was deserialized from a payload, this size can differ from the size of the original payload.- Returns:
 - size of the serialized message in bytes
 
 
- 
getMessageSize
@Deprecated public int getMessageSize()
Deprecated.UsemessageSize() 
- 
toString
public java.lang.String toString()
- Overrides:
 toStringin classjava.lang.Object
 
- 
equals
public boolean equals(java.lang.Object o)
- Overrides:
 equalsin classjava.lang.Object
 
- 
hashCode
public int hashCode()
- Overrides:
 hashCodein classjava.lang.Object
 
 - 
 
 -