Skip to content

Extend dfx ledger account-id to support canister accounts  #1981

@roman-kashitsyn

Description

@roman-kashitsyn

Currently, developers need to write code to compute ledger account identifiers of their canisters.
This approach is error-prone and can result in lost ICP.
We need to extend the dfx ledger account-id command to support the computation of canister accounts.

Examples:

dfx ledger account-id --of-canister my_canister [--subaccount 000...]
<hex of a ledger account, canister alias is given>

dfx ledger account-id --of-principal 54yea-6qaaa-aaaaa-qaabq-cai [--subaccount 000...]
<hex of a ledger account, canister id is given>

dfx ledger account-id --of-principal sp3em-jkiyw-tospm-2huim-jor4p-et4s7-ay35f-q7tnm-hi4k2-pyicb-xae [--subaccount 0000...]
<hex of a user ledger account>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions