---
eip: 801
label: ERC-801
title: Canary Standard
status: Stagnant
type: Standards Track
category: ERC
created: 2017-12-16
official: https://eips.ethereum.org/EIPS/eip-801
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-801.md
canonical: https://eips.huatuo.xyz/eip-801/
lang: en
tldr: "A minimal interface for on-chain \"canary\" contracts that stay alive only while someone keeps feeding them, so apps can detect when a warrant canary or heartbeat stops."
tags: [canary, heartbeat, monitoring, interface]
---

# ERC-801: Canary Standard

> A standard interface for canary contracts.

**TL;DR:** A minimal interface for on-chain "canary" contracts that stay alive only while someone keeps feeding them, so apps can detect when a warrant canary or heartbeat stops.

## What problem does it solve?

A **warrant canary** is a statement such as "we have not received a secret subpoena" that an organization repeats on a schedule. If it stops, people can infer something happened, without the organization ever saying so. The same idea works for heartbeats: "this operator is still active", or "this device still checks in".

On Ethereum, a canary can be a contract that someone must "feed" with regular transactions. ERC-801 gives these contracts a common interface, so dashboards, alarm services, feeder apps and even insurance contracts can read any canary's state the same way.

## How it works

The interface is intentionally tiny:

| Member | Meaning |
| --- | --- |
| `isAlive()` | `true` if the canary has been fed properly |
| `getBlockOfDeath()` | Block number at which it died. Throws while it is still alive |
| `getType()` | Kind of canary (see below) |
| `event RIP()` | Must be emitted on the first call after the canary died |

Proposed `getType()` values:

- `1` Simple: just this interface
- `2` Single feeder
- `3` Single feeder with "bad food"
- `4` Multiple feeders
- `5` Multiple mandatory feeders
- `6` IoT

Types 2 to 6 point to follow-up ERCs ("ERC-TBD") that were never written. **How** a canary is fed, and how long it may go hungry, is left to the implementation.

## Sample code

A single-feeder canary that dies if not fed within `interval` blocks:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

contract SimpleCanary {
    event RIP();

    address public immutable feeder;
    uint256 public immutable interval;   // max blocks between feedings
    uint256 public lastFed;
    bool private ripEmitted;

    constructor(uint256 _interval) {
        feeder = msg.sender;
        interval = _interval;
        lastFed = block.number;
    }

    function isAlive() public view returns (bool) {
        return block.number <= lastFed + interval;
    }

    function getBlockOfDeath() external view returns (uint256) {
        require(!isAlive(), "still alive");
        return lastFed + interval + 1;
    }

    function getType() external pure returns (uint8) {
        return 2; // single feeder
    }

    function feed() external {
        require(msg.sender == feeder, "not feeder");
        if (!isAlive()) {
            if (!ripEmitted) { ripEmitted = true; emit RIP(); }
            return;                      // a dead canary stays dead
        }
        lastFed = block.number;
    }
}
```

## Things to know

- This proposal is **Stagnant** and was never finalized. The spec's own implementation section still reads "TODO".
- The spec uses pre-0.5 Solidity (`constant` functions). Modern code uses `view`.
- `RIP` can only be emitted when someone calls the contract after death, because contracts cannot act on their own. Off-chain watchers should poll `isAlive()` rather than wait for the event.
- A canary only proves that the feeder kept sending transactions. What a missed feeding means is a social or legal question, not something the contract can decide.


---

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