ChorusOne / eth-staking-smith

Ethereum 2.0 deposit CLI / library
Apache License 2.0
19 stars 6 forks source link

add seed index param for regenerating keys #15

Closed jenpaff closed 1 year ago

jenpaff commented 1 year ago

When generating keys with an existing mnemonic, it's important to specify the seed index of the given key that is being regenerated. This is such that we can stay aligned with the EIP-2334 format (see: https://eips.ethereum.org/EIPS/eip-2334), the seed index represents the account which is necessary to derive the withdrawal and signing keys.

We add a parameter such that a user can specify the start index from which the keys should be generated

see implementation in staking-deposit-cli

# Set path as EIP-2334 format
# https://eips.ethereum.org/EIPS/eip-2334
purpose = '12381'
coin_type = '3600'
account = str(index)
withdrawal_key_path = f'm/{purpose}/{coin_type}/{account}/0'
self.signing_key_path = f'{withdrawal_key_path}/0'

Tasks: