I have created keypairs for aura and grandpa and added it into customSpec file but i need to add ethereum address in customSpec file to fund it with some amount of ethereum. So, i have generated ethereum address using same SS58 address 5GnfRXtp45X48ehgSZcLf5ERwsjb8hGmUu4UePEEHTgsXhgv
which is derived from this private key 0x093c6aee6ea168a659f68d2d94d932e65c825b24b3784a38a5de7c4d6cbc1f18
.Then,with help of frontier node utility tool i tried to generate ethereum address with the help of same SS58 key i.e. 5GnfRXtp45X48ehgSZcLf5ERwsjb8hGmUu4UePEEHTgsXhgv
and i got 0x9f370f00490b86f426f58fce00f921e41b278e9a
this ethereum address but, when i am importing this in metamask whith this 0x093c6aee6ea168a659f68d2d94d932e65c825b24b3784a38a5de7c4d6cbc1f18
private key, my metamask is showing different address (0x2eefCaf4FF8723678CC02EE97bE3382c4DD66542
).
1 Answer
Because the generations follow different paths.
Check Derived H160 address is different than showing in metamask?.
https://github.com/paritytech/frontier/blob/88f3e7741cd2039b4d2a90f1b852a183861b6e18/frame/evm/src/lib.rs#L623-L626 https://github.com/paritytech/frontier/blob/88f3e7741cd2039b4d2a90f1b852a183861b6e18/template/utils/evm-address.js#L18
return `0x${crypto.blake2AsHex(crypto.decodeAddress(address), 256).substring(26)}`;
It just simply hashes the Substrate public key and truncates the result. The final result is your derived address.
It's totally different than you use that private key as a seed to generate an account in Metamask.