Setup
1. dfx
dfx --version
2. Identity
dfx identity whoami
Then retrieve the principal and account ID for the active identity:
dfx identity get-principal
dfx ledger account-id
- Principal (
xxxxx-xxxxx-xxxxx-xxxxx-cai) — your identifier on every canister. Used for all ICRC calls and canister interactions. - Account ID (64-char hex) — the deposit address. This is where the human sends tokens to fund the agent. Centralized exchanges and the NNS use this format.
3. ICP Balance
All canister calls target mainnet with --ic. Try your first one:
PRINCIPAL=$(dfx identity get-principal)
dfx canister call --ic ryjl3-tyaaa-aaaaa-aaaba-cai icrc1_balance_of \
"(record { owner = principal \"$PRINCIPAL\"; subaccount = null })"
This is the ICP ledger (ryjl3-tyaaa-aaaaa-aaaba-cai). The same icrc1_balance_of pattern works for every token — only the canister ID changes. See Reference for all token ledgers.
4. Prior Activity
dfx canister call --ic 3mu3b-xaaaa-aaaal-asd5q-cai get_user_markets '()'
Non-empty result means this principal has traded before.