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 explores EIP-5792, a proposal to add JSON-RPC methods for executing batched transactions through wallets and checking their execution status.

This article translates, summarizes, and supplements the proposal linked below. It describes the historical version covered by the Japanese article published on June 11, 2024; the current specification may differ.

I have also covered various other EIPs:

Overview

The standard defines new JSON-RPC methods. These methods allow applications to request batched state updates from wallets such as MetaMask and check their status.

State updates here refer to changes to data on the blockchain. Examples include an ERC-20 token transfer, an ERC-721 token mint, and sending ETH.

Applications can submit batch requests for state updates using capabilities defined by the wallet. Even when new wallet RPCs are introduced, applications can discover the capabilities supported by the wallet in advance.

Motivation

At the time of the proposal (October 2022), sending transactions from a wallet and checking their status required methods such as eth_sendTransaction and eth_getTransactionReceipt. However, eth_sendTransaction and similar methods were a legacy of the period when nodes also acted as wallets, and they did not accommodate newer transaction formats.

From a developer's perspective, it is desirable to execute multiple transactions atomically through a single RPC call. Even if a developer wants to use the paymaster functionality of ERC-4337 (where another address pays the gas fees), eth_sendTransaction does not make that functionality available.

The new wallet_ RPC suite aims to establish a clear separation between the responsibilities of wallets and applications, allowing developers to add new features with minimal coordination.

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

[ERC-4337] Implementing Account Abstraction Without Protocol Changes

https://mirror.xyz/0xcE77b9fCd390847627c84359fC1Bc02fC78f0e58/HaPTTeXZeXRG3K5JfXesmKet9eKTbcFUixW6IaMvt4c

How it works

The proposal introduced four new JSON-RPC methods. Three are intended for batching blockchain state updates, while the fourth allows applications to check whether a wallet supports particular capabilities. Applications can use the new batching methods, falling back to eth_sendTransaction and eth_getTransactionReceipt if the wallet does not support the three new methods.

wallet_sendCalls

This method enables efficient processing of multiple on-chain calls.

The requirements are as follows.

  • Send transactions in the specified order.
  • Send all transactions on the chain whose ID was specified in the request.
  • Do not send the transactions if the user rejects the request.
  • If any transaction fails, all transactions must fail.
  • The wallet may reject the request if the requested chain ID differs from the currently selected chain ID or the sending address is not a valid account.
  • The wallet may simulate the transactions in the batch and reject the request if it anticipates a failure.

wallet_sendCalls RPC specification

js
type SendCallsParams = {
  version: string;
  chainId: `0x${string}`; // Hex chain id
  from: `0x${string}`;
  calls: {
    to?: `0x${string}` | undefined;
    data?: `0x${string}` | undefined;
    value?: `0x${string}` | undefined; // Hex value
  }[];
  capabilities?: Record<string, any> | undefined;
};

type SendCallsResult = string;
  • from
    • The sending address.
  • chainId
    • The ID of the blockchain on which the calls should execute.
  • calls
    • An array containing the details of each transaction.
  • capabilities
    • The application specifies capabilities supported by the wallet.
    • For example, an ERC-4337 wallet can be given the URL of a paymaster service and obtain the paymaster and associated data from that service.

wallet_sendCalls parameter example

json
[
  {
    "version": "1.0",
    "chainId": "0x01",
    "from": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "calls": [
      {
        "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
        "value": "0x9184e72a",
        "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
      },
      {
        "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
        "value": "0x182183",
        "data": "0xfbadbaf01"
      }
    ],
    "capabilities": {
      // Illustrative
      "paymasterService": {
        "url": "https://..."
      }
    }
  }
]

wallet_sendCalls return value example

The returned identifier lets the user retrieve the status of the operation while it is being processed.

js
"0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"

wallet_getCallsStatus

This JSON-RPC method returns the status of batched transactions initiated through wallet_sendCalls.

When multiple transactions are involved, the receipts field contains their transaction receipts (execution results and other details) in execution order.

For a single transaction, one transaction receipt is returned. The receipt object's logs field contains only logs associated with transactions submitted using wallet_sendCalls. Logs from other user operations are not included.

wallet_getCallsStatus RPC specification

js
type GetCallsParams = string;

type GetCallsResult = {
  status: 'PENDING' | 'CONFIRMED';
  receipts?: {
    logs: {
      address: `0x${string}`;
      data: `0x${string}`;
      topics: `0x${string}`[];
    }[];
    status: `0x${string}`; // Hex 1 or 0 for success or failure, respectively
    blockHash: `0x${string}`;
    blockNumber: `0x${string}`;
    gasUsed: `0x${string}`;
    transactionHash: `0x${string}`;
  }[];
};

wallet_getCallsStatus parameter example

