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 explains ERC-7945, a proposed interface for transferring tokens while keeping balances and transfer amounts confidential.

This article explains the following proposal.

The interface follows familiar ERC-20 patterns while representing confidential balances and transfer amounts as encrypted byte strings.

Overview

ERC-7945 defines a standard interface for fungible tokens that support confidential transactions.

In ERC-20, balances and transfer amounts are ordinarily public on-chain. ERC-7945 represents these values using the bytes type. Transfers include proof data (_proof), which can contain zero-knowledge proofs (ZKPs) allowing the contract to verify the validity of confidential operations without learning their plaintext amounts.

This allows implementations to conceal balances and transfer amounts from parties without the appropriate decryption capabilities.

The interface provides transfer, approval, and allowance mechanisms analogous to ERC-20. Applications can therefore retain familiar interaction patterns while integrating confidential operations.

Privacy depends on the underlying cryptographic implementation. An interface alone does not guarantee confidentiality, and the addresses and other transaction metadata may remain public.

Comparison of ERC-20 and ERC-7945

For ERC-20, see the following article.

ERC-20: A guide from first principles

Motivation

Token standards such as ERC-20 have become foundational to DeFi and other blockchain applications. However, their public balances and transfer amounts create privacy concerns.

Networks such as Monero and Zcash support confidential transaction mechanisms at the protocol level. On Ethereum, approaches such as Zether have explored providing privacy through smart contracts, but applications have lacked a common interface for confidential fungible tokens.

Without such an interface, users and applications cannot easily determine whether a token supports confidential operations or how to interact with those operations consistently.

ERC-7945 addresses this gap by proposing a common set of core functions and events without prescribing a particular cryptographic implementation.

Specification

ITokenMetadata interface

This interface provides token metadata through the familiar ERC-20 functions name, symbol, and decimals. All three are optional.

javascript
function name() public view returns (string)
function symbol() public view returns (string)
function decimals() public view returns (uint8)

IConfidentialToken interface

This interface defines the core confidential transaction operations.

confidentialBalanceOf

Returns the encrypted balance associated with the specified account.

javascript
function confidentialBalanceOf(address owner)
    public view returns (bytes memory confidentialBalance)
  • Parameter
    • owner Address of the account whose balance is requested.
  • Return value
    • The confidential balance, represented as bytes.

An appropriately encrypted balance does not disclose its plaintext value to parties lacking the required decryption capabilities.

confidentialTransfer

Transfers tokens using a confidential transfer amount and accompanying proof data.

javascript
function confidentialTransfer(
    address _to,
    bytes memory _confidentialTransferValue,
    bytes memory _proof
) public returns (bool success)
  • Parameters
    • _to Recipient address.
    • _confidentialTransferValue Confidential transfer amount.
    • _proof Data proving the validity of the transfer, such as a ZKP.
  • Return value
    • True on success and false on failure.
  • Callers must handle a false return value appropriately.
  • Invalid proof verification causes the operation to revert.

In an ElGamal-based implementation such as a Zether-style design, balances and transfer values can be homomorphically encrypted.

The proof can establish that:

  • The transfer amount is consistently encrypted under both the sender's and recipient's public keys.
  • The plaintext transfer amount is nonnegative.
  • The sender has sufficient funds to cover the transfer.

Homomorphic operations allow the contract to update encrypted balances without learning the underlying amounts.

sequenceDiagram
    participant S as 送信者
    participant C as コントラクト
    participant R as 受信者

    S->>C: confidentialTransfer(to, 暗号化額, 証明)
    C->>C: 証明を検証(ZKP)
    C->>C: 送信者の暗号化残高を減算
    C->>C: 受信者の暗号化残高を加算
    C-->>S: success = true

The sequence diagram retains its original labels. It depicts proof verification followed by subtraction from the sender's confidential balance and addition to the recipient's confidential balance.

confidentialTransferFrom

Allows an authorized third party to transfer tokens, analogous to ERC-20's transferFrom.

javascript
function confidentialTransferFrom(
    address _from,
    address _to,
    bytes memory _confidentialTransferValue,
    bytes memory _proof
) public returns (bool success)
  • Parameters
    • _from Source account.
    • _to Recipient account.
    • _confidentialTransferValue Confidential transfer amount.
    • _proof Data proving the validity of the transfer.
  • Return value
    • True on success and false on failure.
  • The operation reverts if the source account has not authorized the caller through the applicable mechanism.
  • Invalid proofs also cause the operation to revert.

In the illustrative public-key encryption model, the proof for confidentialTransferFrom can establish that:

  • The transfer amount is consistently encrypted under the source account's, recipient's, and caller's public keys.
  • The plaintext amount is nonnegative.
  • The caller's approved allowance is sufficient to cover the transfer.

Unlike a direct confidential transfer, a delegated transfer draws from the approved allowance portion rather than the source account's unallocated confidential balance.

The three-key construction is an example of a cryptographic design, not a universal requirement that every implementation use ElGamal.

Direct and delegated confidential transfers

confidentialApprove

