Community Consideration: Explore Query Charging

Hi all,

here is the motion that we are thinking to put up for voting. What do you all think about it? Does this sound reasonable to everybody?


Many dapps execute a significant number of query calls. Since queries are read-only and do not persist the state changes, it is difficult for the developers to keep track of executed queries. This means that currently developers do not know how many queries and instructions their canisters are executing.


This proposal aims to add a mechanism to the IC to deterministically aggregate per-node statistics for query execution and periodically update each canister’s status with those aggregates.

Aggregates statistics will appear in the canister status in a delayed and approximate manner due to limitations of data processing in byzantine distributed systems.

We propose to collect query statistics for both, replicated and non-replicated query calls.


This proposal will add a quadruple of query statistics to each canister’s state:

  • Approximate sum of number of query calls executed
  • Approximate sum of number of instructions executed by query calls
  • Approximate sum of request payload size
  • Approximate sum of response payload size

Counters are incremented periodically and will be initialized with 0 during canister creation. Developers can determine the rates for those counters by periodically querying them and analyzing the difference over time.

What we are asking the community

  • Vote accept or reject on NNS Motion.
  • Participate in technical discussions as the motion moves forward.