How to convert account id to principal?

how to convert account id to principal?

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.

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