...
Triggers can be either based on time or on a confirmed transaction (event). This is very powerful and enables Turing complete computation for Iroha's smart contracts.
- Trigger at timestamp (every 5 minutes or after one hour)
- Trigger at blockchain (new block, reach of some height, etc.)
- Trigger at condition (new account, transfer of an asset, etc.)
Also, for cases like Iroha Permissions Module we will need to be able to manage Triggers execution order - for example to execute them before block/transaction/instruction or after.
Impure Triggers and Instructions
Because impure (I/O to 3rd party systems) Instructions and Triggers will not be supported by Iroha 2 - Iroha Events can be used to receive information by Cloud Events Consumers.
...
Representation
- Triggers will be build on top of Iroha Special Instructions and WASM
- For instruction-based Triggers condition will be of `Instruction::Execute(Query)` type
- All changes are declared as a set of Iroha Special Instructions or WASM
Place in the WSV hierarchy
- Store Triggers under Peer entity
- Provide a Store (key-value) for each trigger - way to keep data between executions. Provide a possibility to create technical accounts for Triggers where they might keep transferred funds.
Categories
- Have the following Triggers categories:
- Time-based
- Block number-based
- Transaction-based (can have a condition of whether they need to execute, similar to Oracle `when` condition)
- Triggers that are triggered by specific ISI call - ExecuteTrigger(Params)
- Have an ability to configure trigger order for Transaction Based triggers:
- Before (transaction execution) - have the ability to check and fail or allow transaction
- After (transaction execution)
Permissions
It is suggested to:
- Provide a Store (key-value) for each trigger - way to keep data between executions.
- Provide a possibility to create technical accounts for Triggers where they might keep transferred funds.Triggers will be build on top of Iroha Special Instructions and WASM
- For instruction-based Triggers condition will be of `Instruction::Execute(Query)` type All changes are declared as a set of Iroha Special Instructions or WASM
Triggers can be subdivided into the following categories and uses cases:
...