EN

What a Hook is

3 minDifficulty Checked 2026-11-10
Key takeaways
  • A Hook is a small WebAssembly program attached to one account.
  • It runs when a transaction touches that account, and can accept or reject it.
  • Every loop has a fixed cap, so the network knows the worst-case cost in advance.

Picture a doorman at your account. Every transaction that touches the account walks past him. He checks it against a short list of rules you wrote. Then he lets it through or turns it away.

That doorman is a Hook. It is a small program attached to one account.

Examples from the Xahau docs:

  • Refuse incoming payments below an amount you choose.
  • Send a share of every outgoing payment to a savings account.
  • Keep a small list, such as approved senders, that other Hooks can check.
  • Start a new transaction from the account, such as a refund.

Hooks are limited on purpose. Every loop has a fixed maximum number of rounds. A Hook cannot run forever, and the network knows its worst-case cost before it runs.

A rejected transaction still costs its sender the fee. So a Hook that refuses spam does not make spam free.

Hooks run on Xahau, a separate network. They do not run on the XRP Ledger. See Xahau, a separate network.

Check yourself3 questions
1. A payment arrives at an account that has a Hook. What can the Hook do?
2. Why must every loop in a Hook have a guard?
3. What happens to the original transaction when a Hook calls rollback?
Sources
Next lessonXahau, a separate network3 min