Ledger Hardware Wallet¶
Hardware wallets provide a safer way to store crypto funds because the private key (used for signing transactions) is stored offline. Ledger offers two hardware wallet solutions at the time of writing: Ledger Nano S and Ledger Nano X.
Because Moonbeam is fully Ethereum compatible, and Ledger now supports signing in different Chain ID networks, you can use your Ledger device to sign transactions on Moonbeam!
This tutorial shows you how to get started with your Ledger hardware wallet on Moonbase Alpha. The guide only illustrates the steps for a Ledger Nano X device, but you can follow along with a Ledger Nano S as well. The same process can be applied to the other networks of the Moonbeam ecosystem.
Before you get started, update Ledger Live to the latest version available. Also, make sure you've your Ledger hardware wallet device running the latest firmware. The Ledger support website offers tutorials on how to update the firmware of both Ledger Nano S and Ledger Nano X devices.
Once you are running the latest firmware version, ensure you are running the newest Ethereum application. The Ledger support website offers a tutorial on how to install the Ethereum app.
At the time of writing, the following versions were used:
- Ledger Live 2.29
- Ledger Nano S firmware v2.0.0
- Ledger Nano X firmware v1.3.0
- Ethereum app v1.8.5
In addition, you'll need MetaMask as an intermediary between your Ledger device and Moonbase Alpha. Make sure that your MetaMask is connected to Moonbase Alpha. Chrome users (version 91) need some additional steps, which are detailed in this tutorial. Using Firefox will result in a much simpler/straightforward experience.
Please note that your Ledger device will sign transactions in whichever MetaMask network is connected to.
Importing your Ledger Account to MetaMask¶
To get started, you need to connect your Ledger device to the computer, unlock it, open the Ethereum application. Next, to import your Ethereum Ledger account to MetaMask, take the following steps:
- Click on the top-right logo to expand the menu
- Select "Connect Hardware Wallet"
In the next screen, you are prompted to select which hardware wallet you'll like to use in MetaMask. At the moment of writing, only Ledger and Trezor hardware wallets are supported. Here, take the following steps:
- Select the Ledger logo
- Click on "Continue"
If MetaMask was able to connect successfully to your Ledger device, you should see a list of five Ethereum-styled accounts. On the contrary, double-check that Ledger Live is closed, you've connected your Ledger device to the computer, unlocked it, and that the Ethereum app is opened. If you are using Chrome, check these additional steps.
From this list of five Ethereum accounts, take the following steps:
- Select the accounts you would like to import from your Ledger device
- Click on "Unlock"
If you've imported your Ledger Ethereum-styled account successfully, you should see it displayed in the main MetaMask screen like shown in the following image:
You've now successfully imported a Moonbeam compatible account from your Ledger device and are now ready to start signing transactions using your hardware wallet.
As of Chrome version 91, users that want to connect their Ledger device to MetaMask must be running the latest version of Ledger Live (v2.29 at the time of writing).
Enable Ledger Live Support in Metamask¶
In MetaMask, take the following steps:
- Expand the top-right menu and go to "Settings"
- Navigate to "Advanced"
- Enable the "Use Ledger Live" feature
Enable Device Access¶
Next, allow Ledger Live to connect to your device by following these steps:
- Click on the top-right logo to expand the Metamask menu
- Select "Connect Hardware Wallet"
- Allow Chrome permission to open Ledger Live
- Click "Open" in the Ledger Live App
- Open the Ethereum App on your Ledger Device and resume importing accounts
With this feature enabled, MetaMask will open Ledger Live when trying to connect to your Ledger device. You can read more about it in this MetaMask blog post.
Signing a Transaction Using your Ledger¶
If you've successfully imported your Ledger account to MetaMask, you are ready to sign transactions on Moonbeam using your Ledger device. This tutorial will show you how to send a simple transaction on the Moonbase Alpha TestNet, but it applies to other Moonbeam ecosystem networks.
First, make sure your Ledger account is funded with DEV tokens. Next, click on the "Send" button.
As you would in a standard transaction, set the recipient address, enter the number of tokens to send, review transaction details and confirm it. This will initiate the transaction signature wizard in your Ledger device. Here, take the following steps:
- Click the button to proceed to the next screen. Your Ledger device is only warning you to review the transaction
- Check the number of tokens being sent. Please note that the token corresponds to the network MetaMask is connected to. In this case, it is DEV tokens and not ETH! When ready, proceed to the next screen
- Check the recipient's address and proceed to the next screen
- Check the chain ID of the network. This information confirms which network MetaMask is connected to. For example, for Moonbase Alpha, the chain ID is 1287, Moonriver 1285 (not yet live), and Moonbeam 1284 (not yet live). When ready, proceed to the next screen
- Check the max fees applicable to this transaction. This is the gas price multiplied by the gas limit you've set on MetaMask. When ready, proceed to the next screen
- If you agree with all the transaction details, approve it. This will sign the transaction and will trigger MetaMask to send it. On the contrary, proceed to the next screen
- If you don't agree with all the transaction details, reject it. This will cancel the transaction, and MetaMask will mark it as failed
At the time of writing, the token name is always shown as
ETH. Please note that the token being handled is the one corresponding to the network MetaMask is connected to.
Right after you've approved the transaction, MetaMask sends it to the network. Once the transaction is confirmed, it will be displayed as "Send" on MetaMask's main screen.
And that is it! You've signed a transaction on Moonbase Alpha using your Ledger hardware wallet!
Interacting with Contracts Using your Ledger¶
By default, Ledger devices don't admit a
data field in the transaction object. Consequently, users can't deploy or interact with smart contracts.
However, if you want to use your Ledger hardware wallet for transactions related to smart contracts, you need to change a configuration parameter inside the Ethereum application. To do so, take the following steps:
- Open the Ledger Ethereum app
- Navigate to "Settings"
- Find the "Contract data" page. It should state "NOT allowed" at the bottom
- Select/validate the option to change its value to "Allowed"
This option is necessary to use your Ledger device to interact with ERC20 token contracts that might live inside the Moonbeam ecosystem.