Struct Transaction

Represents a transaction (shortened as 'tx')

struct Transaction ;

Agora uses a UTXO model for transactions, so the transaction format is originally derived from that of Bitcoin.

Constructors

NameDescription
this (outputs) ctor with only outputs
this (inputs, outputs, lock_height) ctor without payload
this (inputs, outputs, payload, lock_height) ctor with immutable fields so the inputs and outputs must be already sorted

Fields

NameTypeDescription
inputs Input[]The list of unspent outputs from previous transaction(s) that will be spent
lock_height HeightThis transaction may only be included in a block with height >= lock_height. Note that another tx with a lower lock time could double-spend this tx.
outputs Output[]The list of newly created outputs to put in the UTXO
payload ubyte[]The data to store

Methods

NameDescription
isCoinbase () A Coinbase transaction is one that has one or more Coinbase outputs However if all outputs are not Coinbase then it will fail validation
isFreeze () A Freeze transaction is one that has one or more Freeze outputs If there is more than one output then it is allowed to have a single Payment output for a refund of any amount
isPayment () A Payment transaction is one that has outputs of type Payment
opCmp (other) Support for sorting transactions
sizeInBytes () The size of the Transaction object