---
eip: 5568
label: ERC-5568
title: Well-Known Format for Required Actions
status: Review
type: Standards Track
category: ERC
created: 2022-08-31
requires: 140
official: https://eips.ethereum.org/EIPS/eip-5568
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5568.md
canonical: https://eips.huatuo.xyz/eip-5568/
lang: en
tldr: "A standard way for a contract to tell a wallet \"the user must do something first\" (approve a token, make an HTTP request, rotate keys) via a well-known view function and a custom revert error."
tags: [wallet, revert, ux, interface]
---

# ERC-5568: Well-Known Format for Required Actions

> Signal to wallets that an action is needed through a well-known function and revert reason

**TL;DR:** A standard way for a contract to tell a wallet "the user must do something first" (approve a token, make an HTTP request, rotate keys) via a well-known view function and a custom revert error.

## What problem does it solve?

Often a transaction will fail unless the user does something first: approve an [ERC-20](/eip-20/) allowance, fetch data from a server, sign something. Today that knowledge lives in each dApp's frontend, which must hard-code every prerequisite.

ERC-5568 lets the **contract itself** tell the wallet what action is needed, in a compact machine-readable form, so a wallet can handle it generically.

## How it works

Two pieces:

1. **Detection function**, which the wallet simulates before sending:

   ```solidity
   function walletSignal24(bytes32 selector, bytes function_data)
       view returns (uint24 instruction_id, bytes instruction_data);
   ```

   `instruction_id = 0` means nothing is needed. A non-zero value names an instruction, and `instruction_data` holds its parameters.

2. **Custom revert error**, used when an action was not taken (revert data relies on [EIP-140](/eip-140/) `REVERT`):

   ```solidity
   error WalletSignal24(uint24 instruction_id, bytes instruction_data);
   ```

Rules:

- An instruction's `instruction_id` should be the number of the ERC that defines it, and each ERC defines at most one. That ERC also defines the data layout.
- The wallet must simulate `walletSignal24` locally before broadcasting, treating it as able to change state.
- If the wallet does not support the instruction, it must show an error. Otherwise it performs the instruction and re-evaluates the transaction, unless the instruction says not to.
- Invalid or unparsable instructions must produce an error, with no re-evaluation.

ERC-165 is not used; a wallet detects support by simply calling the function.

## Sample code

Wallet-side check before sending a transaction (ethers v6):

```ts
import { Contract, JsonRpcProvider } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const abi = [
  "function walletSignal24(bytes32 selector, bytes function_data) view returns (uint24, bytes)",
];

async function requiredAction(to: string, data: string) {
  const c = new Contract(to, abi, provider);
  const selector = data.slice(0, 10).padEnd(66, "0"); // 4-byte selector, right-padded to bytes32
  try {
    const [id, payload] = await c.walletSignal24.staticCall(selector, "0x" + data.slice(10));
    return id === 0n ? null : { id: Number(id), payload };
  } catch {
    return null; // contract does not implement ERC-5568
  }
}
```

How the selector is packed into `bytes32` and whether `function_data` includes it are not spelled out in the spec; this example is one reasonable reading.

## Things to know

- Status is **Review**; the format may still change.
- This ERC defines only the signalling envelope. Concrete instructions (and their data formats) must be defined by other ERCs.
- [ERC-3668](/eip-3668/) (CCIP Read) solves a related problem, fetching off-chain data, with a different revert-based mechanism; the two can coexist.
- The spec considers collisions with existing custom errors unlikely and mostly harmless.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-5568
