|
| 1 | +--- |
| 2 | +title: Exporting Wallet to MetaMask |
| 3 | +sidebar_position: 4 |
| 4 | +--- |
| 5 | + |
| 6 | +:::tip |
| 7 | + |
| 8 | +Calibnet and mainnet wallets are mostly interchangeable; under the hood they have the same private key. You can export a calibnet wallet and import it into MetaMask, then switch to mainnet in MetaMask and it will work just fine. The only difference is that calibnet wallets start with `t` prefix and mainnet wallets start with `f`. Some tools might reject `t...` addresses when mainnet is selected, some will happily accept either. |
| 9 | + |
| 10 | +::: |
| 11 | + |
| 12 | +# Exporting a Forest Wallet to MetaMask |
| 13 | + |
| 14 | +This guide walks you through exporting a Forest wallet (`f4` address) to MetaMask, allowing you to manage your Filecoin account through the MetaMask browser extension. |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +- A Forest wallet with an `f4` address (`EVM`-compatible address) |
| 19 | +- MetaMask browser extension installed |
| 20 | +- Command-line tools: `forest-wallet`, `xxd`, `jq`, and `base64` |
| 21 | + |
| 22 | +## Step 1: Export the Private Key |
| 23 | + |
| 24 | +:::info |
| 25 | + |
| 26 | +You can list your wallets and their balances using `forest-wallet list`. Make sure to identify the correct `f4` address you want to export. Refer to the [wallets guide](./interacting_with_wallets.md) for more details on managing wallets in Forest. |
| 27 | + |
| 28 | +::: |
| 29 | + |
| 30 | +To export your wallet's private key in a format compatible with MetaMask, use the following command: |
| 31 | + |
| 32 | +```shell |
| 33 | +forest-wallet export f4... | xxd -r -p | jq -r '.PrivateKey' | base64 -d | xxd -p -c 32 |
| 34 | +``` |
| 35 | + |
| 36 | +Replace `f4...` with your actual `f4` address. |
| 37 | + |
| 38 | +This command will output a hexadecimal private key that can be imported into MetaMask. |
| 39 | + |
| 40 | +:::danger |
| 41 | + |
| 42 | +**Keep your private key secure!** Never share your private key with anyone. Anyone with access to your private key has full control over your funds. Make sure to run this command in a secure environment and clear your terminal history afterward. |
| 43 | + |
| 44 | +::: |
| 45 | + |
| 46 | +## Step 2: Add Filecoin Network to MetaMask |
| 47 | + |
| 48 | +Before importing your account, you need to add the Filecoin network to MetaMask: |
| 49 | + |
| 50 | +### For Mainnet |
| 51 | + |
| 52 | +Visit [Chainlist - Filecoin Mainnet](https://chainlist.org/chain/314) and click "Connect Wallet" to automatically add the network configuration to MetaMask. |
| 53 | + |
| 54 | +### For Calibnet |
| 55 | + |
| 56 | +Visit [Chainlist - Filecoin Calibration Network](https://chainlist.org/chain/314159) and click "Connect Wallet" to automatically add the network configuration to MetaMask. |
| 57 | + |
| 58 | +:::tip |
| 59 | + |
| 60 | +You can also manually add the network in MetaMask by going to "Networks → Add a Custom Network" and entering the network details from Chainlist. |
| 61 | + |
| 62 | +::: |
| 63 | + |
| 64 | +## Step 3: Import the Account into MetaMask |
| 65 | + |
| 66 | +1. Open MetaMask in your browser |
| 67 | +2. Click on the account icon in the top-right corner |
| 68 | +3. Select **"Add wallet"** |
| 69 | +4. Choose **"Import an account"** |
| 70 | +5. Paste the hexadecimal private key from Step 1 |
| 71 | +6. Click **"Import"** |
| 72 | + |
| 73 | +Your Forest wallet should now be accessible in MetaMask! |
| 74 | + |
| 75 | +## Step 4: Verify the Import |
| 76 | + |
| 77 | +1. Switch to the Filecoin network in MetaMask (mainnet or calibnet, depending on which you added) |
| 78 | +2. Verify that the account address matches your original `f4` address. MetaMask will display the address in Ethereum format (`0x...`), but it corresponds to the same account on the Filecoin network - by, e.g., going to a block explorer like [Blockscout](https://filecoin.blockscout.com/) and searching for your `f4` address, then comparing the `0x` address shown in Blockscout with the one in MetaMask. You can also use the [Beryx address converter tool](https://beryx.io/address_converter). |
| 79 | +3. Check that your balance is displayed correctly |
| 80 | + |
| 81 | +## Security Best Practices |
| 82 | + |
| 83 | +- **Never share your private key** with anyone or any service |
| 84 | +- **Use a hardware wallet** for large amounts of FIL |
| 85 | +- **Test with small amounts** first on calibnet before using mainnet |
| 86 | +- **Keep backups** of your wallet in a secure location |
| 87 | + |
| 88 | +## Troubleshooting |
| 89 | + |
| 90 | +### My balance doesn't appear in MetaMask |
| 91 | + |
| 92 | +Ensure you've switched to the correct Filecoin network (mainnet or calibnet) in MetaMask. The network must match where your funds are located. |
| 93 | + |
| 94 | +### MetaMask shows a different address format |
| 95 | + |
| 96 | +MetaMask displays addresses in Ethereum format (`0x...`). This is normal - it's the same account, just displayed in a different address format. The `f4` address and the `0x` address represent the same account on the Filecoin network. |
| 97 | + |
| 98 | +## Related Resources |
| 99 | + |
| 100 | +- [Interacting with Wallets](./interacting_with_wallets.md) |
| 101 | +- [Filecoin Address Types](https://docs.filecoin.io/smart-contracts/filecoin-evm-runtime/address-types) |
0 commit comments