Package 

Class Transaction

  • All Implemented Interfaces:

    
    public final class Transaction
    
                        

    A bitcoin transaction.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
      Transaction(List<UByte> transactionBytes) Build a new Bitcoin Transaction.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final String txid() Computes the txid.
      final ULong weight() Returns the "weight" of this transaction, as defined by BIP141.
      final ULong size() Returns the regular byte-wise consensus-serialized size of this transaction.
      final ULong vsize() Returns the "virtual size" (vsize) of this transaction.
      final List<UByte> serialize() Return the transaction bytes, bitcoin consensus encoded.
      final Boolean isCoinBase() Is this a coin base transaction?
      final Boolean isExplicitlyRbf() Returns true if the transaction itself opted in to be BIP-125-replaceable (RBF).
      final Boolean isLockTimeEnabled() Returns true if this transactions nLockTime is enabled (BIP-65).
      final Integer version() The protocol version, is currently expected to be 1 or 2 (BIP 68).
      final UInt lockTime() Block height or timestamp.
      final List<TxIn> input() List of transaction inputs.
      final List<TxOut> output() List of transaction outputs.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Transaction

        Transaction(List<UByte> transactionBytes)
        Build a new Bitcoin Transaction.
        Parameters:
        transactionBytes - The transaction bytes, bitcoin consensus encoded.
    • Method Detail

      • weight

         final ULong weight()

        Returns the "weight" of this transaction, as defined by BIP141.

        For transactions with an empty witness, this is simply the consensus-serialized size times four. For transactions with a witness, this is the non-witness consensus-serialized size multiplied by three plus the with-witness consensus-serialized size.

      • size

         final ULong size()

        Returns the regular byte-wise consensus-serialized size of this transaction.

      • vsize

         final ULong vsize()

        Returns the "virtual size" (vsize) of this transaction.

        Will be ceil(weight / 4.0). Note this implements the virtual size as per BIP141, which is different to what is implemented in Bitcoin Core. The computation should be the same for any remotely sane transaction.

      • serialize

         final List<UByte> serialize()

        Return the transaction bytes, bitcoin consensus encoded.

      • isExplicitlyRbf

         final Boolean isExplicitlyRbf()

        Returns true if the transaction itself opted in to be BIP-125-replaceable (RBF). This does not cover the case where a transaction becomes replaceable due to ancestors being RBF.

      • version

         final Integer version()

        The protocol version, is currently expected to be 1 or 2 (BIP 68).

      • lockTime

         final UInt lockTime()

        Block height or timestamp. Transaction cannot be included in a block until this height/time. Relevant BIPs BIP-65 OP_CHECKLOCKTIMEVERIFY BIP-113 Median time-past as endpoint for lock-time calculations