Architecture

On Chain
nft-trasfer module
To adapt the Specy network with ICS-721 protocol, we do an enhancement for the nft-transfer module
, a new event called interchainNFT receive event
used to inform that there is a new NFT has been transferred from other chains to the chain.
Specy Module
Specy Module
is a cosmos module used to manage task, deposit and executor. It's main functions include:
Task Manage: task register, task update, task cancel, etc.
Executor Manage: executor selection, executor register, etc.
Deposit Manage: manage executor's deposit and user's deposit.
Keepers: execute task by using registered keepers.
Off Chain
Task Scheduler
Task Scheduler is used to schedule task. It has an Event Handler used to listen events from chains, and a Scheduler used to schedule tasks when the task's condition meet.
Task Engine
Task Engine is used to execute tasks and return task's result with a proof.
Engine Service: a gRPC service used to communicate with Task Scheduler.
Engine: a interpreter running inside the SGX enviroment used to execute task following the logic of task's script with on-chain datas.
Data Service: used to query data from database.
Register Task

User register a task.
Specy Module emit an task event.
Task Scheduler's event listener receive Task Event.
The Graph receive and store Task Event.
Create a new task schedule for receiving Task Event.
Execute Task
Triger by Event

A new transaction from users.
Chain emit an new event.
Task Scheduler's event listener and The Graph receive Task Event.
Scheduler found that this event statisfy a condition of a task.
Scheduler Schedule this task and send a task executing request to Task Engine.
Task Engine receive the request and execute the task' s script file inside Engine with data from The Graph.
Scheduler pack the task result into an transaction and send it to the Chain.
Task Manager verify the result and execute task's target function by using registered Keepers.
Keeper will execute the target function.
Triger by Timer

Task Scheduler will keep a timer to handle timed task. Timer can activate Scheduler like Event Listener do.
Scheduler Schedule the task and send a task executing request to Task Engine.
Task Engine receive the request and execute the task' s script file inside Engine with data from The Graph.
Scheduler pack the task result into an transaction and send it to the Chain.
Task Manager verify the result and execute task's target function by using registered Keepers.
Keeper will execute the target function.
Last updated