ERC-1775 · Stagnant · ERC · 2019-02-20
ERC-1775: App Keys, application specific wallet accounts
Proposes per-application wallet keys derived deterministically from the user's account and the app's origin, so apps get isolated, restorable keys they can use without exposing the user's main funds.
What problem does it solve?
Wallets typically give every dapp the same main account. That account holds most of the user's funds, so every signature needs careful manual confirmation, and using one address everywhere links the user's activity across apps.
Some applications, such as state channels, privacy systems and games, need to sign many messages, sometimes automatically, or sign transactions without broadcasting them. ERC-1775 proposes app keys: separate keys that a wallet derives for each application. They can be handled with looser confirmation rules while main accounts stay protected, and they can always be regenerated from the user's seed.
How it works
- App identity: each application is identified by its origin, a domain string (DNS name today; ENS names or content hashes are discussed as future options).
- Derivation: the wallet computes
appKeyPrivKey = keccak256(privKey + originString)whereprivKeyis the private key of the account the user selected and+is concatenation. The same account and origin always give the same key, so nothing extra needs backing up. - Personas: choosing a different base account produces a completely different set of app keys, e.g. a personal and a business identity for the same app from one mnemonic, which the app cannot link.
- RPC: the app requests its key through a wallet method,
wallet_getAppKeyForAccount. Permissions for what the app may do with it were intended to use the EIP-2255 permission model. - An app key is a single private key, not a BIP-32 node, but an app can use it as entropy to build its own HD tree.
Sample code
Derivation as described in the spec (TypeScript with ethers v6, illustrative only):
import { keccak256, concat, toUtf8Bytes, Wallet } from "ethers";
function deriveAppKey(accountPrivKey: string, origin: string): Wallet {
// keccak256(privKey ++ originString)
const appPriv = keccak256(concat([accountPrivKey, toUtf8Bytes(origin)]));
return new Wallet(appPriv);
}
// A dapp asking the wallet for its key (method name from the spec):
const appKey = await window.ethereum.request({
method: "wallet_getAppKeyForAccount",
params: [selectedAddress],
});
Things to know
- Status: Stagnant. Wallet support was experimental (an early MetaMask prototype is linked from the spec) and the RPC method is not a widely available standard.
- The spec does not pin down the exact byte encoding of
privKey + originString; implementations must agree on it to stay compatible. - If an app key needs ETH for gas, funding it from a main account links the two and weakens the privacy benefit.
- Handing raw private keys to web pages is risky; treat any app key as exposed to the app that received it.