Icon HelpCircleForumIcon Link

⌘K

Icon HelpCircleForumIcon Link
Nightly /
Input

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.
outputIndexuint16Index 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.
witnessIndexuint16Index of witness that authorizes spending the coin.
predicateGasUseduint64Gas used by predicate.
predicateLengthuint64Length of predicate, in instructions.
predicateDataLengthuint64Length 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
Icon InfoCircle

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

Note: when verifying and estimating a predicate or executing a script, txPointer and predicateGasUsed are initialized to zero.

The predicate root is computed here .

Icon LinkInputContract

nametypedescription
txIDbyte[32]Hash of transaction.
outputIndexuint16Index 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 or executing a script, txID, outputIndex, balanceRoot, stateRoot, and txPointer are initialized to zero.

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.
witnessIndexuint16Index of witness that authorizes spending the coin.
predicateGasUseduint64Gas used by predicate execution.
dataLengthuint64Length of message data, in bytes.
predicateLengthuint64Length of predicate, in instructions.
predicateDataLengthuint64Length 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.