DFX SDK how to switch accounts, use the specified account to sign and initiate transfer ICP transactions, please help me, thank you!

DFX SDK how to switch accounts, use the specified account to sign and initiate transfer ICP transactions, please help me, thank you!


I use thiskeysmith

You can switch identities with dfx identity use <identity_name>

dfx identity list will show all of your identities, these are all stored in the ~/.config/dfx/identity directory on your local machine. Copying a .pem file generated by keysmith to a named folder in this directory will add it as an identity in this list.

Running dfx ledger account-id will then show the ledger address for the currently selected identity.

As per your screenshot, you can then send ICP using dfx ledger transfer:
https://smartcontracts.org/docs/developers-guide/cli-reference/dfx-ledger.html#transfer

If you need to see the options for any of the dfx commands you can use the --help flag, eg
dfx ledger --help
dfx ledger transfer --help

If you’re using an airgapped setup (sign messages on an airgapped machine, send them from a networked machine) then the quill tool is a good option and has similar commands: https://github.com/dfinity/quill#usage

Download here: https://github.com/dfinity/quill/releases