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.

Background

ERC-7895 defines an RPC method that lets universal wallets create or track other smart accounts as subaccounts.

This article walks through the proposal below.

I also cover other EIPs, BIPs, SLIPs, CAIPs, ENSIPs, RFCs, and ACPs.

Overview

ERC-7895 defines wallet_addSubAccount, an RPC method an app can use to ask a wallet to treat an account as its subaccount.

An account here generally means a smart account rather than an externally owned account (EOA). The proposal connects accounts embedded in individual apps to the universal wallet a user already uses.

Suppose a game or DeFi app gives each user a dedicated account. If the universal wallet is added as an owner, the user can inspect assets and permissions outside the app. The app can ask the wallet to create a new subaccount or bring an existing account under its management.

The proposal builds on EIP-5792.

For background on EIP-5792, see the following article.

[EIP-5792] How the Wallet Call API batches on-chain calls

Overview of ERC-7895

The diagrams retain their Japanese labels. The interface gives apps a standard way to associate their dedicated accounts with a universal wallet. It defines which accounts the wallet can track without adding execution logic.

Motivation

Embedded wallets and app-specific accounts can simplify the experience inside an app. As users accumulate separate addresses, however, it becomes harder for them to know which accounts they own.

For users who already have a universal wallet, these accounts can sit outside it. Asset management, permission management, and recovery can then follow separate paths in each app.

Accounts spread across apps compared with accounts tracked under a parent wallet

The accounts can retain distinct roles for games, DeFi, or other apps while the parent wallet provides one place to find them and check their permissions.

The proposal relies on ownership relationships among smart accounts. If smart account A can own account B, B can act as A's subaccount. This lets an app associate its dedicated account with the user's universal wallet.

Existing mechanisms lack a standard way for the app to communicate this relationship. ERC-7895 fills that gap by specifying how an app and a wallet share the relationship and add a subaccount. Signature algorithms and execution models remain the responsibility of the account implementation.

Specification

The main method is wallet_addSubAccount. The proposal also describes how to expose related capabilities through wallet_connect and wallet_getCapabilities.

Terminology

The proposal uses account to mean a smart account. A subaccount should have the main account as one of its owners.

The Japanese article's illustrative sentence reverses the account labels. Under the ownership rule above, if A is B's subaccount, B belongs to A's owner set. The relationship follows from ownership.

wallet_addSubAccount

An app can call wallet_addSubAccount to ask the connected universal wallet to track an app account or create a new subaccount. The method serves three use cases.

Type Purpose Main inputs
create Ask the wallet to create a subaccount keys
deployed Ask the wallet to import an existing account address
undeployed Ask the wallet to track an undeployed counterfactual account address factory factoryData

Three ways to add a subaccount

All three modes associate a subaccount with the parent wallet, but the wallet receives different inputs and performs different checks. In undeployed mode, the ownership check is more involved because the account does not yet exist on-chain.

ts
type Request = {
  method: "wallet_addSubAccount";
  params: [{
    version: string;
    account: CreateAccount | DeployedAccount | UndeployedAccount;
  }];
}

The version identifies the version of this JSON-RPC method. The account field takes one of the three shapes below.

CreateAccount

An app uses CreateAccount to request a new subaccount. It can ask for particular signing keys to be included among the account's owners without choosing the account implementation.

ts
type CreateAccount = {
  type: "create";
  keys: {
    publicKey: "0x...";
    type: "address" | "p256" | "webcrypto-p256" | "webauthn-p256";
  }[];
}

If the app omits the keys, the wallet is expected to create and manage a signing key for the subaccount. If the app supplies keys, the wallet can include them in its owner set.

The wallet should also include the universal account among the new account's owners. Creating an account alone does not establish the ownership hierarchy.

DeployedAccount

DeployedAccount registers an account that already exists on-chain. It works like an import.

ts
type DeployedAccount = {
  type: "deployed";
  address: `0x${string}`;
  keys: never;
  chainId?: `0x${string}`;
  factory?: never;
  factoryData?: never;
}

This mode brings a smart account that the app or user already holds into the universal wallet's tracking. For example, it can associate an account the user previously used inside an app with their main wallet.

UndeployedAccount

An app uses UndeployedAccount when it has planned an account but has yet to deploy it. The wallet can track its counterfactual address in advance.

ts
type UndeployedAccount = {
  type: "undeployed";
  address: `0x${string}`;
  keys: never;
  chainId?: `0x${string}`;
  factory: `0x${string}`;
  factoryData: `0x${string}`;
}

The factory and factoryData fields help the wallet determine whether the account can be deployed as expected when needed. The proposal says the wallet should verify that the universal account will be an owner. It gives two ways to do so: decode factoryData or simulate deployment.

Ownership verification for an undeployed account

