{"eip":3135,"title":"Exclusive Claimable Token","description":"This standard defines a token which can be claimed only by token issuer with payer's signature.","authors":["Zhenyu Sun (@Ungigdu)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2020-08-10","requires":[20],"discussionsTo":"https://github.com/ethereum/EIPs/issues/3132","repo":"ERCs","label":"ERC-3135","officialUrl":"https://eips.ethereum.org/EIPS/eip-3135","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3135.md","url":"https://eips.huatuo.xyz/eip-3135/","tldr":{"en":"An ERC-20 extension for off-chain micropayments: users lock tokens in a deposit, sign running consumption totals, and only the token's issuer can claim them on-chain.","ja":"オフチェーンのマイクロペイメント向けの ERC-20 拡張。ユーザーはトークンをデポジットにロックし、累積消費量に署名し、オンチェーンでそれを請求できるのはトークンの発行者だけとなる。","ko":"오프체인 소액 결제를 위한 ERC-20 확장. 사용자가 토큰을 예치금에 잠그고 누적 소비 총액에 서명하며, 온체인에서 이를 청구할 수 있는 것은 토큰 발행자뿐이다.","zh":"面向链下小额支付的 ERC-20 扩展：用户把代币锁入押金，签署累计消费总额，只有代币的发行方可以在链上领取。"},"tags":["token","micropayments","payment-channel","signatures","erc20"],"explainers":{"en":{"lang":"en","tldr":"An ERC-20 extension for off-chain micropayments: users lock tokens in a deposit, sign running consumption totals, and only the token's issuer can claim them on-chain.","tags":["token","micropayments","payment-channel","signatures","erc20"],"related":[20,191,712],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3135/","markdown":"## What problem does it solve?\n\nPaying a small business in tokens one transaction at a time is slow and costs gas on every purchase. Payment channels fix that by moving most of the interaction off-chain, but each merchant would normally need its own channel contract and dapp, which small businesses rarely have the resources to build, and every implementation would be different.\n\nERC-3135 puts a simple one-to-many payment channel directly into the token contract. Any wallet that understands the standard could offer a common \"pay with signature\" UI, and the merchant only needs a server that verifies signatures.\n\n## How it works\n\n- The token has a single **issuer** (the service provider). Only the issuer can call `claim`.\n- A user calls `deposit(amount)` to move tokens from their normal balance into a **deposit balance**, which has an **epoch** counter.\n- For each purchase, the user's client signs a message containing the token address, payer, issuer, the **cumulative** consumption for the current epoch, and the epoch number. The merchant verifies it off-chain and keeps serving while the signed amount covers what the user has used (with an optional tolerance).\n- When it wants to settle, the issuer calls `claim(from, consumption, epoch, signature)`. The contract checks the signature and deposit, moves `consumption` to the issuer, and increments the epoch so old signatures cannot be reused.\n- `withdraw(to, amount)` returns unused deposit. The spec describes two models:\n  - **prepayment** (like a store gift card): the issuer calls `withdraw` to refund;\n  - **lock-release** (pay-per-use services): the payer can withdraw, for example after the epoch has not changed for a set time, so funds are not held hostage by a misbehaving server.\n\nEvents: `Deposit`, `Withdraw`, `Claim`, `TransferIssuer`. Other views: `issuer()`, `iconUrl()`, `depositBalanceOf(user)`.\n\n## Sample code\n\nBuilding the payment message off-chain, following the spec's hashing (ethers v6):\n\n```ts\nimport { AbiCoder, keccak256, getBytes, Wallet } from \"ethers\";\n\nconst coder = AbiCoder.defaultAbiCoder();\nconst inner = keccak256(coder.encode(\n  [\"address\", \"address\", \"address\", \"uint256\", \"uint256\"],\n  [token, payer, issuer, cumulativeConsumption, epoch],\n));\n// The spec's reference implementation then hashes\n// abi.encode(\"\\x19Ethereum Signed Message:\\n32\", inner) and recovers with ecrecover.\n// Match whatever the deployed contract actually does before signing.\n```\n\nThe on-chain interface additions:\n\n```solidity\nfunction issuer() external view returns (address);\nfunction deposit(uint256 amount) external;\nfunction withdraw(address to, uint256 amount) external;\nfunction claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;\nfunction depositBalanceOf(address user) external view returns (uint256 depositBalance, uint256 epoch);\n```\n\n## Things to know\n\n- **Status: Stagnant.**\n- The reference implementation prefixes with `abi.encode` rather than the usual `abi.encodePacked`, so its digest does **not** match the standard [EIP-191](/eip-191/) `personal_sign` hash. A wallet's normal `signMessage` will not produce a valid signature for it unchanged. A modern design would use [EIP-712](/eip-712/) typed data instead.\n- If the merchant runs several verification servers, a payer can sign competing messages to different servers. Only the highest consumption can be claimed, so the spec suggests an \"echo server\" that sequences messages.\n- Payments are only final once the issuer claims on-chain; until then the merchant carries the risk up to its tolerance.\n"},"ja":{"lang":"ja","tldr":"オフチェーンのマイクロペイメント向けの ERC-20 拡張。ユーザーはトークンをデポジットにロックし、累積消費量に署名し、オンチェーンでそれを請求できるのはトークンの発行者だけとなる。","tags":["token","micropayments","payment-channel","signatures","erc20"],"related":[20,191,712],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3135/","markdown":"## 何を解決するのか\n\n小規模事業者にトークンで 1 トランザクションずつ支払うのは遅く、購入のたびにガス代がかかります。ペイメントチャネルはやり取りの大半をオフチェーンに移すことでこれを解決しますが、通常は加盟店ごとに専用のチャネルコントラクトと dapp が必要で、小規模事業者にそれを作る余力はほとんどなく、実装もそれぞれ異なります。\n\nERC-3135 は、シンプルな 1 対多のペイメントチャネルをトークンコントラクトに直接組み込みます。この標準を理解するウォレットなら、共通の「署名で支払う」UI を提供でき、加盟店に必要なのは署名を検証するサーバーだけです。\n\n## 仕組み\n\n- トークンには**発行者**（サービス提供者）が 1 人います。`claim` を呼べるのは発行者だけです。\n- ユーザーは `deposit(amount)` を呼んで、通常の残高から**デポジット残高**にトークンを移します。デポジット残高には **epoch** カウンターがあります。\n- 購入のたびに、ユーザーのクライアントは、トークンアドレス、支払者、発行者、現在の epoch における**累積**消費量、epoch 番号を含むメッセージに署名します。加盟店はオフチェーンでそれを検証し、署名された金額がユーザーの利用分をカバーしている間（任意の許容幅あり）、サービスを提供し続けます。\n- 精算したいとき、発行者は `claim(from, consumption, epoch, signature)` を呼びます。コントラクトは署名とデポジットを確認し、`consumption` を発行者に移し、古い署名が再利用できないよう epoch をインクリメントします。\n- `withdraw(to, amount)` は未使用のデポジットを返します。仕様は 2 つのモデルを説明しています。\n  - **プリペイド**（店舗のギフトカードのようなもの）: 発行者が `withdraw` を呼んで返金する。\n  - **ロック解除型**（従量課金サービス）: 支払者が引き出せる。たとえば epoch が一定時間変わらなかった後に引き出せるようにして、不正なサーバーに資金を人質に取られないようにする。\n\nイベント: `Deposit`、`Withdraw`、`Claim`、`TransferIssuer`。その他の view: `issuer()`、`iconUrl()`、`depositBalanceOf(user)`。\n\n## サンプルコード\n\n仕様のハッシュ方式に従って、オフチェーンで支払いメッセージを組み立てる（ethers v6）:\n\n```ts\nimport { AbiCoder, keccak256, getBytes, Wallet } from \"ethers\";\n\nconst coder = AbiCoder.defaultAbiCoder();\nconst inner = keccak256(coder.encode(\n  [\"address\", \"address\", \"address\", \"uint256\", \"uint256\"],\n  [token, payer, issuer, cumulativeConsumption, epoch],\n));\n// The spec's reference implementation then hashes\n// abi.encode(\"\\x19Ethereum Signed Message:\\n32\", inner) and recovers with ecrecover.\n// Match whatever the deployed contract actually does before signing.\n```\n\nオンチェーンのインターフェースへの追加:\n\n```solidity\nfunction issuer() external view returns (address);\nfunction deposit(uint256 amount) external;\nfunction withdraw(address to, uint256 amount) external;\nfunction claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;\nfunction depositBalanceOf(address user) external view returns (uint256 depositBalance, uint256 epoch);\n```\n\n## 知っておくべきこと\n\n- **ステータス: Stagnant。**\n- リファレンス実装は、通常の `abi.encodePacked` ではなく `abi.encode` でプレフィックスを付けているため、そのダイジェストは標準的な [EIP-191](/eip-191/) の `personal_sign` ハッシュとは**一致しません**。ウォレットの通常の `signMessage` では、そのままでは有効な署名が作れません。現代的な設計なら、代わりに [EIP-712](/eip-712/) の型付きデータを使うでしょう。\n- 加盟店が複数の検証サーバーを運用している場合、支払者は異なるサーバーに競合するメッセージに署名できます。請求できるのは最大の消費量だけなので、仕様はメッセージの順序づけを行う「エコーサーバー」を提案しています。\n- 支払いは発行者がオンチェーンで請求して初めて確定します。それまでは、加盟店が許容幅までのリスクを負います。\n"},"ko":{"lang":"ko","tldr":"오프체인 소액 결제를 위한 ERC-20 확장. 사용자가 토큰을 예치금에 잠그고 누적 소비 총액에 서명하며, 온체인에서 이를 청구할 수 있는 것은 토큰 발행자뿐이다.","tags":["token","micropayments","payment-channel","signatures","erc20"],"related":[20,191,712],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3135/","markdown":"## 어떤 문제를 해결하나요?\n\n소규모 사업자에게 토큰으로 트랜잭션 하나씩 결제하는 것은 느리고 구매할 때마다 가스가 듭니다. 결제 채널은 상호작용 대부분을 오프체인으로 옮겨 이를 해결하지만, 보통 가맹점마다 자체 채널 컨트랙트와 dapp이 필요하고 소규모 사업자가 이를 만들 여력은 거의 없으며, 구현도 제각각입니다.\n\nERC-3135는 단순한 일대다 결제 채널을 토큰 컨트랙트에 곧바로 넣습니다. 표준을 이해하는 지갑이라면 공통된 \"서명으로 결제\" UI를 제공할 수 있고, 가맹점에 필요한 것은 서명을 검증하는 서버뿐입니다.\n\n## 어떻게 동작하나요?\n\n- 토큰에는 **발행자**(서비스 제공자)가 한 명 있습니다. `claim`을 호출할 수 있는 것은 발행자뿐입니다.\n- 사용자는 `deposit(amount)`를 호출해 일반 잔액에서 **예치 잔액**으로 토큰을 옮깁니다. 예치 잔액에는 **epoch** 카운터가 있습니다.\n- 구매할 때마다 사용자의 클라이언트는 토큰 주소, 결제자, 발행자, 현재 epoch의 **누적** 소비량, epoch 번호가 담긴 메시지에 서명합니다. 가맹점은 이를 오프체인에서 검증하고, 서명된 금액이 사용자의 사용분을 충당하는 동안(선택적 허용 오차 포함) 계속 서비스를 제공합니다.\n- 정산하고 싶을 때 발행자는 `claim(from, consumption, epoch, signature)`를 호출합니다. 컨트랙트는 서명과 예치금을 확인하고, `consumption`을 발행자에게 옮기고, 오래된 서명을 재사용할 수 없도록 epoch를 증가시킵니다.\n- `withdraw(to, amount)`는 사용하지 않은 예치금을 돌려줍니다. 스펙은 두 가지 모델을 설명합니다.\n  - **선불**(상점 기프트 카드와 비슷): 발행자가 `withdraw`를 호출해 환불합니다.\n  - **잠금-해제**(사용량 기반 과금 서비스): 결제자가 출금할 수 있습니다. 예를 들어 epoch가 정해진 시간 동안 바뀌지 않은 뒤에 출금할 수 있게 해, 잘못 동작하는 서버에 자금이 인질로 잡히지 않게 합니다.\n\n이벤트: `Deposit`, `Withdraw`, `Claim`, `TransferIssuer`. 기타 view: `issuer()`, `iconUrl()`, `depositBalanceOf(user)`.\n\n## 샘플 코드\n\n스펙의 해싱 방식에 따라 오프체인에서 결제 메시지 만들기(ethers v6):\n\n```ts\nimport { AbiCoder, keccak256, getBytes, Wallet } from \"ethers\";\n\nconst coder = AbiCoder.defaultAbiCoder();\nconst inner = keccak256(coder.encode(\n  [\"address\", \"address\", \"address\", \"uint256\", \"uint256\"],\n  [token, payer, issuer, cumulativeConsumption, epoch],\n));\n// The spec's reference implementation then hashes\n// abi.encode(\"\\x19Ethereum Signed Message:\\n32\", inner) and recovers with ecrecover.\n// Match whatever the deployed contract actually does before signing.\n```\n\n온체인 인터페이스에 추가되는 부분:\n\n```solidity\nfunction issuer() external view returns (address);\nfunction deposit(uint256 amount) external;\nfunction withdraw(address to, uint256 amount) external;\nfunction claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;\nfunction depositBalanceOf(address user) external view returns (uint256 depositBalance, uint256 epoch);\n```\n\n## 알아둘 점\n\n- **상태: Stagnant.**\n- 레퍼런스 구현은 일반적인 `abi.encodePacked` 대신 `abi.encode`로 접두사를 붙이므로, 다이제스트가 표준 [EIP-191](/eip-191/) `personal_sign` 해시와 **일치하지 않습니다**. 지갑의 일반적인 `signMessage`로는 그대로는 유효한 서명을 만들 수 없습니다. 요즘 설계라면 대신 [EIP-712](/eip-712/) 타입 데이터를 쓸 것입니다.\n- 가맹점이 검증 서버를 여러 대 운영하면, 결제자는 서로 다른 서버에 상충하는 메시지에 서명할 수 있습니다. 청구할 수 있는 것은 가장 큰 소비량뿐이므로, 스펙은 메시지 순서를 매기는 \"에코 서버\"를 제안합니다.\n- 결제는 발행자가 온체인에서 청구해야 비로소 확정됩니다. 그때까지는 가맹점이 허용 오차 한도까지 위험을 부담합니다.\n"},"zh":{"lang":"zh","tldr":"面向链下小额支付的 ERC-20 扩展：用户把代币锁入押金，签署累计消费总额，只有代币的发行方可以在链上领取。","tags":["token","micropayments","payment-channel","signatures","erc20"],"related":[20,191,712],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3135/","markdown":"## 它解决什么问题？\n\n向小商家逐笔用代币支付既慢又要为每次购买付 gas。支付通道把大部分交互移到链下来解决这个问题，但通常每个商家都需要自己的通道合约和 dapp，小商家很少有资源去构建，而且每种实现都各不相同。\n\nERC-3135 把一个简单的一对多支付通道直接放进代币合约。任何理解该标准的钱包都可以提供通用的「签名支付」界面，商家只需要一台验证签名的服务器。\n\n## 它如何运作\n\n- 代币有唯一的**发行方**（服务提供者）。只有发行方可以调用 `claim`。\n- 用户调用 `deposit(amount)`，把代币从普通余额转入**押金余额**，押金带有一个 **epoch** 计数器。\n- 每次购买时，用户的客户端会对一条消息签名，其中包含代币地址、付款方、发行方、当前 epoch 的**累计**消费额以及 epoch 编号。商家在链下验证它，只要签名金额覆盖了用户已使用的部分（可设置容差），就持续提供服务。\n- 想要结算时，发行方调用 `claim(from, consumption, epoch, signature)`。合约检查签名和押金，把 `consumption` 转给发行方，并递增 epoch，使旧签名无法重复使用。\n- `withdraw(to, amount)` 退回未使用的押金。规范描述了两种模式：\n  - **预付**（类似商店礼品卡）：由发行方调用 `withdraw` 退款；\n  - **锁定-释放**（按使用付费的服务）：付款方可以提取，例如在 epoch 在设定时间内没有变化之后，这样资金不会被行为不端的服务器扣为人质。\n\n事件：`Deposit`、`Withdraw`、`Claim`、`TransferIssuer`。其他 view：`issuer()`、`iconUrl()`、`depositBalanceOf(user)`。\n\n## 示例代码\n\n按照规范的哈希方式在链下构造支付消息（ethers v6）：\n\n```ts\nimport { AbiCoder, keccak256, getBytes, Wallet } from \"ethers\";\n\nconst coder = AbiCoder.defaultAbiCoder();\nconst inner = keccak256(coder.encode(\n  [\"address\", \"address\", \"address\", \"uint256\", \"uint256\"],\n  [token, payer, issuer, cumulativeConsumption, epoch],\n));\n// The spec's reference implementation then hashes\n// abi.encode(\"\\x19Ethereum Signed Message:\\n32\", inner) and recovers with ecrecover.\n// Match whatever the deployed contract actually does before signing.\n```\n\n链上接口新增的部分：\n\n```solidity\nfunction issuer() external view returns (address);\nfunction deposit(uint256 amount) external;\nfunction withdraw(address to, uint256 amount) external;\nfunction claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;\nfunction depositBalanceOf(address user) external view returns (uint256 depositBalance, uint256 epoch);\n```\n\n## 需要注意\n\n- **状态：Stagnant。**\n- 参考实现使用 `abi.encode` 而不是通常的 `abi.encodePacked` 来加前缀，因此它的摘要与标准的 [EIP-191](/eip-191/) `personal_sign` 哈希**不一致**。钱包常规的 `signMessage` 原样无法为它生成有效签名。现代的设计会改用 [EIP-712](/eip-712/) 类型化数据。\n- 如果商家运行多台验证服务器，付款方可以向不同服务器签署相互竞争的消息。只有最高的消费额可以被领取，因此规范建议使用对消息排序的「回声服务器」。\n- 只有发行方在链上领取之后，支付才算最终确定；在此之前，商家在容差范围内承担风险。\n"}}}
