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-7196, a proposal to simplify token management for smart contract wallets by retaining core ERC-20 functionality while removing transferFrom, approve, and allowance.

The explanation below translates, summarizes, and expands on the original proposal.

I also cover a range of other EIPs.

Overview

This Ethereum Request for Comments proposes a new asset interface designed around smart contract wallets, including account abstraction. It aims to keep token contracts simple by retaining core ERC-20 operations while removing transferFrom, approve, and allowance.

For more on ERC-20, see the following article.

https://chaldene.net/erc20

Account abstraction

Ethereum accounts have traditionally been divided into two types: externally owned accounts (EOAs) and contract accounts. EOAs are controlled through private keys, whereas contract accounts are governed by code. Account abstraction aims to reduce the distinction between these account types and allow accounts to define behavior such as transaction authorization and submission. This enables more sophisticated authentication mechanisms and wallet functionality.

For more on ERC-4337, a proposal related to contract accounts, see the following article.

[ERC-4337] Implementing Account Abstraction Without Protocol Changes

Compatibility with ERC-20

ERC-20 is a widely adopted Ethereum token standard. It defines basic token operations, including transfers and approvals. Compatibility with existing ERC-20 operations can facilitate integration with infrastructure and services that support them. However, applications that require the omitted allowance methods cannot treat ERC-7196 as a fully compatible ERC-20 token.

Removing transferFrom, approve, and allowance

  • transferFrom
    • Allows another address to transfer tokens on behalf of their owner.
  • approve
    • Authorizes another address to transfer up to a specified amount of tokens.
  • allowance
    • Retrieves the amount of tokens approved for a spender.

These functions implement delegation and authorization mechanisms. Removing them from the token interface simplifies token management and lets users control their assets more directly through their wallets.

Why this matters

The proposed design aims to make asset management more intuitive and secure. Account abstraction can improve the user experience and enable new applications and wallet features. Retaining common ERC-20 operations while simplifying authorization can improve usability and security, although full compatibility is not retained.

Motivation

The proposal aims to create a simpler token design based on smart contract wallets. By removing certain ERC-20 features and moving responsibility from token contracts to wallets, the proposal seeks to achieve the following goals.

Keeping the token contract simple

The central idea is to keep token contracts simple and make direct transfers through transfer their primary responsibility. Focusing on the fundamental operation of transferring assets between users reduces contract complexity and can reduce security risks.

Removing approve and allowance

In conventional ERC-20 tokens, approve authorizes a third party to transfer up to a specified amount of the user's tokens, and allowance retrieves that authorized amount. The proposal removes these functions from the token contract and instead manages permissions at the user or wallet level. This provides flexibility and control while reducing certain risks associated with allowance functionality in ERC-20 contracts.

Removing transferFrom

The transferFrom function allows a spender to move another user's tokens within its allowance. The proposal removes that function and instead allows authorized operations to be executed through the user's contract account, which calls the token contract. The intention is to provide more flexible and secure authorization through the wallet rather than direct delegated access to the token contract.

Forward compatibility with ERC-20

The proposal seeks to retain common ERC-20 functionality so decentralized tokens can adopt the new design. This is intended to facilitate integration with the existing ERC-20 ecosystem and the transition to a simplified token interface.

The proposal aims to improve the user experience and reduce security risks through a simpler and more flexible approach to token implementation and management. It places smart contract wallets at the center of authorization and asset management. Users can thereby manage assets more directly using their wallet's security logic.

Specification

A conforming contract must implement the following interface.

ts
pragma solidity ^0.8.20;

/**
 * @title ERC7196 Simple token interface 
 * @dev See https://ercs.ethereum.org/ERCS/erc-7196
 */
interface IERC7196 {
    /**
     * @notice Used to notify transfer tokens.
     * @param from Address of the from
     * @param to Address of the receive
     * @param value The transaction amount 
     */
    event Transfer(
        address indexed from,
        address indexed to,
        uint256 value
    );
	
    /**
     * @notice Get the total supply
     * @return total The total supply amount
     */
    function totalSupply() 
        external  
        view
        returns (uint256 total);
	  
    /**
     * @notice get the balance of owenr address
     * @param owner Address of the owner
     * @return balance The balance of the owenr address
     */
    function balanceOf(address owner) 
        external
        view
        returns (uint256 balance);

    /**
     * @notice Transfer token
     * @param to Address of the to
     * @param value The transaction amount 
     * @return success The bool value returns whether the transfer is successful
     */
    function transfer(address to, uint256 value)
        external
        returns (bool success);

}

totalSupply

javascript
function totalSupply() 
    external  
    view
    returns (uint256 total);

Overview

Retrieves the total token supply.

Details

The function returns the total quantity of tokens managed by the contract. It indicates the quantity issued, although total supply is not necessarily the same as circulating supply.

Return value

  • total
    • The total quantity of tokens issued and outstanding.

balanceOf

javascript
function balanceOf(address owner) 
    external
    view
    returns (uint256 balance);

