Nano Guide: Restore Nano from a Ledger Recovery Phrase

This guide will take you through the steps required to recover Nano that you can no longer access in your Ledger Nano hardware wallet. It’s intended to be used only as a very last resort if no other options are available and getting a new device for recovery is out of scope.

As you might have heard, you can always recover your Nano in any compatible wallet as long as you have your seed. The seed is normally used to derive private keys, which allows you to manage your Nano in another wallet.

However, a hardware wallet keeps the private keys secured inside the device to maximize security. It also does not provide you with a seed. If you lose your device, you can use the recovery phrase (mnemonic) in another one to recover all the private keys.

But what if you don’t have another device? Rather than buying a new one, you can derive/extract the private keys and transfer the funds, and that is what this guide is all about. It’s just a little bit more complicated, and security must be taken into consideration. If you expose the recovery phrase anywhere, you should never use it again. After this process, you will need to generate a new recovery phrase or never use your Ledger again.

The main reason to use a hardware wallet is to never expose the private keys in any other electronic device.

Two different options will be presented below, depending on your paranoia level. Both options, but especially the second method, will be improved/edited over time as new tools for offline signing are developed.


Easy Method with Online Signing

You will extract the keys in an offline computer and automatically transfer any funds to your existing Natrium mobile wallet. For maximum security, make sure to use a safe OS environment (computer free from malware).

  1. Linux (Ubuntu):
    Install Go by following this guide exactly
    Windows or Mac:
    Download and install the Go MSI or PKG
  2. In a Linux terminal or Windows command prompt type go version to verify the Go installation.
  3. Install the bip39 tool:
go get github.com/roosmaa/nano-bip39-demo
go install github.com/roosmaa/nano-bip39-demo

4. Keys need to be transferred to mobile phone later on, and the recommended way is by QR code or Audio. Download this offline QR generator as a ZIP or use the offline audio messenger (also downloadable as zip from github).

5. Unplug from the internet for increased security.

6. Replace the code below with your recovery phrase and run it in a terminal or command prompt. Extract as many private keys as you have accounts in the Ledger by changing the last number. “44'/165'/1'” for account number 2, “44'/165'/2'” for account number 3, etc. Leave the password blank.

nano-bip39-demo -mnemonic "edge defense waste choose enrich upon flee junk siren film clown finish luggage leader kid quick brick print evidence swap drill paddle truly occur" -password "" -path "44'/165'/0'"

7. Optionally check each Nano account, in a block explorer (in an online computer), if it has the expected balance and store the private key somewhere temporary in the offline computer or paste directly into next step. Do not connect to the internet. I recommend using the offline QR generator from step 4 and scanning the account addresses with a mobile phone to be checked (not the private keys!).

Key extraction demo

8. Open src/qr-generator.html from step 4 in a browser and paste the private key to generate a QR. This way, you don’t expose the key in an email or USB drive.

9. Open your Natrium mobile wallet (set up with a new wallet if not already done so). Go to settings and “Load from paper wallet.” This will automatically sweep any funds left in the account corresponding to the private key, even if it has pending transactions! Funds will be transferred to your current wallet. Repeat for any account (private key) you had in the Ledger wallet.

Sweep private key from any funds

10. Never use the same private keys or recovery phrase again!


Advanced Method with Offline Signing

With this method, you will extract the keys in an offline computer the same way as the other method, but you will also sign any transaction offline to make sure the private key is minimally exposed. This is recommended if you have a larger balance in the Ledger and don’t want to sweep the full amount into a mobile phone light wallet.

  1. Do step 1,2,3 from the Easy Method
  2. Download this block hash page, this converter page and this offline QR generator as a ZIP. Also possible to use the offline audio messenger (also downloadable as zip from github).
  3. If you know the account(s) on your Ledger, find those in NanoCrawler. Otherwise, you need to extract the keys/addresses first (step 5–6 in Easy Method) before you continue.
  4. See the image below. From NanoCrawler, save the account address (1), the latest block hash in the chain (2), the representative (3) and the balance (4). If your computer is already offline from the previous step and you take those values from an online computer, you need to securely transfer them to the offline computer. For example, by using an empty USB drive, or utilize the offline QR generator/reader from step 2 and a webcam.
Important information to save from the account

5. Optional step: If there are any pending transactions that you want to recover, you’ll need to manually receive each one. In that case, save each pending block hash (5) and balance (6) as well, in the image below.

Important information to save from pending transactions

6. Unplug from the internet and do step 6 from the Easy Method.

7a. Now you will move your funds to another wallet account by first signing the transaction offline and later publish it to the Nano network using any online node or node API. If you had pending transactions in step 5, continue with this step. Otherwise, skip to step 8.

Offline block signing

7a. The picture above is from the hash page downloaded in step 2. Paste your saved values into this page. Use xrb_ as account prefix, nano_ is not yet supported.

  • Preamble: Don’t change. 63 zeroes and end with a 6
  • Account: Your account (1)
  • Previous block hash: The latest block hash you saved (latest received transaction, not pending) (2)
  • Representative: Use the one you saved (3)
  • Balance: The resulting balance you will get in your wallet after the transaction. Current balance + the pending balance for this transaction. In raw amount. Use the converter from step 2. (4+6)
  • Link: The pending account hash (5)
  • Private key: The key you extracted from the Ledger

