moonbeam icon indicating copy to clipboard operation
moonbeam copied to clipboard

Why does the util "moonkey" generate addresses with derivation path "m/44'/60'/0'/0/0" using "ethereum" as it's "coin_type"?

Open julian-payne opened this issue 1 year ago • 4 comments

Shouldn't "coin_type" be "1284" as registered in SLIP-0044, hence the derivation path be "m/44'/1284'/0'/0/0"?

Or is this necessary for full compatibility with ethereum addresses on moonbeam?

I'd like to understand the reasoning behind it.

Thanks.

julian-payne avatar Jul 26 '24 01:07 julian-payne

The moonkey binary is not used anymore. moonbeam key is replacing it.

crystalin avatar Dec 05 '24 16:12 crystalin

Concerning the derivation path, you are correct: https://github.com/moonbeam-foundation/moonbeam/blob/50a92ddd1e609247f22e6868455602199af446c7/node/cli-opt/src/account_key.rs#L56 It uses Ethereum one but should have been using Moonbeam specific one.

I think if we want to fix this @RomarQ , we would have to print both to ensure legacy support for those using existing mnemonic into private key. Ideally we should keep the same generate-account-key (adding a warning message) and provide a generate-moonbeam-key using the correct derivation path

crystalin avatar Dec 05 '24 16:12 crystalin

Agree, we could simply update the output of the command to print a disclaimer informing that old versions of this command used Ether coin_type.

Something like:

Address:      0x...
Mnemonic:     like ...
Private Key:  0x...
Path:         m/44'/1284'/0'/0/0


⚠️ (Deprecated) Legacy derivation path ⚠️

Old versions of this tool, used `Ether` as coin_type.

Address:      0x...
Mnemonic:     like ...
Private Key:  0x...
Path:         m/44'/60'/0'/0/0

If really necessary, we could create a new command that uses the correct coin_type and deprecate the current one.

RomarQ avatar Dec 07 '24 14:12 RomarQ

Added a new command generate-moonbeam-key. https://github.com/moonbeam-foundation/moonbeam/pull/3090

The old command generate-account-key now prints a warning: image

RomarQ avatar Dec 07 '24 15:12 RomarQ

Hi @julian-payne,

For future reference, in the upcoming client version 0.47.0, you will be able to do the following:

# Generate a Moonbeam key (default)
moonbeam key generate-moonbeam-key --network moonbeam

# Generate a Moonriver key
moonbeam key generate-moonbeam-key --network moonriver

# Generate a Moonbase alpha key
moonbeam key generate-moonbeam-key --network moonbase

# Generate an Ethereum-compatible key
moonbeam key generate-moonbeam-key --network ethereum

RomarQ avatar Aug 14 '25 11:08 RomarQ