# System Hooks

System hooks are special functions that can be triggered by a call on a specific system address. The space for this special address is specified in the [bootloader](/adi-network-components/bootloader.md) configuration.

System hooks have two distinct use cases:

* Implementing precompiles like EVM. We currently support the following precompiles at their EVM addresses:
  * ecrecover
  * sha256
  * ripemd-160
  * identity
  * modexp
  * ecadd
  * ecmul
  * ecpairing
* Implementing system contracts: formal contracts that implement some system functionality.
  * L1 messenger system hook
  * L2 Base token system hook
  * Contract deployer system hook

### L1 Messenger System Hook

The L1 messenger system hook is responsible for sending messages to the L1. Users can call it using the special interface. The input should be encoded as calldata for the `sendToL1(bytes)` method following the Solidity ABI.

The implementation of the L1 messenger system hook does two things: decodes the input and records the message using the system method.

### L2 Base Token System Hook

The L2 base token system implements only two methods: `withdraw(address)`, `withdrawWithMessage(address,bytes)`. These are required to support base token withdrawals.

### Contract Deployer System Hook

The contract deployer system hook implements only one method: `setDeployedCodeEVM(address,bytes)`.

It allows setting arbitrary deployed EVM bytecode at any address, but can only be called by a special system address. It is used exclusively by protocol upgrade transactions approved through governance.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.adi.foundation/adi-network-components/system-hooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
