ERC-1581 · Stagnant · ERC · 2018-11-13
ERC-1581: Non-wallet usage of keys derived from BIP-32 trees
Reserves a BIP-32 derivation branch, m/43'/60'/1581', for keys that are not wallet keys (messaging, encryption, identity), so apps can derive them from the same seed without reusing wallet keys.
What problem does it solve?
Apps often need extra key pairs alongside a wallet: for chat encryption, signing off-chain messages, or identity in some side protocol. There are two bad options:
- Reuse wallet keys. Using a key that holds funds for unrelated cryptography increases risk if that other system leaks or misuses it.
- Use separate, random keys. Safer, but now the user has more secrets to back up and migrate.
ERC-1581 gives a third option: derive the extra keys from the same BIP-32 master seed, but on a separate branch that never overlaps BIP-44 wallet paths. One backup covers everything, while the keys stay cryptographically independent.
How it works
The derivation path has five levels:
m / purpose' / coin_type' / subpurpose' / key_type' / key_index
purpose' / coin_type' / subpurpose'is fixed at43' / 60' / 1581': BIP-43, Ethereum, this EIP. Everything under this prefix is in scope.key_type'(hardened) says what the key is for. Types should be generic, e.g. "instant messaging" rather than one specific product, so the same identity works across services.key_indexidentifies the specific key. In the simple case it is a number0to2^31-1. Larger IDs (a hash or GUID) are split into 31-bit chunks across several levels, most significant first; all levels except the last are hardened, and the last uses normal (public) derivation.
The spec's example: key type 4' with a 62-bit ID 0x2BCDEFFEDCBAABCD becomes m/43'/60'/1581'/4'/1469833213'/1555737549.
Sample code
Deriving a non-wallet key on this branch with ethers v6:
import { HDNodeWallet, Mnemonic } from "ethers";
const mnemonic = Mnemonic.fromPhrase(process.env.MNEMONIC!);
const root = HDNodeWallet.fromSeed(mnemonic.computeSeed());
// key_type 4', key_index 0 (last level non-hardened, as the spec requires)
const chatKey = root.derivePath("m/43'/60'/1581'/4'/0");
console.log(chatKey.publicKey); // share this with the messaging service
// chatKey.privateKey stays in the app; it is NOT one of the user's wallet accounts
Things to know
- Status is Stagnant. The registry of
key_typevalues was never defined in the spec (it says "TBD"), so apps must agree on type numbers themselves. - These keys are ordinary secp256k1 keys. Nothing stops someone sending funds to the derived address, but wallets following BIP-44 (
m/44'/60'/...) will not show it. - Any app that can derive these keys holds the master seed, so this improves key separation, not seed security.