Skip to content

Class BSV::Transaction::TransactionOutput

Inherits: Object

A transaction output specifying an amount and spending conditions.

Each output locks a number of satoshis behind a locking script. Outputs are consumed by transaction inputs that provide matching unlocking scripts.

Attributes

change [RW]

  • @return [Boolean] whether this output receives change

locking_script [R]

  • @return [Script::Script] the locking script (spending conditions)

satoshis [RW]

  • @return [Integer] the output value in satoshis

Public Class Methods

from_binary(data, offset = 0)

Deserialise a transaction output from binary data. - @param data [String] binary data - @param offset [Integer] byte offset to start reading from - @return [Array(TransactionOutput, Integer)] the output and bytes consumed

Public Instance Methods

initialize(satoshis:, locking_script:, change: = false)

  • @param satoshis [Integer] output value in satoshis
  • @param locking_script [Script::Script] the locking script
  • @param change [Boolean] whether this is a change output (default: false)
  • @return [TransactionOutput] a new instance of TransactionOutput

to_binary()

Serialise the output to its binary wire format. - @return [String] binary output (8-byte LE satoshis + varint + script)