Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Nightly /
Output

Icon LinkOutput

enum OutputType : uint8 {
    Coin = 0,
    Contract = 1,
    Change = 2,
    Variable = 3,
    ContractCreated = 4,
}
nametypedescription
typeOutputType Type of output.
dataOne of OutputCoin , OutputContract , OutputChange , OutputVariable , or OutputContractCreated .Output data.

Transaction is invalid if:

  • type > OutputType.ContractCreated

Icon LinkOutputCoin

nametypedescription
tobyte[32]Receiving address or predicate root.
amountuint64Amount of coins to send.
asset_idbyte[32]Asset ID of coins.

Icon LinkOutputContract

nametypedescription
inputIndexuint16Index of input contract.
balanceRootbyte[32]Root of amount of coins owned by contract after transaction execution.
stateRootbyte[32]State root of contract after transaction execution.

Transaction is invalid if:

  • inputIndex >= tx.inputsCount
  • tx.inputs[inputIndex].type != InputType.Contract
Icon InfoCircle

Note: when signing a transaction, balanceRoot and stateRoot are set to zero.

Note: when verifying a predicate or executing a script, balanceRoot and stateRoot are initialized to zero.

The balance root balanceRoot is the root of the SMT of balance leaves. Each balance is a uint64, keyed by asset ID (a byte[32]).

The state root stateRoot is the root of the SMT of storage slots. Each storage slot is a byte[32], keyed by a byte[32].

Icon LinkOutputChange

nametypedescription
tobyte[32]Receiving address or predicate root.
amountuint64Amount of coins to send.
asset_idbyte[32]Asset ID of coins.

Transaction is invalid if:

  • any other output has type OutputType.OutputChange and asset ID asset_id (i.e. only one change output per asset ID is allowed)
Icon InfoCircle

Note: when signing a transaction, amount is set to zero.

Note: when verifying a predicate or executing a script, amount is initialized to zero.

This output type indicates that the output's amount may vary based on transaction execution, but is otherwise identical to a Coin output. An amount of zero after transaction execution indicates that the output is unspendable and can be pruned from the UTXO set.

Icon LinkOutputVariable

nametypedescription
tobyte[32]Receiving address or predicate root.
amountuint64Amount of coins to send.
asset_idbyte[32]Asset ID of coins.
Icon InfoCircle

Note: when signing a transaction, to, amount, and asset_id are set to zero.

Note: when verifying a predicate or executing a script, to, amount, and asset_id are initialized to zero.

This output type indicates that the output's amount and owner may vary based on transaction execution, but is otherwise identical to a Coin output. An amount of zero after transaction execution indicates that the output is unspendable and can be pruned from the UTXO set.

Icon LinkOutputContractCreated

nametypedescription
contractIDbyte[32]Contract ID.
stateRootbyte[32]Initial state root of contract.