What Are Hooks?
A Hook is a user-defined transaction that executes immediately after a specific on-chain program updates state. It acts as an embedded backrunning mechanism for real-time on-chain automation. Common use cases:- Automated arbitrage — execute when price disparities occur
- Liquidation triggers — liquidate under-collateralized positions without off-chain monitoring
- Real-time accounting — update account balances and records efficiently
How Hooks Work
Hooks behave similarly to regular transactions:- Users provide accounts and data when registering a Hook
- Gas fees are deducted from the fee payer’s account at execution
- If the fee payer lacks funds for three consecutive executions, the Hook is disabled
Registration & Bidding
Hook registration uses a Dutch auction-based bidding system:- Users submit bids to attach Hooks to specific on-chain programs
- The top 16 bids per program are selected for the following epoch
- If multiple programs with Hooks are touched in a transaction, 16 Hooks total execute, prioritized by bid amount
- After a transaction completes, Hooks execute in sequence
Fee Distribution
Executed Hooks follow a 40-40-20 split:- 40% to the transaction initiator
- 40% to the program owner where the Hook was registered
- 20% to the network for execution overhead
MEV Resistance
By running Hooks inside Solayer Chain’s execution pipeline:- Hook bids are transparent, preventing off-chain MEV exploitation
- Front-running risk is eliminated through open, on-chain competition
- Hook execution is limited to top-bid transactions, preventing spam