json
[
  {
    "version": "1.0",
    "chainId": "0x01",
    "from": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
    "calls": [
      {
        "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
        "value": "0x9184e72a",
        "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
      },
      {
        "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
        "value": "0x182183",
        "data": "0xfbadbaf01"
      }
    ],
    "capabilities": {
      // Illustrative
      "paymasterService": {
        "url": "https://..."
      }
    }
  }
]

wallet_sendCalls return value example

As with the return value of wallet_sendCalls, this identifier can be used to check the status.

js
[
  "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
]

wallet_showCallsStatus

This JSON-RPC method requests that the wallet display information about a batch of transactions submitted via wallet_sendCalls. The method returns nothing and simply asks the wallet to display the information.

wallet_showCallsStatus RPC specification

js
type ShowCallsParams = string; // Call bundle identifier returned by wallet_sendCalls

wallet_showCallsStatus parameter example

The method accepts the identifier returned when wallet_sendCalls is executed.

js
[
  "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
]

wallet_getCapabilities

This JSON-RPC method allows an application to ask a wallet whether specific capabilities are supported. It returns an error if the user has not authorized the connection between the application and the requested address. Besides querying the wallet directly, applications may discover wallet capabilities in the following ways.

  • Retrieve wallet capability information from externally stored data.
  • Read capability information stored in properties associated with the current session.
  • Retrieve capability information through a standardized interface.

wallet_getCapabilities RPC specification

js
type GetCapabilitiesParams = [`0x${string}`]; // Wallet address

type GetCapabilitiesResult = Record<`0x${string}`, <Record<string, any>>; // Hex chain id

wallet_getCapabilities parameter example

js
["0xd46e8dd67c5d32be8058bb8eb970870f07244567"]

wallet_getCapabilities return value example

json
{
  "0x2105": {
    "paymasterService": {
      "supported": true
    },
    "sessionKeys": {
      "supported": true
    }
  },
  "0x14A34": {
    "paymasterService": {
      "supported": true
    }
  }
}

atomicBatch

This capability indicates whether a wallet can execute multiple transactions as one transaction. If the wallet supports atomicBatch, the multiple transactions submitted via wallet_sendCalls are guaranteed to be executed as a single transaction.

atomicBatch capability specification

js
type AtomicBatchCapability = {
  supported: true;
};

To send transactions on multiple chains, the atomicBatch capability must be included for each chain.

wallet_getCapabilities return value example with atomicBatch

json
{
  "0x2105": {
    "atomicBatch": {
      "supported": true
    },
  },
  "0x14A34": {
    "atomicBatch": {
      "supported": true
    }
  }
}

Additional considerations

Naming

Because eth_sendTransaction is a legacy method, the new wallet_ prefix makes the role of these methods clearer. The name wallet_sendCalls was chosen to accommodate both EOA wallets, which may send multiple transactions, and contract wallets such as ERC-4337 wallets, which may bundle multiple transactions into a single transaction.

Atomicity of transaction execution

When executing multiple transactions as one transaction (a batch transaction), the operations must execute atomically (all at once, in the specified order). The atomicBatch capability lets applications choose atomic execution when running a batch while still allowing multiple transactions to be executed separately in other circumstances.

Gas limits

Initially, each transaction included an optional gas field. However, gas limits could not be specified in the same way for ERC-4337 contract wallets, and a single gas value was proposed instead. Because this approach was unsuitable for EOA wallets, the gas field was ultimately removed entirely.

Compatibility

If a wallet does not support the new methods, transactions can be sent sequentially using eth_sendTransaction. The user must also be informed of this fallback.

Security

The following points should be considered when executing transactions.

  • Untrusted transactions may be inserted between transactions in a batch.
  • Transactions in a batch may be included in non-consecutive blocks, and there are no timing guarantees.
  • Contracts can enforce a deadline by which execution must occur or a timeline within which specific conditions must be satisfied, helping prevent unexpected delays and failures.
  • Unless the wallet indicates to the application that it supports batched transactions, applications must assume submission in a single transaction.

Privacy considerations

  • Asking users to authorize an application's access to their wallet and its ability to send transactions allows users to manage permissions at a granular level.
  • Return detailed messages explaining whether a capability is unsupported or the user has not authorized the application's connection.
  • Expose capabilities only to applications authorized by the user.
  • Avoid excessive querying or sharing of wallet capabilities, as doing so may reveal which capabilities the wallet supports.

Citation

Moody Salem (@moodysalem), Lukas Rosario (@lukasrosario), Wilson Cusack (@wilsoncusack), Dror Tirosh (@drortirosh), Jake Moxey (@jxom), Derek Rein (@arein), "EIP-5792: Wallet Call API [DRAFT]," Ethereum Improvement Proposals, no. 5792, October 2022. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-5792.

Conclusion

This article covered EIP-5792, a proposal to add JSON-RPC methods for executing batched transactions from wallets and checking their execution status. I hope it has been helpful.

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

Twitter @cardene777

I also publish content on other platforms:

https://chaldene.net/