---
eip: 3135
label: ERC-3135
title: Exclusive Claimable Token
status: Stagnant
type: Standards Track
category: ERC
created: 2020-08-10
requires: 20
official: https://eips.ethereum.org/EIPS/eip-3135
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3135.md
canonical: https://eips.huatuo.xyz/eip-3135/
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]
---

# ERC-3135: Exclusive Claimable Token

> This standard defines a token which can be claimed only by token issuer with payer's signature.

**TL;DR:** 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.

## What problem does it solve?

Paying 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.

ERC-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.

## How it works

- The token has a single **issuer** (the service provider). Only the issuer can call `claim`.
- A user calls `deposit(amount)` to move tokens from their normal balance into a **deposit balance**, which has an **epoch** counter.
- 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).
- 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.
- `withdraw(to, amount)` returns unused deposit. The spec describes two models:
  - **prepayment** (like a store gift card): the issuer calls `withdraw` to refund;
  - **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.

Events: `Deposit`, `Withdraw`, `Claim`, `TransferIssuer`. Other views: `issuer()`, `iconUrl()`, `depositBalanceOf(user)`.

## Sample code

Building the payment message off-chain, following the spec's hashing (ethers v6):

```ts
import { AbiCoder, keccak256, getBytes, Wallet } from "ethers";

const coder = AbiCoder.defaultAbiCoder();
const inner = keccak256(coder.encode(
  ["address", "address", "address", "uint256", "uint256"],
  [token, payer, issuer, cumulativeConsumption, epoch],
));
// The spec's reference implementation then hashes
// abi.encode("\x19Ethereum Signed Message:\n32", inner) and recovers with ecrecover.
// Match whatever the deployed contract actually does before signing.
```

The on-chain interface additions:

```solidity
function issuer() external view returns (address);
function deposit(uint256 amount) external;
function withdraw(address to, uint256 amount) external;
function claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;
function depositBalanceOf(address user) external view returns (uint256 depositBalance, uint256 epoch);
```

## Things to know

- **Status: Stagnant.**
- 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.
- 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.
- Payments are only final once the issuer claims on-chain; until then the merchant carries the risk up to its tolerance.


---

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