{"eip":2876,"title":"Deposit contract and address standard","description":"This ERC defines a simple contract interface for managing deposits. It also defines a new address format that encodes the extra data passed into the interface's main deposit function.","authors":["Jonathan Underwood (@junderw)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2020-08-13","discussionsTo":"https://github.com/junderw/deposit-contract-poc/issues/1","repo":"ERCs","label":"ERC-2876","officialUrl":"https://eips.ethereum.org/EIPS/eip-2876","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-2876.md","url":"https://eips.huatuo.xyz/eip-2876/","tldr":{"en":"A 28-byte deposit address (contract address + 8-byte id with checksum) and a deposit(bytes8) contract interface, so exchanges can tell ETH deposits apart without one account per user.","ja":"28 バイトのデポジットアドレス（コントラクトアドレス + チェックサム付き 8 バイト ID）と deposit(bytes8) コントラクトインターフェース。取引所がユーザーごとにアカウントを用意せずに ETH の入金を区別できるようにする。","ko":"28바이트 입금 주소(컨트랙트 주소 + 체크섬이 붙은 8바이트 id)와 deposit(bytes8) 컨트랙트 인터페이스. 거래소가 사용자마다 계정을 두지 않고도 ETH 입금을 구분할 수 있게 한다.","zh":"一种 28 字节的充值地址（合约地址 + 带校验和的 8 字节 id）和 deposit(bytes8) 合约接口，让交易所无需为每个用户开一个账户就能区分 ETH 充值。"},"tags":["payments","deposits","address-format","exchange","erc"],"explainers":{"en":{"lang":"en","tldr":"A 28-byte deposit address (contract address + 8-byte id with checksum) and a deposit(bytes8) contract interface, so exchanges can tell ETH deposits apart without one account per user.","tags":["payments","deposits","address-format","exchange","erc"],"related":[55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-2876/","markdown":"## What problem does it solve?\n\nExchanges and merchants need to know who sent each ETH deposit. The usual approach is a fresh address per user or invoice, which forces a bad trade-off:\n\n- Externally owned deposit addresses must be hot wallets, or someone has to sweep thousands of cold accounts by hand.\n- Deploying a contract per deposit address costs tens of thousands of gas each.\n\nERC-2876 lets one contract receive all deposits and identifies each depositor by an 8-byte id carried in the calldata. The id is packed into a longer \"deposit address\" so users still just paste one string into their wallet.\n\n## How it works\n\n**Deposit address format (28 bytes):**\n\n```\n\u003c20-byte contract address\u003e \u003c5-byte nonce\u003e \u003c3-byte checksum\u003e\n```\n\nThe checksum is the first 3 bytes of `keccak256(address ++ nonce)`. The nonce plus checksum together form the 8-byte `id`.\n\n**Contract interface:**\n\n```solidity\ninterface DepositEIP {\n    function deposit(bytes8 id) external payable returns (bool);\n}\n```\n\n- The contract must revert on plain ETH transfers with empty calldata.\n- `deposit` returns `true` when the payment is complete, `false` when it keeps the funds but the deposit is not yet complete (e.g. a partial invoice payment), and reverts if it does not want the funds.\n- It should verify the checksum inside the id.\n\n**Wallet behaviour:** when given a 28-byte deposit address, a wallet must verify the checksum, send to the first 20 bytes, and set calldata to the `deposit(bytes8)` selector `0x3ef8e69a` followed by the 8-byte id, right-padded to 32 bytes. It must refuse if the user also supplied custom data.\n\n## Sample code\n\nTurning a deposit address into a transaction (ethers v6):\n\n```ts\nimport { keccak256, getBytes, hexlify, concat, zeroPadBytes } from \"ethers\";\n\nfunction parseDepositAddress(dep: string) {\n  const b = getBytes(dep);\n  if (b.length !== 28) throw new Error(\"not a deposit address\");\n  const addr = b.slice(0, 20), nonce = b.slice(20, 25), chk = b.slice(25, 28);\n  const expected = getBytes(keccak256(concat([addr, nonce]))).slice(0, 3);\n  if (hexlify(expected) !== hexlify(chk)) throw new Error(\"bad checksum\");\n  const id = b.slice(20, 28);\n  return {\n    to: hexlify(addr),\n    data: concat([\"0x3ef8e69a\", zeroPadBytes(id, 32)]),\n  };\n}\n\n// Test vector from the spec\nconst tx = parseDepositAddress(\"0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15\");\n// tx.to   = 0x433e064c42e87325fb6ffa9575a34862e0052f26\n// tx.data = 0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000\nawait signer.sendTransaction({ ...tx, value: amount });\n```\n\n## Things to know\n\n- Status is **Stagnant**. Mainstream wallets do not recognise 28-byte deposit addresses.\n- It handles native ETH only, not ERC-20 tokens. The author argues separate mechanisms per currency are acceptable.\n- Because the contract rejects plain transfers, a wallet that strips the address to 20 bytes and sends without calldata will fail rather than lose funds.\n- The 24-bit checksum is stronger than the roughly 15-bit average of [EIP-55](/eip-55/) mixed-case checksums.\n- The spec recommends forwarding funds to a hard-coded or `immutable` cold wallet, and using a kill switch that reverts deposits rather than `selfdestruct` when shutting down.\n"},"ja":{"lang":"ja","tldr":"28 バイトのデポジットアドレス（コントラクトアドレス + チェックサム付き 8 バイト ID）と deposit(bytes8) コントラクトインターフェース。取引所がユーザーごとにアカウントを用意せずに ETH の入金を区別できるようにする。","tags":["payments","deposits","address-format","exchange","erc"],"related":[55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-2876/","markdown":"## 何を解決するのか\n\n取引所や加盟店は、各 ETH の入金が誰からのものかを知る必要があります。通常の方法はユーザーや請求書ごとに新しいアドレスを用意することですが、これは悪いトレードオフを強います。\n\n- 外部所有のデポジットアドレスはホットウォレットでなければならず、さもなければ誰かが何千ものコールドアカウントを手作業で回収（スイープ）する必要があります。\n- デポジットアドレスごとにコントラクトをデプロイすると、1 つあたり数万ガスかかります。\n\nERC-2876 は、1 つのコントラクトにすべての入金を受け取らせ、calldata に載せた 8 バイトの ID で各入金者を識別します。ID はより長い「デポジットアドレス」に詰め込まれるため、ユーザーは引き続き 1 つの文字列をウォレットに貼り付けるだけで済みます。\n\n## 仕組み\n\n**デポジットアドレスの形式（28 バイト）:**\n\n```\n\u003c20-byte contract address\u003e \u003c5-byte nonce\u003e \u003c3-byte checksum\u003e\n```\n\nチェックサムは `keccak256(address ++ nonce)` の先頭 3 バイトです。nonce とチェックサムを合わせたものが 8 バイトの `id` になります。\n\n**コントラクトインターフェース:**\n\n```solidity\ninterface DepositEIP {\n    function deposit(bytes8 id) external payable returns (bool);\n}\n```\n\n- コントラクトは、calldata が空の通常の ETH 送金を revert しなければなりません。\n- `deposit` は、支払いが完了した場合は `true` を返し、資金は保持するが入金がまだ完了していない場合（例: 請求書の一部払い）は `false` を返し、資金を受け取りたくない場合は revert します。\n- id 内のチェックサムを検証すべきです。\n\n**ウォレットの挙動:** 28 バイトのデポジットアドレスが与えられたら、ウォレットはチェックサムを検証し、先頭 20 バイトへ送信し、calldata を `deposit(bytes8)` のセレクター `0x3ef8e69a` に続けて 32 バイトに右詰めパディングした 8 バイトの id に設定しなければなりません。ユーザーが独自のデータも指定した場合は拒否しなければなりません。\n\n## サンプルコード\n\nデポジットアドレスをトランザクションに変換する（ethers v6）:\n\n```ts\nimport { keccak256, getBytes, hexlify, concat, zeroPadBytes } from \"ethers\";\n\nfunction parseDepositAddress(dep: string) {\n  const b = getBytes(dep);\n  if (b.length !== 28) throw new Error(\"not a deposit address\");\n  const addr = b.slice(0, 20), nonce = b.slice(20, 25), chk = b.slice(25, 28);\n  const expected = getBytes(keccak256(concat([addr, nonce]))).slice(0, 3);\n  if (hexlify(expected) !== hexlify(chk)) throw new Error(\"bad checksum\");\n  const id = b.slice(20, 28);\n  return {\n    to: hexlify(addr),\n    data: concat([\"0x3ef8e69a\", zeroPadBytes(id, 32)]),\n  };\n}\n\n// Test vector from the spec\nconst tx = parseDepositAddress(\"0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15\");\n// tx.to   = 0x433e064c42e87325fb6ffa9575a34862e0052f26\n// tx.data = 0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000\nawait signer.sendTransaction({ ...tx, value: amount });\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。主要なウォレットは 28 バイトのデポジットアドレスを認識しません。\n- 扱うのはネイティブの ETH だけで、ERC-20 トークンは対象外です。作者は、通貨ごとに別々の仕組みでよいと主張しています。\n- コントラクトは通常の送金を拒否するため、アドレスを 20 バイトに切り詰めて calldata なしで送るウォレットは、資金を失うのではなく失敗します。\n- 24 ビットのチェックサムは、[EIP-55](/eip-55/) の大文字小文字混在チェックサムの平均約 15 ビットより強力です。\n- 仕様は、資金をハードコードされた、または `immutable` なコールドウォレットへ転送することと、停止時には `selfdestruct` ではなく入金を revert するキルスイッチを使うことを推奨しています。\n"},"ko":{"lang":"ko","tldr":"28바이트 입금 주소(컨트랙트 주소 + 체크섬이 붙은 8바이트 id)와 deposit(bytes8) 컨트랙트 인터페이스. 거래소가 사용자마다 계정을 두지 않고도 ETH 입금을 구분할 수 있게 한다.","tags":["payments","deposits","address-format","exchange","erc"],"related":[55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-2876/","markdown":"## 어떤 문제를 해결하나요?\n\n거래소와 가맹점은 각 ETH 입금이 누구에게서 왔는지 알아야 합니다. 일반적인 방법은 사용자나 청구서마다 새 주소를 쓰는 것인데, 이는 나쁜 절충을 강요합니다.\n\n- 외부 소유 입금 주소는 핫 월렛이어야 하며, 그렇지 않으면 누군가 수천 개의 콜드 계정을 손으로 쓸어 담아야 합니다.\n- 입금 주소마다 컨트랙트를 배포하면 하나당 수만 가스가 듭니다.\n\nERC-2876은 컨트랙트 하나가 모든 입금을 받고, calldata에 실린 8바이트 id로 입금자를 식별하게 합니다. id는 더 긴 \"입금 주소\"에 담기므로 사용자는 여전히 문자열 하나만 지갑에 붙여 넣으면 됩니다.\n\n## 어떻게 동작하나요?\n\n**입금 주소 형식(28바이트):**\n\n```\n\u003c20-byte contract address\u003e \u003c5-byte nonce\u003e \u003c3-byte checksum\u003e\n```\n\n체크섬은 `keccak256(address ++ nonce)`의 앞 3바이트입니다. nonce와 체크섬을 합친 것이 8바이트 `id`입니다.\n\n**컨트랙트 인터페이스:**\n\n```solidity\ninterface DepositEIP {\n    function deposit(bytes8 id) external payable returns (bool);\n}\n```\n\n- 컨트랙트는 calldata가 비어 있는 일반 ETH 전송을 revert해야 합니다.\n- `deposit`은 결제가 완료되면 `true`를 반환하고, 자금은 보관하지만 입금이 아직 완료되지 않은 경우(예: 청구서 일부 결제) `false`를 반환하며, 자금을 받고 싶지 않으면 revert합니다.\n- id 안의 체크섬을 검증해야 합니다.\n\n**지갑 동작:** 28바이트 입금 주소가 주어지면 지갑은 체크섬을 검증하고, 앞 20바이트로 전송하며, calldata를 `deposit(bytes8)` 셀렉터 `0x3ef8e69a`에 이어 32바이트로 오른쪽 패딩한 8바이트 id로 설정해야 합니다. 사용자가 커스텀 데이터도 함께 제공했다면 거부해야 합니다.\n\n## 샘플 코드\n\n입금 주소를 트랜잭션으로 변환하기(ethers v6):\n\n```ts\nimport { keccak256, getBytes, hexlify, concat, zeroPadBytes } from \"ethers\";\n\nfunction parseDepositAddress(dep: string) {\n  const b = getBytes(dep);\n  if (b.length !== 28) throw new Error(\"not a deposit address\");\n  const addr = b.slice(0, 20), nonce = b.slice(20, 25), chk = b.slice(25, 28);\n  const expected = getBytes(keccak256(concat([addr, nonce]))).slice(0, 3);\n  if (hexlify(expected) !== hexlify(chk)) throw new Error(\"bad checksum\");\n  const id = b.slice(20, 28);\n  return {\n    to: hexlify(addr),\n    data: concat([\"0x3ef8e69a\", zeroPadBytes(id, 32)]),\n  };\n}\n\n// Test vector from the spec\nconst tx = parseDepositAddress(\"0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15\");\n// tx.to   = 0x433e064c42e87325fb6ffa9575a34862e0052f26\n// tx.data = 0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000\nawait signer.sendTransaction({ ...tx, value: amount });\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 주요 지갑은 28바이트 입금 주소를 인식하지 못합니다.\n- 네이티브 ETH만 다루며 ERC-20 토큰은 다루지 않습니다. 작성자는 통화마다 별도의 메커니즘을 두는 것도 괜찮다고 주장합니다.\n- 컨트랙트가 일반 전송을 거부하므로, 주소를 20바이트로 잘라 calldata 없이 보내는 지갑은 자금을 잃는 대신 실패합니다.\n- 24비트 체크섬은 [EIP-55](/eip-55/)의 대소문자 혼합 체크섬 평균 약 15비트보다 강력합니다.\n- 스펙은 자금을 하드코딩되었거나 `immutable`인 콜드 월렛으로 전달하고, 종료할 때는 `selfdestruct` 대신 입금을 revert하는 킬 스위치를 사용할 것을 권장합니다.\n"},"zh":{"lang":"zh","tldr":"一种 28 字节的充值地址（合约地址 + 带校验和的 8 字节 id）和 deposit(bytes8) 合约接口，让交易所无需为每个用户开一个账户就能区分 ETH 充值。","tags":["payments","deposits","address-format","exchange","erc"],"related":[55],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-2876/","markdown":"## 它解决什么问题？\n\n交易所和商户需要知道每笔 ETH 充值来自谁。常见做法是为每个用户或每张账单分配一个新地址，但这带来了糟糕的取舍：\n\n- 外部拥有账户（EOA）形式的充值地址必须是热钱包，否则就得有人手动归集成千上万个冷账户。\n- 为每个充值地址部署一个合约，每个要花费数万 gas。\n\nERC-2876 让一个合约接收所有充值，并通过 calldata 中携带的 8 字节 id 识别每位充值者。该 id 被打包进一个更长的\"充值地址\"，因此用户依然只需把一个字符串粘贴到钱包里。\n\n## 它如何运作\n\n**充值地址格式（28 字节）：**\n\n```\n\u003c20-byte contract address\u003e \u003c5-byte nonce\u003e \u003c3-byte checksum\u003e\n```\n\n校验和是 `keccak256(address ++ nonce)` 的前 3 个字节。nonce 加校验和共同构成 8 字节的 `id`。\n\n**合约接口：**\n\n```solidity\ninterface DepositEIP {\n    function deposit(bytes8 id) external payable returns (bool);\n}\n```\n\n- 合约必须对 calldata 为空的普通 ETH 转账执行 revert。\n- 当付款完成时 `deposit` 返回 `true`；当它保留资金但充值尚未完成时（例如账单只付了一部分）返回 `false`；如果不想接收这笔资金则 revert。\n- 它应当校验 id 中的校验和。\n\n**钱包行为：** 收到 28 字节的充值地址时，钱包必须校验校验和，向前 20 个字节发送，并将 calldata 设为 `deposit(bytes8)` 的选择器 `0x3ef8e69a`，后接右侧补零到 32 字节的 8 字节 id。如果用户还提供了自定义数据，则必须拒绝。\n\n## 示例代码\n\n把充值地址转换为交易（ethers v6）：\n\n```ts\nimport { keccak256, getBytes, hexlify, concat, zeroPadBytes } from \"ethers\";\n\nfunction parseDepositAddress(dep: string) {\n  const b = getBytes(dep);\n  if (b.length !== 28) throw new Error(\"not a deposit address\");\n  const addr = b.slice(0, 20), nonce = b.slice(20, 25), chk = b.slice(25, 28);\n  const expected = getBytes(keccak256(concat([addr, nonce]))).slice(0, 3);\n  if (hexlify(expected) !== hexlify(chk)) throw new Error(\"bad checksum\");\n  const id = b.slice(20, 28);\n  return {\n    to: hexlify(addr),\n    data: concat([\"0x3ef8e69a\", zeroPadBytes(id, 32)]),\n  };\n}\n\n// Test vector from the spec\nconst tx = parseDepositAddress(\"0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15\");\n// tx.to   = 0x433e064c42e87325fb6ffa9575a34862e0052f26\n// tx.data = 0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000000000\nawait signer.sendTransaction({ ...tx, value: amount });\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。主流钱包不识别 28 字节的充值地址。\n- 它只处理原生 ETH，不处理 ERC-20 代币。作者认为每种货币使用各自的机制是可以接受的。\n- 由于合约拒绝普通转账，把地址截断为 20 字节并且不带 calldata 发送的钱包会失败，而不会损失资金。\n- 24 位的校验和比 [EIP-55](/eip-55/) 大小写混合校验和平均约 15 位的强度更高。\n- 规范建议将资金转发到硬编码的或 `immutable` 的冷钱包，并且在关闭时使用会 revert 充值的 kill switch，而不是 `selfdestruct`。\n"}}}
