Creating ETH2 wallet from ETH1 seed?
Looking for opinions to decrease complexity going forward.
As I already have a (imo) decent, tested recovery procedure in place for my wallet's seed phrases, I'm inclined to derive my ETH2 staking wallet from the same seed.
Why would this work, why not, what are the risks I'm not accounting for?
Posted Aug 28, 2020, 7:49 AM UTC
1315
You can't without going through hoops.
The internal process of generating a key is the following:
Alternatively, usually the input keying material goes through a process called Lamport key generation to create an "infinite" amount of secret keys from a single master key (see EIP2333 for ETH2 keygen - https://eips.ethereum.org/EIPS/eip-2333).
Now not all hope is lost. What can be done is using your Eth1 secret key as the input-keying material to generate your Eth2 secret keys, since IKM can be any (large) size, i.e. plug it in the
IKM_to_lamport_SKmentioned in EIP2333.In terms of risk, it's all deterministic and specified so it's mostly what you use to transform your seed into raw bytes and then feed those raw bytes into an implementation of EIP2333. Like always, ensure it's done on a safe box, disconnect from the web, etc.
In terms of software to ease that, I'm not sure they exist yet though all ETH2 teams have implemented the ETH2 keygen, the ETH1 secret keys -> raw bytes part is likely missing (but it shouldn't that big of a work either since it's necessary for internal operations and testing of Geth/Parity/Trinity/Bitcoin so at best it exists somewhere and at worst you need to expose that internal detail).
And if someone wants a weekend project, the reference implementation of EIP2333 is here:
Although all of this is correct, it is perfectly possible to use the same seed phrase for both Ethereum 1 and Ethereum 2 wallets.
When creating an Ethereum 2 wallet, most software allows you to specify the seed phrase, or mnemonic, which is used to generate the master key. For example if you wanted to use
ethdoto create an HD wallet based on a given mnemonic you can do so with the--mnemonicoption. You could also append a "25th word" to the mnemonic if you want, so that even if someone did obtain your seed phrase they couldn't use it without the additional information.Do you have a link to the Eth2 wallets you mention?
ethdo is at https://github.com/wealdtech/ethdo
The other wallets are those that come with the validator clients.
Thanks for the high quality post.
This means that the 24 seed word in ETH1 has about 2x possible combination than ETH2
Does this also mean that the seed phrase for ETH2 will always be 24 words, instead of 12 words in ETH1? That 24 words will provide as much possible combination as 12 words in ETH1 to achieve the same level of security?
Unfortunately I have yet to check/implement ETH1 key generation or mnemonic for ETH2 so can't comment on the internals but on ETH1 I've seen the following key length
12 words for a "simple" secret key (Metamask)
24 words for a master key (Ledger)
I'm unsure how that translates to ETH as it seems there is no EIP standard (see https://github.com/ethereum/EIPs/issues/84 and https://eips.ethereum.org/EIPS/eip-1581 and also Ledger fiasco when they changed Ethereum key derivation.)
I suspect the 24 words mnemonic is because the BIP32 keys are generated from HMAC-SHA512 (512 bits = 64 bytes which is 2x 32 bytes, the actual secret key sizes for both ETH1 and ETH2)
I also read that the security of eth1 & 2 are the same, i.e. key sizes are the same
But from an outsider just looking at the numbers 2^256 and 2^255 it seems that eth1 provides more possible numbers, hence higher security. Can't get my head around this
Disclaimer: I'm a crypto implementer not a cryptographer or cryptanalyst so while I understand probably better than users, a lot still eludes me.
Due to the birthday paradox, keys are likely to collide once we reach the square root of input length and this is what we use to estimate secret key security. sqrt(2^256) = 2^128, while sqrt(2^255) = 2^127.5 , hence ETH1 keys have 128 bits as "security level" while ETH2 has 127.5. The loss of 0.5 bits is considered a good tradeoff for the benefits the BLS12-381 curve brings, in particular signature aggregation, which allow stuffing all validator signatures in a single Signature (48 bytes instead of say 128*48 bytes as we can have 128 attesters per block)
Note, this is also different from elliptic curve security (ECDLP: Elliptic Curve Discrete Logarithm Problem) as this one depends on finding the secret key from the public key. This is ultimately protected by the length of the prime, and in ETH2 we have 381 bits while ETH1 only has 256 bits.
In short,