# Invoke Script Transaction
Invoke Script transaction invokes the callable function of the dApp. Learn more about dApp and script invocation
In addition to the dApp address, callable function name, and arguments, the Invoke Script transaction can contain payments to dApp. The maximum number of payments is 10. (Before activation of feature #16 “Ride V5, dApp-to-dApp invocations”, the maximum number of payments was 2. Before activation of feature #15 “Ride V4, VRF, Protobuf, Failed transactions”, the maximum number of payments was 1.)
# Fee
The sender can specify a transaction fee nominated in a sponsored asset instead of WAVES, see the Sponsored Fee article.
The minimum fee in WAVES for an Invoke Script transaction is calculated as follows:
Fee
= 0.005 + S
+ 1 × I
- If the transaction sender is a dApp or smart account, and that the complexity of the account script or dApp script verifier function exceeds the sender complexity threshold, then
S
= 0.004, otherwiseS
= 0. I
is the number of issued assets that are not NFT.
Before activation of feature #16 “Ride V5, dApp-to-dApp invocations”
- The minimum fee was increased by 0.004 WAVES for each execution of asset script in payments and script actions.
- The extra fee of 0.004 WAVES was required for transactions sent from smart account or dApp regardless of the complexity of the account script or the presence and complexity of the dApp script verifier function.)
# Total Complexity
A dApp callable function can invoke a callable function of another dApp, or another callable function of the same dApp, or even itself. All invoked functions are executed within a single Invoke Script transaction. More about dApp-to-dApp invocation
The maximum total complexity of all callable functions and asset scripts within the transaction depends on the version of Standard library in the first dApp script invoked:
- If the first dApp script uses version 6, 7, or 8, the total complexity is limited by 52 000.
- If the first dApp script uses version 5, the total complexity is limited by 26 000. If functions of the script that uses version 6 and above are invoked next, their complexity can exceed 10,000 and is limited only by the total complexity of the transaction.
The sender's account script complexity is not included in that limit.
DApp-to-dApp invocation is enabled by feature #16 “Ride V5, dApp-to-dApp invocations”. Before activation of feature #16, the total complexity was not limited.
# Transaction size
- For a transaction version 2, the maximum size of
InvokeScriptTransactionData
(see the Invoke Script Transaction Binary Format article) is 5120 bytes. - For a transaction version 1, the maximum transaction size including proofs is 5120 bytes.
# JSON Representation
{
"type": 16,
"id": "6iYsfcVrty9piDkMtHEJ1CzQdbruGNaXUBSGmSpFuYN7",
"sender": "3Mw48B85LvkBUhhDDmUvLhF9koAzfsPekDb",
"senderPublicKey": "BvJEWY79uQEFetuyiZAF5U4yjPioMj9J6ZrF9uTNfe3E",
"fee": 500000,
"feeAssetId": null,
"timestamp": 1640104777935,
"proofs": [
"2kQiPyBGn9uTnD7b4FNvtrNAGTpxPRVDbE4tQrJWuoNjXVs6TenCuYqSyBd4QeBQ7Ng2Fi5G9PdmiNBDXUz3wWqf"
],
"version": 1,
"dApp": "3N28o4ZDhPK77QFFKoKBnN3uNeoaNSNXzXm",
"payment": [],
"call": {
"function": "foo",
"args": [
{
"type": "list",
"value": [
{
"type": "string",
"value": "theta"
},
{
"type": "string",
"value": "iota"
},
{
"type": "string",
"value": "kappa"
}
]
}
]
},
"height": 1844277,
"applicationStatus": "succeeded",
"spentComplexity": 57,
"stateChanges": {
"data": [
{
"key": "3Mw48B85LvkBUhhDDmUvLhF9koAzfsPekDb",
"type": "string",
"value": "thetaiotakappa"
}
],
"transfers": [],
"issues": [],
"reissues": [],
"burns": [],
"sponsorFees": [],
"leases": [],
"leaseCancels": [],
"invokes": []
}
}
Field | Description |
---|---|
call.function | Callable function name. Up to 255 bytes (1 character can take up to 4 bytes) |
call.args.type | Argument type: - binary - boolean - integer - string - list (lists are available after activation of feature #15) |
call.args.value | Argument value. Binary value should be base64 encoded |
dApp | dApp address base58 encoded or dApp alias with alias:<chain_id>: prefix, for example alias:T:merry (see Chain ID) |
payment.amount | Amount of token in payment: an integer value specified in atomic units |
payment.assetId | ID of token in payment, base58 encoded. null means that the payment is in WAVES |
spentComplexity | Actual complexity of calculations performed by all scripts within the transaction, except the sender's account script |
stateChanges | Script actions performed by the callable function and dApp-to-dApp invocation results |
If the
call
field is not specified, the default function of the dApp is invoked.
The spentComplexity
and stateChanges
fields do not need to be filled when sending a transaction, and they are not stored on the blockchain. The node returns these fields when providing transaction data via the REST API.
The fields that are common to all types of transactions are described in the Transaction article.
# Binary Format
See the Invoke Script Transaction Binary Format article.
# Ride Structure
The InvokeScriptTransaction structure is used for transaction handling in smart contracts.