You should now get a signature at the end of the page. Save this value.

7b. Continue with 9 and 10 before continuing with 8 because the balance and previous block hash will change as you receive transactions. If you need to process several pending, you need to update the latest block hash and balance for each iteration 7b-7c (for example via NanoCrawler). Try to avoid connecting to the internet, use a second computer.

8. You will create a send block with the full (or partial) transaction amount to send funds to a Nano wallet you own. Refer to the picture in step 7. Paste your saved values into the hash page you downloaded in step 2. Use xrb_ as account prefix, nano_ is not yet supported.

  • Preamble: Don’t change. Should end with a 6
  • Account: Your account (1)
  • Previous block hash: The latest block hash you saved (2)
  • Representative: Use the one you saved (3)
  • Balance: What you want to be left in the wallet after the transaction, for example, 0. In raw amount. Optionally use the converter from step 2 (4).
  • Link: The account where you want to send your Nano (triple check!)
  • Private key: The key you extracted from the Ledger

You should now get a signature at the end of the page. Save this value.

9. Copy the values of signature, previous block hash, representative, balance and link to an online computer running a Nano node in order to publish the transaction. Try to avoid taking the computer online and instead use an empty USB drive or the offline QR generator you downloaded in step 2. If you don’t run your own node, you can ask a friend or in the nanocurrency community for help as this signature can only transfer the funds to the wallet you have defined in the previous step. It cannot be altered and it cannot be used to get your private keys.

Signed blocks can’t be changed (e.g. destination account), as it would result in an invalid signature.
That’s the beauty of offline signing.

10. How to set up a Nano node is not covered in this guide. Please refer to nanolinks. You or the person behind the node will run RPC commands to publish the block.

10a. First, some proof of work needs to be computed with the previous block hash as the source (2):

curl -g -d '{ 
"action": "work_generate",
"hash": "DE663D484DA7659D53F95E7F70E72105E01DB8A833693CDD632446CFBDBE7DD5"
}' '[::1]:7076'
Example of generated work

10b. Then the block can be published with all the data you copied to the online computer in step 9 together with the generated work from step 10. Use the following convenient json block for node version 19 or later. Replace everything in bold:

curl -g -d '{ 
"action": "process",
"json_block": "true",
"block": {
"type": "state",
"account": "xrb_1kojnrrw8rtybqsqk5uh7bcioo8thkiqjkibmn43togd416gzfye6j44b9sc",
"previous": "DE663D484DA7659D53F95E7F70E72105E01DB8A833693CDD632446CFBDBE7DD5",
"representative": "xrb_1center16ci77qw5w69ww8sy4i4bfmgfhr81ydzpurm91cauj11jn6y3uc5y",
"balance": "0",
"link": "xrb_15kn1uzmkkh9si6j1fceycpu15dhb7kzi61fo8zykxj8z788hatu5frwfb3u",
"signature": "D91A4AA91ABB2DE7988837CE2D1B11116EC44517E3F0C219C65ACE83822555571FC327AE0AFAD561CC1582315CD655314D808169F34792AFD912B1F08F47820C",
"work": "8d958afca77002bf"
}
}' '[::1]:7076'

Or this block string for all nodes (including v19). Replace all bold:

curl -d '{ 
"action": "process",
"block": "{\n \"type\": \"state\",\n \"account\": \"xrb_1kojnrrw8rtybqsqk5uh7bcioo8thkiqjkibmn43togd416gzfye6j44b9sc\",\n \"previous\": \"DE663D484DA7659D53F95E7F70E72105E01DB8A833693CDD632446CFBDBE7DD5\",\n \"representative\": \"xrb_1center16ci77qw5w69ww8sy4i4bfmgfhr81ydzpurm91cauj11jn6y3uc5y\",\n \"balance\": \"0\",\n \"link\": \"xrb_15kn1uzmkkh9si6j1fceycpu15dhb7kzi61fo8zykxj8z788hatu5frwfb3u\",\n \"signature\": \"D91A4AA91ABB2DE7988837CE2D1B11116EC44517E3F0C219C65ACE83822555571FC327AE0AFAD561CC1582315CD655314D808169F34792AFD912B1F08F47820C\",\n \"work\": \"8d958afca77002bf\"\n }\n"}' [::1]:7076

10c. If successful, you should get a hash which you can copy into nanocrawler and verify the transaction status. It may take some seconds before it shows up depending on the network status.

11. Never use the same private keys or recovery phrase again!


Final Words

For more information on how to use the Ledger hardware wallet with Nano please check here.

The offline signing method can be used with any Nano seed. A private key can be generated or extracted from an existing seed offline using this seed converter.

This article is meant as a help document but I cannot guarantee it will always be 100% correct, as it depends on other tools; thus, I cannot be held accountable for any lost funds. You are responsible for your own keys and the blocks you sign. I recommend trying the method first with a smaller amount on a test Ledger (if possible).

Node documentation can be found here.