Introduction
Cowboy’s Actor Message Scheduler is a protocol-level mechanism that enables truly autonomous actors through native timer support. Unlike traditional blockchains that require external infrastructure for scheduled execution, Cowboy embeds timers directly into the consensus layer.Key Innovation: Actors can schedule their own future execution without relying on centralized keepers, cron jobs, or external bots.
Examples in this page are conceptual and illustrative (non-normative). Final interfaces are defined by the SDK and normative CIPs; do not treat these snippets as fixed APIs.
The Problem with Traditional Chains
No Native Time Awareness
On many traditional chains, contracts cannot self-schedule execution; external actors must trigger functions, which introduces centralization and reliability risks.- Cron Jobs
- Keeper Networks
- User-Triggered
Approach: Off-chain server runs scheduled tasksProblems:
- ❌ Centralized (single point of failure)
- ❌ Requires infrastructure maintenance
- ❌ Trust assumption (will it run?)
- ❌ No SLA guarantees
Cowboy’s Solution: Native Protocol Timers
How It Works
Actors can schedule future execution by specifying a target height and a Gas Bidding Agent (GBA). The protocol will trigger the handler when due, under a fixed per‑block timer budget (CIP‑1). The GBA dynamically prices execution based on protocol‑supplied context.Core Components
Hierarchical Calendar Queue
Three-tier queue system for O(1) scheduling performance
Gas Bidding Agents
Dynamic pricing for timer execution based on urgency
Per-Block Budget
Fixed resource allocation prevents DoS attacks
Priority Queue
Highest-bidding timers execute first during congestion
Hierarchical Calendar Queue
Three-Tier Architecture
Timers are organized into three layers based on their execution distance:Layer 1: Block Ring Buffer
Purpose: Handle timers scheduled for the immediate future. Structure:Layer 2: Epoch Queue
Purpose: Hold timers scheduled for the next few hours/days. Structure:Layer 3: Overflow Sorted Set
Purpose: Store very long-term timers. Structure:Performance Characteristics
Result: Efficiently handles millions of timers with O(1) performance for the common case.
Dynamic Gas Bidding
The Challenge
Fixed pre‑payment for future execution is inflexible under dynamic network conditions; actors need dynamic bidding at execution time.The Solution: Gas Bidding Agents (GBA)
Concept: Actors specify a smart contract (GBA) that dynamically determines the execution bid at runtime.GBA Context
The protocol provides rich context to GBAs for informed bidding:- DeFi Liquidation
- Oracle Update
- Gaming Tick
DoS Protection & Congestion Handling
Fixed Per-Block Budget
Mechanism: Hard limit on timer resource consumption per block.- ✅ Regular user transactions always have guaranteed space
- ✅ Timers cannot monopolize block resources
- ✅ Predictable block processing time
- ✅ DoS-resistant
Priority Queue Execution
Algorithm:Best-Effort Delivery
Rollover Mechanism:- ✅ Liveness: Timers eventually execute (assuming sufficient balance)
- ✅ No data loss: Automatic rollover
- ✅ Fair competition: Higher bids still prioritized on retry
- ✅ Economic feedback: Repeated delays signal need for higher bids
Use Cases
DeFi Liquidation Bot
Oracle Price Updates
Game Loop
Subscription Service
Next Steps
Sequence Diagram
Visualize the complete timer lifecycle
DoS Parameters
Detailed specification of protection mechanisms

