0

I accidentally sent Wanchain tokens from Binance to an ethereum address. The ETH address it was sent to was created by my Trezor device. I have the 24 mnemonic for the Trezor. I need to import the private key derived from the mnemonic into Wanchain.

What I tried so far:

  1. I first converted the 24 mnemonic into a private key using the Mnemonic Code Converter web app. https://iancoleman.io/bip39/
  2. I then imported it into Geth.
  3. I opened Mist and backed up the account imported by Geth and got the keystore JSON.
  4. I tried to import this keystore into WanchainGui but it says it doesn't recognize the file.

I need to convert the keystore given from Geth to one that Wanchain can use.

1
  • This question does not appear to be about programming within the scope defined in the help center
    – Ryan M
    Jun 2, 2022 at 16:46

1 Answer 1

2

About a month ago I accidentally sent all my Wanchain from an exchange to my Etherum address! I was in distress and this seems to be a common concern for many people.

But today I did it! I finally recovered all my Wanchain! It was not easy. I am a software engineer and it took a lot of my knowledge and a handy web tool to get them back. So without further ado here are the exact steps to recover your Wanchain:

Part 1 - Get your Ethereum Keystore File

*You can skip part 1 if you already have your Ethereum Keystore File

From My MetaMask Option

*If you use a MetaMask you must follow these steps AND the "From Private Key Option" steps below

  1. Click on the MetaMask on the top-right of Chrome
  2. Type in password to unlock
  3. Click on the 3 dots next to your account's name
  4. Click export private key
  5. Type in your password again
  6. Click submit
  7. Copy your private key

From Mnemonic (Trezor/Leger users do this first!) Option

*If you use a Trezor/Ledger/Hardware Wallet you will need to follow these steps AND the "From Private Key Option" steps below

  1. It is HIGHLY recommended that you transfer ALL other funds from ALL other cryptos off of your hardware wallet before following these steps.
  2. Download the Bip39 tool here: https://github.com/iancoleman/bip39/archive/master.zip (alternatively you can just go here, but it's less secure: https://iancoleman.io/bip39/)
  3. Unzip all the files
  4. Run bip39-standalone.html from the unzipped folder
  5. Type your 12-24 word Mnemonic given to you when you setup your Hardware Wallet into the BIP 39 Mnemonic input (If you don't have this you cannot recover your Wanchain)
  6. If you setup a passphrase for your Hardware Wallet (not your PIN code but an actual password) type it into BIP 39 Passphrase (optional) input. (If you don't have this and set one up originally with your hardware wallet you cannot recover your Wanchain)
  7. Change the "Coin" drop-down menu to Ethereum
  8. Scroll to the very bottom of the page and you should now see your Ethereum public key and private key for your specific Ethereum address that you accidentally sent your Wanchain to under "Derived Addresses". *If you do NOT see your address here then you did NOT follow the steps correctly
  9. Copy the private key on the right-hand side for your specific Etherem address that you accidentally sent your Wanchain to. This is under "Derived Addresses" Do NOT use any other private key on the page.

From Private Key Option

*These steps are outlined for Windows

(This part of the guide was found using part of this guide: https://ethereum.stackexchange.com/questions/110/how-to-mine-ether-and-use-ethereum-on-windows and part of this guide https://ethereum.stackexchange.com/questions/465/how-to-import-a-plain-private-key-into-geth-or-mist)

  1. Download Geth from here: https://geth.ethereum.org/downloads/
  2. Unzip Geth to C:\Geth (or any directory you will remember)
  3. Search for cmd (on Windows), Right-Click, Run As Administrator
  4. Open Notepad
  5. Paste your Ethereum private key into the notepad without any extra characters or quotations.
  6. Make sure you don't have a "0x" at the beginning of the private key. If you do, delete the "0x" off the start of the private key and save the file.
  7. Save the file as nothing_special_delete_me.txt at C:\Geth
  8. Open a command prompt (windows)
  9. Run the command: cd c:\Geth
  10. Run the command: geth account import C:\Geth\nothing_special_delete_me.txt
  11. After successful import, delete the file at C:\Geth\nothing_special_delete_me.txt
  12. Your file will be saved at, replace "UserName" with your computer's actual logged in user name: C:\Users\UserName\AppData\Roaming\Ethereum\keystore

Part 2 - Recovering Your Wanchain

And now what you've been waiting for. Follow these steps to recover your Wanchain from your Ethereum Keystore File.

Part 2A - Setup a Wanchain Wallet with WanWalletGui

*If you already have a Wanchain wallet setup and know your public key, private key, and password for that wallet you can skip Part 2A

We need somewhere to send the Wanchain when we recover it. Follow these steps to setup an address to use on the Wanchain network. You cannot keep using the Ethereum address you sent your Wanchain to on accident after recovery. Just bear with me.

  1. Download WanWalletGui from here: https://wanchain.org/product
  2. Click on the logo of your operating system to download the WanWalletGui
  3. Accept the User Agreement
  4. Unzip all the files
  5. Run WanWalletGui.exe
  6. Click Launch Application from the pop-up
  7. Click the "Account" button on the top-right
  8. Type in any account name you want and your new password twice
  9. Click "OK"
  10. Save the "Public Key" displayed for your account somewhere
  11. Close the program. Make sure to actually close the program as it will interfere later on.

Part 2B - Get the Gwan Tool Up and Running

This is Wanchain's version of Geth, it's called Gwan (get it, G"Wanchain"). You will need this to submit the recovery transaction since the WanWalletGui.exe can't submit it for us.

  1. Download the Gwan tool from Wanchain's Github via the zipped archive. The latest release at the time of writing is 1.0.4. You can download from this link:
    https://github.com/wanchain/go-wanchain/releases/download/v1.0.4/gwan-windows-amd64-1.0.4-b7ce29ea.zip
  2. Unzip the Gwan.exe file from the zip
  3. Open a command prompt (or equivalent if not on Windows)
  4. Go to the directory that you unzipped Gwan to (cd command on Windows)
  5. Run this command: gwan --rpc --rpcapi=web3,eth,personal --rpcport "8545" --rpcaddr "127.0.0.1" --rpccorsdomain "127.0.0.1"
  6. Leave the command prompt up and running until all remaining steps in all parts are finished. If you close the command prompt you cannot submit the recovery transaction. This is actively listening on your computer.

Part 2C - Install Node

*If you already have Node.Js & NPM installed AND updated you can skip Part 2C

  1. Download Node here for the right OS/bit version: https://nodejs.org/en/download/
  2. Run the installer (On Windows it's a .msi file)
  3. Go through the install process using the defaults and click finish

Part 2D - Use the Wanchain-Raw-Tx tool to submit your recovery transaction

This is it! The final part! You're soo close if you made it this far!

  1. Download the Wanchain-Raw-Tx zip directory here: https://github.com/ssc806/wanchain-raw-tx/archive/master.zip
  2. Unzip all the files
  3. Open another command prompt (or equivalent) and go to the unzipped directory
  4. Type this command: npm install
  5. You may get ERR's in red. That's fine, ignore them.
  6. After the prior command completes leave the command prompt open and also open "config.js". Make all changes to the file after each line's colon. Leave quotes when you see them around the examples. You will need to edit the config.js file as follows:
  7. Change the first line to: datadir : '/'
  8. Change fromAddr to the Ethereum address you accidentally sent your wanchain to
  9. Change the passphrase to the password you setup for your Ethereum Keystore File
  10. Change the chainId to 0x01 (no quotes)
  11. Change the toAddr to the new Wanchain address you setup in "Part 2A"
  12. Change the sendAmount to be the amount of wanchain you want to transfer and then leave the * 1e18 at the end so 50 Wanchain = 50 * 1e18 (no quotes or spaces). Make sure to not transfer everything, leave .01 Wanchain for the transfer fee.
  13. Save the file, it should now look something like this:

    module.exports = {
        datadir : '/',  // The datadir path of the Ethereum 
        fromAddr : '0xaaa',  // Ethereum address which hold the Wancoin
        passphrase : 'password',  // The passphrase for the Ethereum keystore of the above address
        chainId : 0x01, // 0x01 - Wanchain Mainnet,  0x03 - Wanchain Testnet
        toAddr : '0xbbb',  // Wanchain address, make sure have the correct Wanchain keystore for this address
        sendAmount : 1000*1e18, // 1000 Wan. Don't send all the wancoin, need to keep about 0.005 Wan as the tx fee
        gasPrice : 200*1e9, // 200 GWin
        gasLimit : 47000
    }   
    
  14. Open your C:\ (or main directory)

  15. Create a folder, name it "keystore"
  16. Copy and paste your Ethereum Keystore File into this directory. You must put it in this EXACT location.
  17. Go back to your command prompt that you last used to do the command "npm install"
  18. Type this command: node index.js (if that doesn't work try: node index)
  19. If all went well you should now see your TxHash of the completed transaction.
  20. Wait 5-10 minutes
  21. Close the command prompt running Gwan
  22. Open WanWalletGui.exe
  23. Your funds should now be displayed there!!
0

Not the answer you're looking for? Browse other questions tagged or ask your own question.