Extracting Polkadot (DOT) private keys from Trust Wallet (Step-by-step guide)

Do repost and rate:

 

 

Unsplash

 

Trust Wallet is gaining quite a bit of traction as a mobile hot wallet and for the most part it does a pretty good job on BINANCE Smart Chain, but it isn't so hot at other chains like Polkadot apart from just storing your coins. However, the derivation of keys for Polkadot doesn't appear to be standard and so if you are looking to extract your private keys (or import your Polkadot account to Polkadot.js), you will quickly find that the seed phrase that derives all the HD public/private keypairs is not useful at all... as the path for derivation will give you the wrong keypair.

Documentation for fixing this for yourself is pretty threadbare at best. There is a single developer page, but that is completely opaque for most people. So, I've braved the hellfire of unclear expert instructions and I've distilled this step-by-step guide for non-technical people. Actually, I did this because I needed to get Polkadot.js up and running with the right account for the Genshiro (GENS) launch on Kusama testnet, but I had used the Trust Wallet address for the Equilibrium (EQ) on the Polkadot mainnet... that's what you get for being lazy and using a multi-wallet on a phone.

You will need:

A Windows laptop (there are linux and apple versions, but I figure that people using those OS types should know what they are doing).

Docker (A software virtualisation platform, free account).

Internet connection

Contents

  1. Getting Set-up
  2. Extracting the Private Key
  3. Exporting to Polkadot Apps
  4. Importing JSON file to Polkadot.js
  5. Conclusion (aka: TIP ME!)

Getting Set-up

 

 

You will need to download and install the Docker desktop application for Windows. While you are there, make a free account, you will need it later!

 

 

After installation, you will likely need to update the WSL2 Linux kernel for Windows. Launching docker will point you to the WSL2 download from Microsoft. Install WSL2 and reboot the computer.

 

 

From here, you will need to know how to bring up the Windows Powershell. Click on your Windows start menu (bottom left corner!... or press the Windows button on your keyboard if there is one!). Start typing "Powershell", and you will see the the Windows Powershell in the search selections. This is what you will need to click on in order to launch a Powershell window later.

 

 

Go back to the Docker website on your browser. If you made a free account before, you can go to the Docker Hub and search the community images. Search for "Trust Wallet", and you will see the trustwallet/wallet-core image. Click on that one.

 

 

You will need the Docker Pull command from the Trust wallet wallet-core page, you can just copy the command using the copy button.

Open a Powershell window (remember that?), and past the pull command that just copied... and let docker do its work! It will pull all the wallet-core packages to your computer. PS: You need to be internet connected!

Extracting the Private Key

 

 

From the Trust Wallet developer pages, you can see that you can run the wallet-core inside the Docker image instead of building it and running it directly on your OS. Well, for Windows, I don't think we have a choice!

 

 

Run Docker. If your pull command worked earlier, you will now see the wallet-core image when you select the Images tab on the left.

 

 

Start a Powershell (remember?).

 

 

... it should look a bit like this!

 

 

From the Trust Wallet developer pages, you will need this docker command (the bottom one) to start the wallet-core. Again, you can just copy and paste it into the Powershell... or type it if you feel like doing that!

This will start the console for wallet-core.

If you scroll just a little bit further down on the developer page, you will see the commands for the console. Something that is really handy to have in an open browser next the the PowerShell!

 

 

So, these are the specific steps for extracting your DOT private key:

  1. start the wallet console (previous step).
  2. input your Trust Wallet seed phrase with the "setMnemonic" command (I used "newMnemonic" as I didn't want to expose my own seed in this example!).
  3. "coin dot". This sets the derivation path for Polkadot (DOT)
  4. "priDP". Dumps the private key.
  5. copy the private key, you will need it for the next stages!

Exporting to Polkadot Apps

 

 

Now that we have the private key, we can't directly import it into Polkadot.js yet. We need to use Polkadot apps to get a form that Polkadot.js will be happy importing.

Go to Polkadot.js.org with your Web Browser.

Click on the "Add Account".

Change the option to "Raw seed", paste in the private key from earlier! You will need to manually add in the 0x at the start (zero-x).

In the advanced creation options, select Edwards (ed25519, alternative).

The address at the top SHOULD now match your Polkdot address on Trust Wallet!

You will be prompted through the rest of the creation. You will need to create a password, you WILL NEED THIS FOR THE EXPORT AND IMPORT! REMEMBER IT!

 

 

On the account menu, select "Create a backup file...". This will create a .json backup file for your account.

 

 

Follow the prompts and then download the .json file. REMEMBER THE PASSWORD!

Importing JSON file to Polkadot.js

 

 

Finally... the easy bit!

From Polkadot.js (I assume that you already know how to install and use this, this wasn't the hard part!), Restore an account from backup JSON file... select the JSON backup that you just downloaded and decrypt with the password.

DONE DONE DONE!

Conclusion

Well... that is a bit of a poop to have to get something that should be much easier to get to! If this has been a help to you, feel free to drop me a tip or five at:

https://cointr.ee/bengy

Handy Crypto Tools

Ledger Nano S/X: Keep your crypto safe and offline with the leading hardware wallet provider. Not your keys, not your crypto!

Binance: My first choice of centralised exchange, featuring a wide variety of crypto and savings products.

Kucoin: My second choice in exchanges, many tokens listed here that you can't get on Binance!

Coinbase: If you need a regulated and safe environment to trade, this is the first exchange for most newcomers!

Crypto.com: Mixed feelings, but they have the BEST looking VISA debit card in existence! Seriously, it is beautiful!

CoinList: Access to early investor and crowdsale of vetted and reserached projects.

Cointracking: Automated or manual tracking of crypto for accounting and taxation reports.

Cointr.ee

Ledger Nano S - The secure hardware wallet

Regulation and Society adoption

Ждем новостей

Нет новых страниц

Следующая новость