Solnet icon indicating copy to clipboard operation
Solnet copied to clipboard

Import Exodus wallet

Open imclint21 opened this issue 4 years ago • 5 comments

Hi,

Wanted to use exodus private key but I get a base58 error, so I tried to encode as base58 but still not able to send any transactions...

Thanks

imclint21 avatar Aug 13 '21 14:08 imclint21

Hey, thanks for reporting this. How were you importing this private key? I'd like to attempt replicating this.

hoakbuilds avatar Aug 13 '21 14:08 hoakbuilds

I attempted to replicate this and I see many things wrong but they don't seem like they're on our end.

When going to view private keys, exodus is showing me a base58 public key and a hex private key, which when decoded is only 32 bytes, this is an invalid size. Exodus is showing, for some reason, the m/0/0 derivation path, which seems wrong.

var account = new Account(PrivateKey, PublicKey);

I attempted initializing the Account by passing both strings like above and it didn't throw an error, I could try to mitigate this by attempting to decode strings from Base58 and throwing an error if they're not valid Base58 or invalid length when they somehow pass Base58 checks, but this is going to be hazardous given the fact we had to do lazy initialization of the encoded/decoded values to mitigate heavy performance hits when attempting to decode certain data structures (Serum, for example).

It was when I attempted crafting and signing a transaction that stuff blew up because the private key they're giving out there doesn't seem that valid to me, and I can't seem to be able to replicate a derivation path which generates the same public keys as theirs.

I need more context before I decide if I'm going to attempt "fixing" this.

Edit: I've gotten in touch with Exodus to see exactly how we can work this out.

hoakbuilds avatar Aug 13 '21 15:08 hoakbuilds

Okey thank you for your complete review, yes it seem like exodus give not so accurate informations and derivation path looks totally weird.

imclint21 avatar Aug 13 '21 18:08 imclint21

Update

I successfully imported the private key on trustwallet

imclint21 avatar Aug 15 '21 08:08 imclint21

Hey @murlokito I get update from exodus:

To answer your question Clint, (in case you hadn't already figured this out on your own) Exodus uses the m/44'/501'/0' derivation path with a BIP39 Mnemonic for the seed.

So m/44'/501'/0' is the derivation path and then we derive m/0/0 to get the addresses.

This would look something like this:

------------------------------------------------------------------------------

const seed = bip39.mnemonicToSeedSync(mnemonic)

const path = `m/44'/501'/0'` // SOL bip44
const hdwallet = hdkey.fromMasterSeed(seed)
const wallet = hdwallet.derive(path)

const solWallet = wallet.derive('m/0/0')
const privateKey = solWallet.privateKey.toString('hex')

-----------------------------------------------------------------------------

As Exodus uses a different algorithm than Phantom, the same private key generates different addresses.

imclint21 avatar Aug 17 '21 10:08 imclint21