ICP timers (heartbeat system)


The Orally Network utilizes the Internet Computer Protocol's execution layer, specifically the heartbeat and timer functionality, to manage canister smart contracts and schedule tasks. This allows the network to execute work in rounds, with each round triggered by consensus on a block of messages.

The implementation of heartbeat or timer methods allows canisters to schedule tasks at regular intervals. This is achieved by placing messages in a canister-specific task queue. During each round, the scheduler chooses between executing a task or a message in a round-robin fashion when the canister is scheduled for execution.

ICP Timer Mechanism

The timer mechanism in the Orally Network is made possible through the use of the ICP's canister execution model. Each canister can initiate timer events, and these events are scheduled and executed in rounds as determined by the consensus layer.

Within a round, messages for timer events are placed into input queues for the respective canisters, with a certain instruction limit for execution in each round. This instruction limit, in combination with the scheduler's determination, dictates how many timer events can be executed in each round.

The ability to schedule tasks at regular intervals through heartbeat or timer methods allows the network to effectively manage workloads and ensure fair distribution among canisters. These scheduled tasks can cover a range of operations within the network, including updating state, interacting with other canisters, or any other work that the canister is programmed to perform.

Timer On-Chain

The use of timers on-chain provides a reliable, deterministic mechanism for scheduling tasks within the network. It enables the ability to have specific tasks or operations performed at regular intervals, which is crucial for maintaining synchronization and coordination within the Orally Network.

In addition, on-chain timers contribute to the robustness and reliability of the network. As these timers are part of the replicated state within the network, they are resistant to single points of failure and are not affected by the downtime of individual nodes.

These timer functionalities are key to the efficient operation of canisters within the Orally Network. By enabling tasks to be performed at regular intervals, they ensure that canisters can operate independently while also cooperating effectively with other canisters.

Overall, the use of ICP timers in the Orally Network allows for efficient scheduling and execution of tasks. This, in turn, contributes to the overall efficiency and reliability of the network.

Last updated