How to convert account id to principal?

how to convert account id to principal?

1 Like

On the ICP ledger that is not possible in general: account id is obtained by hashing the principal (together with the subaccount id), so getting the principal out of the account id would require inverting the hash.

2 Likes

thanks for your answer

This way you can’t retrieve the underlying principal of the account id, improving privacy.

The other way around, principal to account id →

In dfx you have

dfx ledger account-id --of-principal

how to find controlled canister

In your dfx.json

Also

dfx canisted status CANISTER_NAME