cast-wallet-import - Import a private key into an encrypted keystore
cast wallet import
[options] account_name
Import a private key into an encrypted keystore.
If no keystore-dir is specified, it will be saved in the default ~/.foundry/keystores
, so it can be accessed through the --account
option in methods like forge script
, cast send
or any other that requires a private key.
-k
--keystore-dir
The path to store the encrypted keystore.
Defaults to ~/.foundry/keystores
.
{{#include ../common/wallet-options-raw.md}}
{{#include common-options.md}}
-
Create a keystore from a private key:
cast wallet import BOB --interactive
-
Create a keystore from a mnemonic:
cast wallet import ALICE --mnemonic "test test test test test test test test test test test test"
-
Create a keystore from a mnemonic with a specific mnemonic index:
cast wallet import ALICE --mnemonic "test test test test test test test test test test test test" --mnemonic-index 1