Allocates part of an account's confidential balance for transfers by a designated spender. Its behavior differs from conventional ERC-20 approval.

javascript
function confidentialApprove(
    address _spender,
    bytes memory _confidentialValue,
    bytes memory _proof
) public returns (bool success)
  • Parameters
    • _spender Address of the account receiving approval.
    • _confidentialValue Confidential value allocated to the allowance portion.
    • _proof Data proving the validity of the allocation.
  • Return value
    • True on success and false on failure.
  • Invalid proof verification causes the operation to revert.
  • In the illustrative encryption model, the proof establishes consistent encryption under the caller's and spender's public keys, nonnegativity of the value, and sufficient balance.
  • Calling the function again combines the remaining existing allowance portion with the available balance before allocating the new allowance.

Confidential approval and balance allocation

How confidential approval differs from ERC-20 approval

ERC-20 approval grants permission to transfer up to a specified amount. It does not ordinarily reserve that amount from the owner's balance.

In the ERC-7945 model described here, confidential approval splits the owner's encrypted balance into an allowance portion and a remaining portion.

For example, if the encrypted balance represents 100 tokens and 30 tokens are approved, the resulting allocation is 30 tokens in the allowance portion and 70 tokens in the remaining balance.

text
approve前の残高 = approve後のallowance部分 + approve後の残り部分

In English, the pre-approval balance equals the sum of the post-approval allowance and remaining balance.

The spender can use confidentialTransferFrom to spend from the allowance portion, which decreases as tokens are transferred. The remaining portion represents the caller's available confidential balance.

A subsequent approval first restores the unspent existing allowance portion to the balance, then establishes the new allowance.

confidentialAllowance

Returns the confidential allowance allocated by an owner to a spender.

javascript
function confidentialAllowance(address _owner, address _spender)
    public view returns (bytes memory _confidentialValue)
  • Parameters
    • _owner Token owner's address.
    • _spender Authorized spender's address.
  • Return value
    • The confidential allowance value.

Events

ConfidentialTransfer

Emitted when tokens are transferred.

javascript
event ConfidentialTransfer(
    address indexed _spender,
    address indexed _from,
    address indexed _to,
    bytes _confidentialTransferValue
)

For transfers through confidentialTransferFrom, the spender field identifies the caller. For other transfers, the proposal recommends using the zero address for the spender field.

For Mint operations, emitting this event with the zero address as the source is recommended. For Burn operations, the destination can be the zero address.

ConfidentialApproval

Emitted whenever confidentialApprove succeeds.

javascript
event ConfidentialApproval(
    address indexed _owner,
    address indexed _spender,
    bytes _currentAllowancePart,
    bytes _allowancePart
)

Rationale

Why confidentialTotalSupply is optional

ERC-20 provides totalSupply(), but ERC-7945 treats confidentialTotalSupply() as optional.

If every user could decrypt total supply, comparing its values before and after Mint or Burn operations could disclose the amount minted or burned.

Where confidential total supply is exposed, implementations may restrict decryption to authorized parties, such as auditors.

Audit support

Financial institutions and regulators may require authorized access to transaction amounts. Such support can be implemented without changing the confidentialTransfer function signature.

For example, an ElGamal-based design could include additional ciphertexts encrypted under an auditor group's public key, allowing authorized auditors to decrypt the relevant amounts. Confidential total supply could use a similar arrangement.

The implementation must establish the integrity of those additional ciphertexts and manage auditor key access appropriately.

Fat Token

ERC-7945 can coexist with ERC-20 in a single implementation.

A so-called Fat Token can maintain both public ERC-20 balances and confidential balances for each account. It may also provide optional conversion mechanisms between the two balance representations.

This can preserve compatibility with existing ERC-20-based DeFi protocols while offering separate confidential operations. Conversions between public and confidential balances can themselves disclose information and must be considered in the privacy model.

Backward compatibility

The proposal introduces a separate interface rather than modifying the ERC-20 standard. Existing token contracts remain unaffected unless they explicitly adopt the additional functionality.

Security

To preserve amount confidentiality, implementations must avoid disclosing plaintext Mint and Burn amounts. The proposal recommends applying a cryptographic strategy consistent with confidential transfers to these operations.

Plaintext Mint or Burn parameters would reveal the corresponding amounts to observers.

Implementations must also validate the proofs, enforce balance and allowance conservation, prevent replay or unauthorized state changes, and define an appropriate key-management model. Encrypted amounts do not automatically conceal sender and recipient addresses or all other transaction metadata.

References

https://eprint.iacr.org/2019/191.pdf

Conclusion

ERC-7945 (Confidential Transactions Supported Token) proposes a standard interface for confidential fungible token operations.

It retains familiar transfer, approval, and allowance concepts while representing balances and transfer amounts confidentially. Cryptographic techniques such as ZKPs and homomorphic encryption can enable implementations to verify transactions and update balances without exposing their plaintext values.

The proposal also considers audit support and Fat Token implementations combining confidential operations with ERC-20 compatibility.

Other publications: