How "ExperimentalCycles.balance" works when deploy locally?

When I deploy my canister locally and call the following method:

  public func test(): async (Nat) {
      Debug.print("cycles:" # debug_show(ExperimentalCycles.balance() ));

I get this debug message:


But when I call dfx wallet balance , I get 96.899 TC

Why do I get a different balance?
Another thing I dont understand is why everytime I call Test I get an slightly lower value (remonder: I am running locally)

Every canister has a separate cycles balance. Your wallet has a bit less than 100TC, your test canister has ~3TC. Data storage and running update calls costs cycles, therefore the balance decreases slowly over time

@Severin , How is that my test canister is spending cycles if this is only deployed locally in my computer? If those are simulated cycles, is there a way the replenish my test canister with more simulated cycles?

dfx start runs a full node, by default in application subnet mode. So yes, it does use ‘simulated’ cycles. You can give it more with dfx ledger fabricate-cycles

1 Like