How to add an existing wallet to .fuel/wallets/.wallet

I want to use my existing fuel wallet to deploy the contract. How to achieve that.

How I attempted?
I used forc deploy --testnet and it prompted me to
would you like to create a new one? [y/N]: y

and giving y created a new account.

I want to import my existing account to .fuel/wallets/.wallet

How to achieve that?


try forc wallet command there is an import option

forc wallet
A forc plugin for generating or importing wallets using BIP39 phrases.

Usage: forc-wallet [OPTIONS] <COMMAND>

  new       Create a new wallet from a random mnemonic phrase
  import    Import a wallet from the provided mnemonic phrase
  accounts  Lists all accounts derived for the wallet so far
  account   Derive a new account, sign with an existing account, or display an account's public or private key. See the `EXAMPLES` below
  sign      Sign some data (e.g. a transaction ID, a file, a string, or a hex-string) using either a wallet account or a private key
  balance   Present the sum of all account balances under a single wallet balance
  help      Print this message or the help of the given subcommand(s)
1 Like

If you want to use an existing Fuel wallet to deploy the contract instead of creating a new one, you can follow these steps:

  1. Locate Your Existing Wallet File:

    • Find the file for your existing wallet. It’s usually located at ~/.fuel/wallets/.wallet.
  2. Run the Deployment Command:

    • Use the forc deploy command again, but this time, when prompted, select the option to import an existing wallet instead of creating a new one.
    forc deploy --testnet
    • When asked, “Would you like to create a new one? [y/N]”, enter N for No.
  3. Import Existing Wallet:

    • The tool should then prompt you to import an existing wallet. Provide the path to your existing wallet file (e.g., ~/.fuel/wallets/.wallet).
    Please provide the path to your existing wallet: /path/to/your/existing/.wallet
    • After providing the path, the deployment process should proceed using your existing wallet.