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.

ERC-2876 proposes a mechanism for supplying an identifier when depositing ETH into a contract, making individual deposits easier to reconcile.

This article translates, summarizes, and expands on the following proposal.

More EIP explainers:

Overview

ERC-2876 defines a contract interface for processing ETH deposits. It also introduces an extended address format containing an eight-byte identifier that can associate a payment with a customer or invoice.

A service can use one deposit contract for multiple customers rather than maintaining a separate deposit account for every user. This can simplify key management and reduce reliance on hot wallets.

Compatible wallets interpret the extended deposit address and construct a transaction carrying the corresponding identifier. The receiving application can use that identifier to reconcile the payment.

The proposal compares a deposit-and-forward workflow costing approximately 30,000 gas with a two-transaction workflow costing 42,000 gas in base transaction charges. These are illustrative historical figures, not guarantees for arbitrary contract implementations or current network rules.

The contract can also forward deposited ETH directly to a cold wallet, reducing the need for separate manual collection transactions.

Motivation

Centralized exchanges and e-commerce services need to associate incoming ETH payments with particular users or orders.

A conventional approach assigns each user a separate externally owned account or contract account. This introduces several operational challenges:

  • Automatically collecting funds from separate EOAs can require online access to their signing keys, increasing hot-wallet exposure.
  • Keeping those keys offline can increase the operational effort required to consolidate deposits.
  • Deploying separate deposit contracts incurs deployment costs, estimated at approximately 60,000 gas in the example discussed by the proposal.

These approaches involve trade-offs between security, operational effort, and transaction costs, particularly during periods of high gas prices.

ERC-2876 proposes a shared deposit mechanism that allows applications to process many deposits without provisioning a separate account for every customer.

Specification

Terminology

  • Contract interface

    The deposit function interface defined by the proposal.

  • Deposit address format

    An extended representation combining a 20-byte Ethereum address with an eight-byte identifier, consisting of a five-byte nonce and a three-byte checksum.

  • ID (eight bytes)

    An identifier used to associate a deposit with a record in the receiving application.

  • Parent application

    The application that processes information received through the deposit function, such as an exchange or e-commerce backend.

  • Depositor

    The user sending ETH to the contract.

  • Wallet

    The application or library constructing and submitting the transaction on behalf of the depositor. The original proposal gives examples such as MyEtherWallet, Ledger, and blockchain.com.

Deposit address format

The extended deposit address has the following structure.

text
28バイト = 20バイトのベースアドレス + 5バイトのnonce + 3バイトのチェックサム

In English, the 28-byte representation consists of the 20-byte base address, five-byte nonce, and three-byte checksum.

The checksum is obtained by applying Keccak-256 to the concatenated 25-byte address and nonce, then taking the first three bytes of the hash.

JavaScript generation example

javascript
function generateAddress (baseAddress, nonce) {
  if (
    !baseAddress.match(/^0x[0-9a-fA-F]{40}$/) ||
    !nonce.match(/^0x[0-9a-fA-F]{10}$/)
  ) {
    throw new Error('Base Address and nonce must be 0x hex strings');
  }
  const ret =
    baseAddress.toLowerCase() + nonce.toLowerCase().replace(/^0x/, '');
  const myHash = web3.utils.keccak256(ret);
  return ret + myHash.slice(2, 8); // 先頭3バイトを追加
}

The example validates the input lengths, concatenates the address and nonce, and appends the checksum. The original Japanese comment is retained.

Solidity checksum verification example

js
function checksumMatch(bytes8 id) internal view returns (bool) {
    bytes32 chkhash = keccak256(
        abi.encodePacked(address(this), bytes5(id))
    );
    bytes3 chkh = bytes3(chkhash);
    bytes3 chki = bytes3(bytes8(uint64(id) << 40));
    return chkh == chki;
}

The example derives the expected checksum from the contract's address and the first five bytes of the ID, then compares it with the final three bytes.

The code excerpts are reproduced from the original article and have not been independently executed or compiled.

Contract interface

A compatible deposit contract provides the following interface.

js
interface DepositEIP {
  function deposit(bytes8 id) external payable returns (bool);
}

A plain ETH transfer with empty calldata must revert.

The deposit function distinguishes three outcomes:

  • Return true

    The deposit succeeds and the parent application's payment processing is considered complete according to the implementation.

  • Return false

    The contract accepts the ETH, but the payment is not yet complete. For example, a 3 ETH payment may be accepted toward a 5 ETH invoice.

  • Revert

    Deposit processing fails and the ETH transfer associated with the reverted call is rolled back.

The contract should verify the identifier's checksum.

If a payment exceeds the amount requested for a one-time invoice, the proposal recommends against automatically refunding the excess to msg.sender. The parent application should manage and communicate the excess according to its payment policy.

A false return value is not equivalent to an EVM revert. An application must explicitly interpret the deposit result rather than assuming that a successful transaction receipt necessarily means the invoice has been paid in full.

Sending deposits from wallets

Compatible wallet applications and libraries must support the following behavior:

  • Accept the extended deposit address as an alternative input format to a conventional 20-byte address.
  • Validate the three-byte checksum and reject a mismatching address.
  • Reject an attempt to combine the deposit address with separately supplied nonempty transaction data.
  • Construct the transaction using the following fields:
    • The to field contains the first 20 bytes of the deposit address.
    • The data field contains the following ABI-encoded function call.
text
    0x3ef8e69a + [8バイトID] + [24バイトゼロパディング]
    ```

The first four bytes are the selector of deposit(bytes8). The eight-byte ID is right-padded to a 32-byte ABI argument.

Example:

to: 0x433e064c42e87325fb6ffa9575a34862e0052f26 data: 0x3ef8e69a913fd924f056cd15000000000000000000000000000000000000000000

text

The 28-byte representation is a wallet-level input convention, not a new native Ethereum account-address length. The actual transaction destination remains a 20-byte address.

The receiving application can use the ID to reconcile the deposit. The ID is not cryptographic proof of the depositor's identity, and a valid checksum does not establish authorization or invoice ownership.

## Tests

The original article provides the following test vectors.

```bash
[
  {
    "address": "0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795",
    "nonce": "0xbdd769c69b",
    "depositAddress": "0x083d6b05729c58289eb2d6d7c1bb1228d1e3f795bdd769c69b3b97b9"
  },
  {
    "address": "0x433e064c42e87325fb6ffa9575a34862e0052f26",
    "nonce": "0x913fd924f0",
    "depositAddress": "0x433e064c42e87325fb6ffa9575a34862e0052f26913fd924f056cd15"
  },
  {
    "address": "0xbbc6597a834ef72570bfe5bb07030877c130e4be",
    "nonce": "0x2c8f5b3348",
    "depositAddress": "0xbbc6597a834ef72570bfe5bb07030877c130e4be2c8f5b3348023045"
  },
  {
    "address": "0x17627b07889cd22e9fae4c6abebb9a9ad0a904ee",
    "nonce": "0xe619dbb618",
    "depositAddress": "0x17627b07889cd22e9fae4c6abebb9a9ad0a904eee619dbb618732ef0"
  },
  {
    "address": "0x492cdf7701d3ebeaab63b4c7c0e66947c3d20247",
    "nonce": "0x6808043984",
    "depositAddress": "0x492cdf7701d3ebeaab63b4c7c0e66947c3d202476808043984183dbe"
  }
]

Rationale

The deposit interface is designed for native ETH rather than ERC-20 tokens.

The proposal notes that exchanges and e-commerce services can manage different assets through separate logical accounting and custody arrangements. An application can therefore adopt this interface for ETH and use different mechanisms for ERC-20 deposits.

Adding identifiers directly to ERC-20 transfer operations would require additional interfaces rather than changing the existing transfer function signature. Other protocols could adopt an analogous bytes8 identifier convention if useful.

The eight-byte ID design reflects several trade-offs:

  • A three-byte checksum provides 24 bits of error-detection information, compared with approximately 15 bits on average for the mixed-case checksum described by EIP-55.
  • A five-byte nonce provides 40 bits, allowing more than one trillion possible values.
  • A compact eight-byte identifier can reduce data-handling costs. Actual ABI encoding and hashing costs depend on the operations performed; an eight-byte static ABI argument still occupies a 32-byte word.

For EIP-55, see the following article.

EIP-55: Understanding Ethereum address checksums

Compatibility

The extended deposit address is not a conventional 20-byte Ethereum address. Wallets that do not support the format will generally reject it.

A wallet supporting arbitrary transaction data can still construct the equivalent deposit call using the ordinary destination address and ABI-encoded calldata. A dedicated conversion tool could also expose these components to an application.

Compatible deposit contracts reject ordinary ETH transfers with empty calldata, reducing the chance that an unrecognized payment is accidentally accepted through the normal transfer path.

This rejection does not prevent every possible way in which ETH can arrive at a contract without executing its deposit function.

The original proposal envisages adoption through web3.js and major wallet applications. This describes the author's adoption plans, not a claim about current wallet support.

Security

Forwarding funds to a cold wallet

The proposal recommends forwarding accepted ETH to a cold wallet where practical, limiting the amount retained in the deposit contract.

The destination can be fixed using either:

  • Solidity's constant keyword.
  • Solidity's immutable keyword, introduced in version 0.6.5.

A fixed destination helps prevent unauthorized changes to the forwarding address. However, applications must also consider the consequences of losing access to that address, and a fixed address in an implementation does not eliminate risks introduced by an upgradeable architecture.

Handling shutdown of the parent application

If the parent exchange or e-commerce service ceases operation while its deposit contract remains active, users may inadvertently send funds that the service no longer processes.

The proposal therefore recommends a shutdown mechanism that causes calls to deposit(bytes8) to revert. This is a deposit-disable mechanism, not a requirement to destroy the contract.

Historically, deleting contract code with SELFDESTRUCT could leave an address capable of receiving ETH without a usable withdrawal mechanism, creating a risk of irrecoverable payments.

Under EIP-6780, SELFDESTRUCT generally no longer deletes the code or storage of an existing contract, except in the specified same-transaction creation case. Regardless of these protocol changes, explicitly disabling the deposit function is preferable to relying on contract destruction as a shutdown mechanism.

Citation

Jonathan Underwood (@junderw), "ERC-2876: Deposit contract and address standard [DRAFT]," Ethereum Improvement Proposals, no. 2876, August 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2876.

Conclusion

ERC-2876 proposes a shared ETH deposit contract and an extended address format carrying a payment identifier. It can simplify reconciliation and fund collection without requiring a separate deposit account for each customer.

Questions are welcome via Twitter @cardene777.

Other publications:

https://chaldene.net/