What Are Cranks?
Cranks (scheduled tasks) enable automated, time-based execution of on-chain instructions without requiring manual user intervention. In traditional blockchain systems, every action requires a user to sign and submit a transaction, which limits automation capabilities. With MagicBlock’s Ephemeral Rollups, you can schedule tasks that execute automatically at predetermined intervals, bringing powerful automation capabilities to your Solana programs.Key Benefits
- Automated Execution: Programs can execute instructions at predetermined intervals without user interaction
- Cost Efficiency: Reduces the need for off-chain cron jobs or monitoring services
- Decentralization: Execution happens on-chain, maintaining trustless guarantees
- Reliability: Scheduled tasks execute reliably within the blockchain’s consensus mechanism
Use Cases
- Periodic State Updates: Update prices, clear expired data, or refresh game state
- Automated Workflows: Recurring payments, vesting schedules, or subscription renewals
- Game Mechanics: Periodic rewards, time-based events, or automated game progression
- DeFi Operations: Rebalancing portfolios, liquidation checks, or yield compounding
Implementation
Learn how to implement cranks in your program
Code Example
Check out our GitHub repository
Automate prediction-market settlement
See where cranks fit into expiry checks, liquidation checks, and settlement.
How It Works
Cranks leverage MagicBlock’s Ephemeral Rollups to provide scheduled execution:- Initialize your program state on Solana base layer
- Delegate accounts to Ephemeral Rollup for faster execution
- Schedule a crank task that automatically executes instructions
- Execute automatically at specified intervals
- Undelegate accounts back to Solana base layer when done
Cranks execute within the Ephemeral Rollup’s consensus mechanism, ensuring reliable and trustless execution. For detailed implementation steps, see the Implementation guide.