When the wallet receives address, factory, and factoryData, it should confirm that the proposed deployment will make the parent wallet an owner before tracking the account. Accepting an arbitrary address from an app could cause the wallet to associate an unrelated account with the user.

Response

The response includes the account address. The wallet can also return factory and factoryData when it knows them.

ts
type Response = {
  address: `0x${string}`;
  factory?: `0x${string}`;
  factoryData?: `0x${string}`;
}

The response tells the app which account the wallet ultimately recognized for tracking. This is particularly useful in create mode, when the app may not know the address in advance.

External capabilities for wallet_connect

The proposal defines two capabilities for wallet_connect: addSubAccount and subAccounts.

addSubAccount

A wallet_connect caller can include addSubAccount to request a subaccount as part of the connection flow.

ts
type Request = {
  addSubAccount: {
    account: CreateAccount | DeployedAccount | UndeployedAccount;
  }
}

This complements wallet_addSubAccount by allowing an app to request the relationship while connecting.

subAccounts

The subAccounts capability returns the subaccounts associated with the universal account.

ts
type Response = {
  subAccounts: {
    address: `0x${string}`;
    factory?: `0x${string}`;
    factoryData?: `0x${string}`;
  }[];
}

An app can use the list to discover existing relationships as well as add new ones.

wallet_getCapabilities

A wallet can report support for addSubAccount through wallet_getCapabilities.

ts
type Response = {
  addSubAccount: {
    supported: true;
    keyTypes: ("address" | "p256" | "webcrypto-p256" | "webauthn-p256")[];
  }
}

The capability reports supported key types as well as whether the wallet supports the feature. An app can use that information to decide which creation requests it can send.

For example, an app should avoid a create request that requires webauthn-p256 if the wallet does not support that type. Querying capabilities first lets the app adapt to differences among wallets.

Capability discovery, subaccount requests, and retrieval

The integration covers capability discovery, the wallet_addSubAccount request, tracking, and subsequent retrieval. An implementation needs to support the checks before the request and give the app a way to find the account afterward.

Additional notes

Roles of the three modes

Mode Main actor or object Typical use
create Wallet Create a new subaccount now
deployed Existing account Associate a deployed account with the parent wallet
undeployed Account already planned by the app Track the address first and deploy the account when needed

The app sends only the inputs its design requires. The wallet can handle creation, import, and predeployment tracking according to the needs of each mode.

Typical integration flow

  1. Use wallet_getCapabilities to check addSubAccount support and keyTypes.
  2. Call wallet_addSubAccount with create, deployed, or undeployed as needed.
  3. The wallet verifies the ownership relationship and registers the account for tracking.
  4. Use wallet_connect and subAccounts to integrate account discovery with the connection and account management flows.

ERC-7895 therefore connects app-specific accounts to the universal wallet through capability discovery, ownership checks, and the connection flow as well as account import.

How to read the proposal's account types

The initial UndeployedAccount type definition requires factory and factoryData. A later explanatory block shows an abbreviated shape that can look inconsistent with it.

The ownership verification described by the proposal relies on factoryData or deployment simulation. Reading the specification as a whole, the initial type definition is the more natural basis for implementation.

Why this method name?

The rationale mentions names such as wallet_linkAccount, wallet_importAddress, and wallet_addAddress. The proposal chose wallet_addSubAccount because it covers both importing an account and creating one.

The name emphasizes that the wallet treats the account as part of an ownership hierarchy.

Compatibility

ERC-7895 extends existing JSON-RPC with a new method and capabilities that wallets can adopt incrementally. Wallets without support can continue operating as before. Supporting wallets can offer standardized creation and tracking of app-specific accounts.

The capability definitions build on EIP-5792 extension points, which makes them easier to adopt for wallets already using the Wallet Call API.

Security Considerations

The wallet must accept only accounts that legitimately belong under its management. This is especially important in undeployed mode. If a wallet accepts factoryData without validating its meaning, it may associate an account even though the universal account will never own it.

App-specific accounts can hold assets and permissions. When listing subaccounts or returning capabilities, the wallet should decide which information it is appropriate to share. The proposal calls for secure handling to avoid data leakage and man-in-the-middle attacks.

Bringing app-specific accounts under a universal wallet can make management easier and expand the parent wallet's authority. The interface and approval flow should make it clear which app and account the user is adding.

Conclusion

ERC-7895 lets a universal wallet create app-specific subaccounts or add existing ones. It provides a way to reconnect smart accounts spread across apps to a user's main wallet. That relationship becomes more important as embedded wallets, app-specific accounts, and smart accounts see broader use.

The proposal is currently marked Draft in the source article. It addresses practical questions for wallet implementers and dApp developers. Implementations will differ in which smart accounts they support, how much of their ownership verification they can standardize, and how clearly they present the relationship to the user.

Find more of my writing and resources here.