Skip to main content
Traditional on-chain automation relies on off-chain transaction replays, which is expensive for use cases like arbitrage, liquidations, and real-time indexing. Solayer Chain introduces Hooks — a built-in execution layer that runs custom logic automatically after a targeted on-chain program updates its state.

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:
  1. Users submit bids to attach Hooks to specific on-chain programs
  2. The top 16 bids per program are selected for the following epoch
  3. If multiple programs with Hooks are touched in a transaction, 16 Hooks total execute, prioritized by bid amount
  4. 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
This model reduces the cost of off-chain transaction replays and rewards both users and program owners for enabling automated execution.

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