Overview

Retrieves the token balance of a specified address.

Details

The function returns the quantity of tokens held by the specified address (owner). It can be used to check an account's token holdings.

Arguments

  • owner
    • The address whose token balance is being queried.

Return value

  • balance
    • The quantity of tokens held by the specified address.

transfer

javascript
function transfer(address to, uint256 value)
    external
    returns (bool success);

Overview

Transfers tokens.

Details

The function transfers tokens from the caller to a specified address (to). It returns a Boolean indicating whether the transfer succeeded; implementations may also revert on failure.

Arguments

  • to
    • The recipient address.
  • value
    • The quantity of tokens to transfer.

Return value

  • success
    • A Boolean indicating whether the transfer succeeded.

Rationale

The proposed simplification focuses on removing transferFrom, approve, and allowance. The goal is to improve security, reduce complexity, and increase efficiency while retaining the functionality needed in smart contract wallet environments.

Improving security

The approve and allowance mechanism lets third parties move tokens on behalf of users, but it can be misused. For example, a user may inadvertently approve a large amount, or an approved smart contract may contain a vulnerability. Removing these functions allows users to retain direct control of their tokens through their wallets and reduces risks specific to token allowances.

Reducing complexity

Existing token standards such as ERC-20 define multiple functions and events, adding complexity to contract implementations and interactions. The proposed simplification allows developers to focus on the basic transfer operation and write simpler, more readable code. This can lower implementation barriers and encourage adoption of new token designs in the Ethereum ecosystem.

Improving efficiency

Reducing the number of operations required for a token transfer can lower execution costs. In particular, allowance-based transfers may require multiple transactions, including an approval before a spender can transfer tokens. Simplifying these procedures can make token transfers more efficient and economical, depending on how wallet authorization is implemented.

Suitability for smart contract wallets

Smart contract wallets offer users sophisticated control and security features, whereas existing token standards were originally designed around externally owned accounts (EOAs). The proposed standard aims to use wallet capabilities to manage tokens more effectively. For example, the wallet's own logic can control token transfers and permissions more flexibly.

The proposal aims to simplify token transactions and management, improving the experience of users and developers in the Ethereum ecosystem. These changes are intended to make asset management more intuitive and secure, particularly for users of smart contract wallets.

Compatibility

This ERC retains common ERC-20 operations, but it is not fully backward-compatible with ERC-20 because it omits mandatory allowance-related methods, as discussed below.

Implementation

ts
pragma solidity ^0.8.20;

import "./IERC7196.sol";
import "../../math/SafeMath.sol";

/**
 * @title Standard ERC7196 token
 * @dev Note: the ERC-165 identifier for this interface is 0xc1b31357
 * @dev Implementation of the basic standard token.
 */
contract ERC7196 is IERC7196 {
    using SafeMath for uint256;

    mapping (address => uint256) private _balances;

    uint256 private _totalSupply;

    function totalSupply() external view returns (uint256) {
        return _totalSupply;
    }

    function balanceOf(address owner) external view returns (uint256) {
        return _balances[owner];
    }

    function transfer(address to, uint256 value) external returns (bool) {
        require(value <= _balances[msg.sender]);
        require(to != address(0));

        _balances[msg.sender] = _balances[msg.sender].sub(value);
        _balances[to] = _balances[to].add(value);
        emit Transfer(msg.sender, to, value);
        return true;
    }

}

Security considerations

The proposed ERC standard is not backward-compatible with ERC-20. Tokens implementing the new standard cannot be integrated into existing decentralized applications (dApps) in exactly the same way as ERC-20 tokens. This has several implications.

Compatibility with existing dApps

Many existing dApps implement token-handling logic based on ERC-20. This includes transfers, approvals, and allowance queries. If the new token interface does not provide these operations, dApps that depend on them cannot handle the tokens without modification.

Upgrades and integration

To support the proposed standard, dApp developers must upgrade existing applications and adapt their integration logic. This introduces additional work and may slow ecosystem-wide adoption.

Impact on the ecosystem

A lack of backward compatibility makes rapid migration across the ecosystem more difficult. If existing tokens and services do not support the new standard, users may encounter interoperability issues between the old and new interfaces.

Improving security and usability

A major motivation for the proposal is to improve token security and usability for users of smart contract wallets. The lack of backward compatibility, however, creates integration challenges for existing infrastructure. Widespread adoption would therefore require coordination across the ecosystem.

Citation

Xiang (@wenzhenxiang), Ben77 (@ben2077), Mingshi S. (@newnewsms), "ERC-7196: Simple token, Simplified ERC-20 [DRAFT]," Ethereum Improvement Proposals, no. 7196, June 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7196.

Conclusion

This article covered ERC-7196, a proposal for simplifying token management for smart contract wallets by retaining core ERC-20 functionality while removing transferFrom, approve, and allowance.

If you have questions, feel free to reach out via Twitter DM.

Twitter @cardene777

I also publish on the following platforms.

https://chaldene.net/