ERC-7895 · Draft · ERC · 2025-02-18
ERC-7895: API for Hierarchical Accounts
A wallet RPC, wallet_addSubAccount, that lets an app ask a user's universal wallet to create or track an app-specific smart account the wallet owns, so app accounts stop being scattered and orphaned.
What problem does it solve?
Many apps give users an embedded account: a smart account that only exists inside that app. Users end up with dozens of addresses they cannot see or control from their main wallet. Smart accounts can already own other smart accounts, so a universal wallet could in principle control those app accounts, but there was no standard way for an app to tell the wallet "this account belongs to you" or "please make one for me."
ERC-7895 defines that request, creating a hierarchy: the universal wallet is an owner (signer) of the app's sub-account.
How it works
The app calls wallet_addSubAccount with one of three account descriptions:
type |
Meaning |
|---|---|
create |
Wallet creates a new sub-account. The app may pass signing keys (types address, p256, webcrypto-p256, webauthn-p256); if none are given, the wallet creates and manages the key. The universal account SHOULD be made an owner. |
deployed |
Import an account that already exists onchain at address. |
undeployed |
A counterfactual account: the app supplies address, factory and factoryData. The wallet SHOULD check (by decoding or simulating) that the universal account is an owner and may deploy it when first needed. |
The response returns the sub-account address, plus factory and factoryData when available.
It also plugs into existing wallet APIs: wallet_getCapabilities (ERC-5792) can advertise addSubAccount support and accepted key types per chain, and wallet_connect (ERC-7846) gains addSubAccount and subAccounts capabilities so an app can add or list sub-accounts during connection.
Sample code
Requesting a new sub-account with an app-held passkey via an EIP-1193 provider:
const caps = await provider.request({
method: "wallet_getCapabilities",
params: [userAddress],
});
// e.g. caps["0x2105"].addSubAccount -> { supported: true, keyTypes: [...] }
const sub = await provider.request({
method: "wallet_addSubAccount",
params: [{
version: "1",
account: {
type: "create",
keys: [{ type: "webauthn-p256", publicKey: "0x..." }],
},
}],
});
console.log(sub.address, sub.factory, sub.factoryData);
Things to know
- Status: Draft. Method names, fields and versioning may still change, and the dependency on ERC-7846 is itself still in Draft.
- "Account" here means a smart account; ownership is enforced by the account contract, not by the RPC. A wallet should verify the hierarchy rather than trust the app's claim.
- The spec frames the universal wallet's access as a safety net for funds in app accounts, but it also widens what the main wallet can sign for, so wallets should show clear prompts.
- Account and capability data shared over this API should be protected against leaks and man-in-the-middle tampering.