Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ERC-3135, a proposal for extending ERC-20 tokens with issuer-only claims based on signed payment messages, enabling off-chain micropayments.
The following explanation translates, summarizes, and expands on the original proposal.
I also cover a range of other EIPs.
Overview
ERC-3135 extends existing token standards such as ERC-20 to help online and offline service providers establish micropayment channels with many users.
Users sign messages authorizing token consumption off-chain, and the service provider verifies those signatures. Instead of submitting every individual payment to the blockchain, the provider can settle authorized consumption with fewer on-chain operations, reducing transaction fees and latency.
Motivation
ERC-3135 has two principal objectives.
- Reduce the number of on-chain operations.
- Make Ethereum more practical for real-world payment applications.
Small businesses seeking to adopt blockchain-based payments face several challenges.
- Direct token payments
Users can transfer tokens through their wallets, but each on-chain transfer incurs a transaction fee and requires confirmation.
- Smart contract-based micropayment channels
Users can lock tokens and authorize payments through signed messages. However, service providers may need to develop and maintain their own decentralized applications, which is a substantial burden for smaller businesses. Customers may also need compatible wallets and familiarity with DApps.
ERC-3135 aims to standardize signed payment messages. The longer-term goal is to enable wallets to provide common user interfaces for this payment model.
Specification
The standard uses signatures to authorize token consumption and restricts claims to the token issuer. This allows individual consumption records to be processed off-chain and settled with fewer blockchain interactions.
Core functionality
- Users deposit tokens, and service providers claim authorized consumption through
claim. - Consumption records and signatures are processed off-chain, reducing on-chain interactions.
- The design supports two operating models: prepayment and lock-release.
ECDSA signature authentication
The signature is generated as follows.
sign(keccak256(abi_encode(
"\x19Ethereum Signed Message:\n32",
keccak256(abi_encode(
token_address,
payer_address,
token_issuer,
token_consumption,
epoch
))
)), private_key)The claim function verifies the signature to authenticate the payer and the corresponding consumption amount.
Operating models
Prepayment model
- The user deposits tokens in advance.
- The service provider receives signed consumption messages and verifies them off-chain.
- When the user requests a refund of the remaining balance, the issuer executes
withdraw.
Lock-release model
- The user locks tokens to cover anticipated consumption.
- The user continues authorizing service payments through signatures while willing to use the service.
- If the user no longer trusts the arrangement, they stop signing and withdraw unused locked funds, subject to the implementation's settlement rules.
Interface
/// @return Image url of this token or descriptive resources
function iconUrl() external view returns (string memory);
/// @return Issuer of this token. Only issuer can execute claim function
function issuer() external view returns (address);
/**
* @notice Remove consumption from payer's deposite
* @dev Check if msg.sender == issuer
* @param from Payer's address
* @param consumption How many token is consumed in this epoch, specified
* @param epoch Epoch increased by 1 after claim or withdraw, at the beginning of each epoch, consumption goes back to 0
* @param signature Signature of payment message signed by payer
*/
function claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;
function transferIssuer(address newIssuer) external;
/// @notice Move amount from payer's token balance to deposite balance to ensure payment is sufficient
function deposit(uint256 amount) external;
/**
* @notice Give remaining deposite balance back to "to" account, act as "refund" function
* @dev In prepayment module, withdraw is executed from issuer account
* In lock-release module, withdraw is executed from user account
* @param to the account receiving remaining deposite
* @param amount how many token is returned
*/
function withdraw(address to, uint256 amount) external;
function depositBalanceOf(address user) external view returns(uint256 depositBalance, uint256 epoch);
event Deposit(
address indexed from,
uint256 amount
);
event Withdraw(
address indexed to,
uint256 amount
);
event TransferIssuer(
address indexed oldIssuer,
address indexed newIssuer
);
event Claim(
address indexed from,
address indexed to,
uint256 epoch,
uint256 consumption
);Functions
iconUrl
function iconUrl() external view returns (string memory);Returns a URL for a token icon or descriptive resource. Wallets and applications can use it to display externally hosted information associated with the token.
Return value
string memory- The URL of the token's associated image or information.
issuer
function issuer() external view returns (address);Returns the token issuer's address.
Only this address is authorized to invoke claim.
The issuer address identifies the service provider or other party responsible for claiming consumption.
Return value
address- The current token issuer.
claim
function claim(address from, uint256 consumption, uint256 epoch, bytes calldata signature) external;Claims authorized consumption against a user's deposited balance using a signed message. Only the issuer can call this function. The signature authenticates the token consumption, and an epoch identifies the applicable accounting period.
Arguments
from- The payer's address.
consumption- The authorized consumption amount for the relevant epoch.
epoch- The epoch number used in consumption accounting.
signature- The signature authorizing consumption.
transferIssuer
function transferIssuer(address newIssuer) external;Transfers the issuer role to another address. For example, the current issuer may designate a successor when the service provider changes.
Arguments
newIssuer- The address of the new issuer.
deposit
function deposit(uint256 amount) external;Deposits tokens to fund subsequent payments. The deposited funds provide the basis for settling authorized consumption.
Arguments
amount- The amount of tokens to deposit.
withdraw
function withdraw(address to, uint256 amount) external;Withdraws remaining tokens from a deposited balance. In the prepayment model, the issuer processes refunds. In the lock-release model, users withdraw their own unused funds according to the applicable rules.
Arguments
to- The account receiving the withdrawal.
amount- The amount to withdraw.
depositBalanceOf
function depositBalanceOf(address user) external view returns(uint256 depositBalance, uint256 epoch);Returns the specified user's deposited balance and current epoch. Users and service providers can use this information to track deposited funds and payment state.
Arguments
user- The address being queried.
Return values
depositBalance- The current deposited balance.
epoch- The current epoch number.
Events
Deposit
event Deposit(address indexed from, uint256 amount);Emitted when tokens are deposited.
Wallets and frontends can monitor this event to detect calls to deposit.
Parameters
from- The address depositing tokens.
amount- The deposited token amount.
Withdraw
event Withdraw(address indexed to, uint256 amount);Emitted when tokens are withdrawn. It notifies observers of withdrawals processed by the user or issuer, depending on the operating model.
Parameters
to- The recipient of the withdrawal.
amount- The withdrawn token amount.
TransferIssuer
event TransferIssuer(address indexed oldIssuer, address indexed newIssuer);Emitted when the issuer role is transferred. Wallets and monitoring systems can track changes to the authorized issuer.
Parameters
oldIssuer- The previous issuer's address.
newIssuer- The new issuer's address.
Claim
event Claim(address indexed from, address indexed to, uint256 epoch, uint256 consumption);Emitted when the issuer claims signed consumption. It records the claim on-chain.
Parameters
from- The payer's address.
to- The recipient of the claim, typically the issuer.
epoch- The epoch associated with the consumption.
consumption- The claimed consumption amount.
Rationale
ERC-3135 focuses on the widely adopted ERC-20 token standard while aiming to remain adaptable to other token standards.
The proposal places its functions directly in the token contract rather than requiring a separate helper contract. The reasons include the following.
- Token transfers are familiar and convenient
Tokens are already integrated into many wallets and existing applications.
- Standard token contracts have substantial UI support
Many wallets and services support ERC-20 balances and token transfers. Building on these conventions can simplify the user experience.
- Connecting a token with a service
Associating the token with service entitlements creates a direct relationship between payment assets and the services they fund.
- Avoiding a separate approval step
A conventional delegated ERC-20 transfer can require an approval followed by transferFrom. The proposed integrated deposit and claim mechanism instead uses signed consumption authorizations. Depending on the implementation, this can reduce transaction overhead and simplify interactions.
Integrating these functions directly into the token contract is intended to preserve the convenience of standardized tokens while extending their payment capabilities.
Reference implementation
mapping (address => StampBalance) private _depositBalance;
struct StampBalance{
uint256 balance;
uint256 epoch;
}
function deposit(uint256 value) override external{
require(value <= _balances[msg.sender]);
_balances[msg.sender] = _balances[msg.sender].sub(value);
_depositBalance[msg.sender].balance = _depositBalance[msg.sender].balance.add(value);
emit Deposit(msg.sender, value);
}
function withdraw(address to, uint256 value) override onlyIssuer external{
require(value <= _depositBalance[to].balance);
_depositBalance[to].balance = _depositBalance[to].balance.sub(value);
_depositBalance[to].epoch += 1;
_balances[to] = _balances[to].add(value);
emit Withdraw(to, value);
}
function depositBalanceOf(address user) override public view returns(uint256 depositBalance, uint256 epoch){
return (_depositBalance[user].balance, _depositBalance[user].epoch);
}
// prepayment model
function claim(address from, uint credit, uint epoch, bytes memory signature) override onlyIssuer external{
require(credit > 0);
require(_depositBalance[from].epoch + 1 == epoch);
require(_depositBalance[from].balance >= credit);
bytes32 message = keccak256(abi.encode(this, from, _issuer, credit, epoch));
bytes32 msgHash = prefixed(message);
require(recoverSigner(msgHash, signature) == from);
_depositBalance[from].balance = _depositBalance[from].balance.sub(credit);
_balances[_issuer] = _balances[_issuer].add(credit);
_depositBalance[from].epoch += 1;
emit Claim(from, msg.sender, credit, epoch);
}
function prefixed(bytes32 hash) internal pure returns (bytes32) {
return keccak256(abi.encode("\x19Ethereum Signed Message:\n32", hash));
}
function recoverSigner(bytes32 message, bytes memory sig) internal pure returns (address) {
(uint8 v, bytes32 r, bytes32 s) = splitSignature(sig);
return ecrecover(message, v, r, s);
}
function splitSignature(bytes memory sig) internal pure returns (uint8 v, bytes32 r, bytes32 s) {
require(sig.length == 65);
assembly {
r := mload(add(sig, 32))
s := mload(add(sig, 64))
v := byte(0, mload(add(sig, 96)))
}
return (v, r, s);
}Security considerations
ERC-3135 restricts claim to the issuer, reducing the risk of unauthorized parties competing to submit claims.
This restriction does not eliminate the need for correct nonce, epoch, and consumption accounting.
Off-chain signed messages can still introduce double-spending or double-consumption risks. For example:
- A service provider operating multiple verification servers receives several payment messages from the same payer concurrently.
- Different servers independently validate messages specifying different consumption amounts.
- Although the highest valid cumulative consumption message should determine settlement for an epoch, multiple servers may provisionally accept inconsistent payment states.
The proposal recommends an echo server to coordinate these verification servers.
- Receive payment messages from the verification servers.
- Return the latest authoritative message according to the epoch and cumulative consumption ordering.
- Have verification servers compare their local messages against the authoritative state and update their state when necessary.
- Request an updated signed payment message from the user when the previous authorization is no longer consistent.
This coordination mechanism helps maintain a consistent off-chain payment state and reduce double-consumption risks. Its effectiveness depends on correct concurrency handling, reliable state storage, and the trust and availability of the coordination infrastructure.
Citation
Zhenyu Sun (@Ungigdu), "ERC-3135: Exclusive Claimable Token [DRAFT]," Ethereum Improvement Proposals, no. 3135, August 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-3135.
Conclusion
This article covered ERC-3135, a proposal for ERC-20-compatible micropayments using off-chain signed consumption messages and issuer-only on-chain claims.
If you have questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.



