Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link

Icon LinkInput

enum InputType : uint8 {
    Coin = 0,
    Contract = 1,
    Message = 2,
}
nametypedescription
typeInputType Type of input.
dataOne of InputCoin , InputContract , or InputMessage Input data.

Transaction is invalid if:

  • type > InputType.Message

Icon LinkInputCoin

nametypedescription
txIDbyte[32]Hash of transaction.
outputIndexuint8Index of transaction output.
ownerbyte[32]Owning address or predicate root.
amountuint64Amount of coins.
asset_idbyte[32]Asset ID of the coins.
txPointerTXPointer Points to the TX whose output is being spent.
witnessIndexuint8Index of witness that authorizes spending the coin.
maturityuint32UTXO being spent must have been created at least this many blocks ago.
predicateGasUseduint64Gas used by predicate.
predicateLengthuint16Length of predicate, in instructions.
predicateDataLengthuint16Length of predicate input data, in bytes.
predicatebyte[]Predicate bytecode.
predicateDatabyte[]Predicate input data (parameters).

Given helper len() that returns the number of bytes of a field.

Transaction is invalid if:

  • witnessIndex >= tx.witnessesCount
  • predicateLength > MAX_PREDICATE_LENGTH
  • predicateDataLength > MAX_PREDICATE_DATA_LENGTH
  • If predicateLength > 0; the computed predicate root (see below) is not equal owner
  • predicateLength * 4 != len(predicate)
  • predicateDataLength != len(predicateData)
  • predicateGasUsed > MAX_GAS_PER_PREDICATE

If h is the block height the UTXO being spent was created, transaction is invalid if blockheight() < h + maturity.

Icon InfoCircle

Note: when signing a transaction, txPointer and predicateGasUsed is set to zero.

Note: when verifying and estimating a predicate, txPointer and predicateGasUsed is initialized to zero.

Note: when executing a script, txPointer is initialized to the TX whose output is being spent.

The predicate root is computed here .

Icon LinkInputContract

nametypedescription
txIDbyte[32]Hash of transaction.
outputIndexuint8Index of transaction output.
balanceRootbyte[32]Root of amount of coins owned by contract before transaction execution.
stateRootbyte[32]State root of contract before transaction execution.
txPointerTXPointer Points to the TX whose output is being spent.
contractIDbyte[32]Contract ID.

Transaction is invalid if:

  • there is not exactly one output of type OutputType.Contract with inputIndex equal to this input's index
Icon InfoCircle

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

Note: when verifying a predicate, txID, outputIndex, balanceRoot, stateRoot, and txPointer are initialized to zero.

Note: when executing a script, txID, outputIndex, balanceRoot, and stateRoot are initialized to the transaction ID, output index, amount, and state root of the contract with ID contractID, and txPointer is initialized to the TX whose output is being spent.

Icon LinkInputMessage

nametypedescription
senderbyte[32]The address of the message sender.
recipientbyte[32]The address or predicate root of the message recipient.
amountuint64Amount of base asset coins sent with message.
noncebyte[32]The message nonce.
witnessIndexuint8Index of witness that authorizes spending the coin.
predicateGasUseduint64Gas used by predicate execution.
dataLengthuint16Length of message data, in bytes.
predicateLengthuint16Length of predicate, in instructions.
predicateDataLengthuint16Length of predicate input data, in bytes.
databyte[]The message data.
predicatebyte[]Predicate bytecode.
predicateDatabyte[]Predicate input data (parameters).

Given helper len() that returns the number of bytes of a field.

Transaction is invalid if:

  • witnessIndex >= tx.witnessesCount
  • dataLength > MAX_MESSAGE_DATA_LENGTH
  • predicateLength > MAX_PREDICATE_LENGTH
  • predicateDataLength > MAX_PREDICATE_DATA_LENGTH
  • If predicateLength > 0; the computed predicate root (see below) is not equal recipient
  • dataLength != len(data)
  • predicateLength * 4 != len(predicate)
  • predicateDataLength != len(predicateData)
  • predicateGasUsed > MAX_GAS_PER_PREDICATE

The predicate root is computed here .

Icon InfoCircle

Note: InputMessages with data length greater than zero are not considered spent until they are included in a transaction of type TransactionType.Script with a ScriptResult receipt where result is equal to 0 indicating a successful script exit

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

Note: when verifying and estimating a predicate, predicateGasUsed is initialized to zero.