---
eip: 1191
label: ERC-1191
title: Add chain id to mixed-case checksum address encoding
status: Last Call
type: Standards Track
category: ERC
created: 2018-03-18
requires: 55, 155
official: https://eips.ethereum.org/EIPS/eip-1191
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1191.md
canonical: https://eips.huatuo.xyz/eip-1191/
lang: en
tldr: Extends the EIP-55 mixed-case address checksum by mixing in the chain id, so a wallet can warn when an address was copied from a different EVM network.
tags: [address, checksum, wallet, chain-id]
---

# ERC-1191: Add chain id to mixed-case checksum address encoding

> This EIP extends EIP-55 by optionally adding a chain id defined by EIP-155 to the checksum calculation.

**TL;DR:** Extends the EIP-55 mixed-case address checksum by mixing in the chain id, so a wallet can warn when an address was copied from a different EVM network.

## What problem does it solve?

[EIP-55](/eip-55/) encodes a checksum in the upper/lower case of an address's hex letters, catching typos. But an Ethereum address carries no information about which network it belongs to, so a perfectly valid address from one chain looks equally valid on another. Users of Ethereum-compatible networks can lose funds by sending to an address that was generated for, or copied from, a different network.

ERC-1191 lets a network opt in to a checksum that also depends on its chain id (from [EIP-155](/eip-155/)). The same 20 bytes then have a different capitalisation on each opted-in chain, and a wallet can flag a mismatch.

## How it works

- Start from the EIP-55 algorithm: hash the lowercase hex address with keccak-256, then uppercase each letter whose corresponding hash nibble is 8 or higher.
- If the chain id belongs to a network that **opted in** to this variant, the hash input becomes the decimal chain id followed by the lowercase address **including** the `0x` prefix, e.g. `"30" + "0x27b1fdb0..."`.
- For any other chain id, the plain EIP-55 result is used, so Ethereum mainnet addresses do not change.

The networks listed in the spec as using it are RSK Mainnet (chain id 30) and RSK Testnet (31).

## Sample code

TypeScript using ethers v6 primitives:

```ts
import { keccak256, toUtf8Bytes } from "ethers";

const ADOPTED_EIP1191 = new Set([30, 31]); // per the spec's usage table

export function checksum1191(address: string, chainId: number): string {
  const lower = address.toLowerCase();             // "0x..."
  const hex = lower.slice(2);
  const input = ADOPTED_EIP1191.has(chainId) ? `${chainId}${lower}` : hex;
  const hash = keccak256(toUtf8Bytes(input)).slice(2);

  let out = "0x";
  for (let i = 0; i < hex.length; i++) {
    out += parseInt(hash[i], 16) >= 8 ? hex[i].toUpperCase() : hex[i];
  }
  return out;
}

// From the spec's test vectors:
checksum1191("0x27b1fdb04752bbc536007a920d24acb045561c26", 30);
// -> "0x27b1FdB04752BBc536007A920D24ACB045561c26"
```

## Things to know

- Status: **Last Call** (deadline 2019-11-18 in the spec). It was never moved to Final.
- Opt-in is per network. On a chain that did not adopt it, the output is identical to EIP-55, so it gives no cross-chain protection there.
- A checksum mismatch should be treated as a warning that the address may be meant for another network, not as proof that it is wrong.
- The spec lists several wallets and libraries with implementations; check your own tooling before relying on it.


---

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