Skip to content

Class BSV::Transaction::FeeModels::SatoshisPerKilobyte

Inherits: BSV::Transaction::FeeModel

Fee model that charges a configurable number of satoshis per kilobyte.

Uses the transaction's estimated size (from templates for unsigned inputs, actual size for signed inputs) to compute the fee.

@example

model = BSV::Transaction::FeeModels::SatoshisPerKilobyte.new(value: 100)
fee = model.compute_fee(transaction) # => 25 (for a ~250 byte tx)

Attributes

value [R]

  • @return [Integer] satoshis per kilobyte rate

Public Instance Methods

compute_fee(transaction)

Compute the fee for a transaction based on its estimated size. - @param transaction [Transaction] the transaction to compute the fee for - @return [Integer] the fee in satoshis

initialize(value: = 50)

  • @param value [Integer] satoshis per kilobyte (default: 50)
  • @return [SatoshisPerKilobyte] a new instance of SatoshisPerKilobyte