Creating an Filecoin Wallet at the Command Line with Lotus

These are the steps to create an FIL wallet using Lotus at the command line, and export the wallet for safekeeping.

Install Lotus and Sync with Mainnet

Official docs: Lotus: install and setup | Filecoin Docs.

Here are some notes from when I originally installed and configured Lotus on Linux: Setting up Lotus and Powergate Localnet mode on Linux

And some notes from @boris on a macOS: Setting up Lotus on MacOS

Note: Make sure to follow the instructions for mainnet, not nerpa or calibration.

After installation, sync your node until the blockheight matches the current block height on one of the blockchain explorers. Filfox is one option. They show the blockheight in the top left corner of the network overview on the main page.

Create a wallet

Official docs: Lotus: send and receive FIL | Filecoin Docs

You can make a few types of wallets with Lotus. I looked over the Signature Types section of the spec and chose BLS over Secp256k1 because it looks like Secp256k1 was chosen for compatibility with other chains, but BLS is prefereable. (Either is probably be fine.)

Once I was synced with mainnet, I created a wallet with

lotus wallet new bls

And checked that the wallet was created with

lotus wallet list

Note that this is my only wallet, and that also makes it my default

lotus wallet default

Exporting the wallet

For safekeeping, it’s good to export your private key. That way you can recover your wallet in the future by importing it into Lotus.

Official docs: Lotus: send and receive FIL | Filecoin Docs

I exported my wallet with

lotus wallet export <address> > <address>.key

This creates a <address>.key private key file.

Importing the wallet

To test that export worked, I first deleted the wallet

lotus wallet delete <address>

Then imported it back into Lotus using the export file I created before

lotus wallet import <address>.key

Bonus: Send it FIL

If a tree falls in a forest and no one is around to hear it, does it make a sound?

Filecoin wallets aren’t actually on chain until they are involved in a transaction, so I sent sent my wallet some FIL as a liveness check.

After the transaction completed, I checked my balance with

lotus wallet list

The FIL got there and the wallet is live!

1 Like