EIPs Explained

ERC-2334 · Review · ERC · 2019-09-30

ERC-2334: BLS12-381 Deterministic Account Hierarchy

Defines the derivation paths for BLS12-381 keys, such as m/12381/3600/i/0/0 for a validator's signing key, so every staking tool derives the same keys from the same seed.

What problem does it solve?

Beacon chain validators sign with BLS signatures over the BLS12-381 curve, not with the secp256k1 keys used for ordinary Ethereum accounts. ERC-2333 defines how to derive a tree of BLS keys from one seed, but a tree alone is not enough: every wallet, deposit tool and validator client must also agree on which branch of the tree holds which key. Otherwise the same mnemonic would produce different keys in different tools, and a user restoring from backup could not find their validator.

The existing Bitcoin-style path standards (BIP32/BIP44) do not fit. ERC-2333 uses its own key derivation function, uses only hardened keys and allows more keys per level, so a new path scheme is needed.

How it works

A path is a list of integer indices separated by /, starting from the master node m. At least four levels below the master must be used:

m / purpose / coin_type / account / use
Level Meaning
purpose Always 12381 (named after the curve). Only valid if ERC-2333 is the key derivation function.
coin_type Separates keys for different chains. Ethereum's BLS keys use 3600 (60², a nod to Ethereum's secp256k1 coin type 60).
account Lets one user keep distinct sets of keys for different purposes.
use Related but separate keys within an account; often 0.

For beacon chain validators the standard fixes two keys per validator i:

  • Withdrawal key: m/12381/3600/i/0
  • Signing key: m/12381/3600/i/0/0, the 0th child of the withdrawal key.

The signing key is a "hot" key handed to the validator client; if it leaks, the worst case is a slashable message. The withdrawal key controls the staked funds and should stay "cold". Because the signing key is a child of the withdrawal key, safely storing the withdrawal key (or the seed) is enough to recover the signing key.

Since every ERC-2333 derivation is hardened, the ' hardened marker used in BIP44 paths is not used and is invalid here.

Sample code

Generating the paths for the first few validators (TypeScript):

const PURPOSE = 12381;
const COIN_TYPE = 3600; // Ethereum BLS keys

function withdrawalPath(i: number): string {
  return `m/${PURPOSE}/${COIN_TYPE}/${i}/0`;
}

function signingPath(i: number): string {
  return `${withdrawalPath(i)}/0`; // child 0 of the withdrawal key
}

for (let i = 0; i < 3; i++) {
  console.log(i, withdrawalPath(i), signingPath(i));
}
// 0 m/12381/3600/0/0 m/12381/3600/0/0/0
// 1 m/12381/3600/1/0 m/12381/3600/1/0/0
// 2 m/12381/3600/2/0 m/12381/3600/2/0/0

Each path is then fed to an ERC-2333 derivation routine together with the seed to obtain the actual secret key.

Things to know

  • Status is Review: the document is still open for changes, even though staking tooling already relies on these paths.
  • It is one of a trio: ERC-2333 (key derivation), this ERC (paths) and ERC-2335 (encrypted keystore files).
  • Custodial or secret-shared setups may not be able to follow the paths exactly; the spec allows affected keys to be derived another way, but asks implementations to follow it as far as is reasonable.
  • These keys are unrelated to your regular wallet address: the same mnemonic run through BIP44 (m/44'/60'/…) yields completely different secp256k1 keys.

#bls #keys #wallet #staking #validator

Details

Authors
Carl Beekhuizen (@CarlBeek) <[email protected]>
Status
Review
Type
Standards Track / ERC
Created
2019-09-30
Requires
Required by

Machine-readable: Markdown · JSON