If you need to get a canisters controllers from within canister

since they are blocking it to noncontrollers, you can make a call to this canister i deployed it should be able to grab controllers for any canister on the network


Hi, how did you get controllers from canister?

You can use dfx canister --network ic info <canister id> or any chain explorer

Thanks. But I know.
My point is how canister gets the controllers of other canisters.
canister_infois not provided currently.

This is a known issue. Someone explained their workaround. They basically request canister_status of a different canister, and the error message contains the controllers which they then parse into principals

1 Like

I’ll try it! Thanks!

Is there currently no way for a canister to get its own controllers right now?

No way that I know of. The runtime team recently agreed to add some way to get dfx canister info for the canister itself, but they haven’t gotten around to implementing it yet. Maybe is_controller (which was added very recently) helps you?

1 Like

Here’s the solution I’m currently using.

1 Like

Oh wait, this might be exactly what I was looking for: is_controller in ic_cdk::api - Rust

It doesn’t give a list of the controllers, but at least I can know if a principal is a controller. I wanted this for auth purposes anyway.