# Canister does not consume cycles (local)

**URL:** <https://forum.dfinity.org/t/canister-does-not-consume-cycles-local/17852>\
**Category:** Developers\
**Tags:** nns\
**Created:** [January 7, 2023, 11:11pm UTC](https://forum.dfinity.org/t/canister-does-not-consume-cycles-local/17852 "2023-01-07T23:11:28Z")\
**Posts on this page:** 1\
**Showing post:** 26

<div class="post-metadata">

**Author:** ![bitdivine](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/bitdivine/32/246_2.png) [@bitdivine](https://forum.dfinity.org/u/bitdivine)\
**Post date:** [September 14, 2023, 1:03pm UTC](https://forum.dfinity.org/t/canister-does-not-consume-cycles-local/17852/26 "2023-09-14T13:03:07Z")

</div>

The subnet ID is the same as the root key, for local dfx. In Rust I wrote the conversion as:

```auto
/// Gets the subnet ID
#[context("Failed to determine subnet ID.")]
async fn get_subnet_id(agent: &Agent) -> anyhow::Result<Principal> {
    let root_key = agent
        .status()
        .await
        .with_context(|| "Could not get agent status")?
        .root_key
        .with_context(|| "Agent should have fetched the root key.")?;
    Ok(Principal::self_authenticating(root_key))
}

```

---

_[View the full topic](https://forum.dfinity.org/t/canister-does-not-consume-cycles-local/17852)._
