Importing Accounts

You can export your private key from wallet (Argent) and import it into the file holding the accounts info (~/.starknet_accounts/starknet_open_zeppelin_accounts.json by default).

⚠️ Warning

Never share your private key! Anyone with access to your private key can access your account and funds. You are doing this at your own risk.

Exporting Your Private Key

This section shows how to export your private key from specific wallets.

Examples

Argent

  1. Open the Argent app > Settings.

  2. Click on the current account.

  3. Click on "Export private key".

  4. Enter your password.

  5. Copy your private key.

Importing an Account

Examples

General Example

To import an account into the file holding the accounts info (~/.starknet_accounts/starknet_open_zeppelin_accounts.json by default), use the account import command.

$ sncast \ account import \ --network sepolia \ --name account_123 \ --address 0x1 \ --private-key 0x2 \ --type oz

📝 Note The --name can be omitted as this is optional. A default name will be generated for the account.

Passing Private Key in an Interactive

If you don't want to pass the private key in the command (because of safety aspect), you can skip --private-key flag. You will be prompted to enter the private key in interactive mode.

$ sncast \ account import \ --network sepolia \ --name account_123 \ --address 0x1 \ --type oz
Output:
Type in your private key and press enter:

Argent

To import Argent account, set the --type flag to argent.

$ sncast \ account import \ --network sepolia \ --name account_argent \ --address 0x1 \ --private-key 0x2 \ --type argent

⚠️ Warning Importing braavos accounts is currently disabled.

OpenZeppelin

To import OpenZeppelin account, set the --type flag to oz or open_zeppelin.

$ sncast \ account import \ --network sepolia \ --name account_oz \ --address 0x1 \ --private-key 0x2 \ --type oz