How can I interact with my developer identity using dfx?

All ICP token transactions are recorded in a ledger canister running on the Internet Computer blockchain. The ledger canister consists of account identifiers and balances for all ICP token holders. Before you can transfer any ICP tokens you hold in your ledger account, you need to send a secure and properly-signed message that verifies your identity to the ledger and authorizes your developer identity to complete the transaction. 


Depending on how you have set up custody for holding your ICP tokens, requirements to connect to the ledger and complete a transaction can vary. For example, you might connect to the ledger and start a transaction from a hardware wallet using a hardware security module (HSM) appliance, or through the Network Nervous System (NNS) frontend application, or using the SDK dfx command-line interface.


The first time you use the SDK, the dfx command-line tool creates a default developer identity for you. This identity is represented by a principal data type and a textual representation of the principal often referred to as your principal identifier.


However, the principal associated with your developer identity is typically not the same as your account identifier in the ledger. The principal identifier and the account identifier are related—both provide a textual representation of your identity—but they use different formats.


You can confirm the developer identity you are currently using by running:

dfx identity whoami


You can also view a textual representation of the principal for your current identity by running:

dfx identity get-principal


You can get the ledger account identifier for your developer identity by running:

dfx ledger account-id


And you can check your account balance by running:

dfx ledger --network ic balance


To create a new identity and begin development, use:

dfx identity new <principal id>



<<How do I install dfx?