How to call System api in the Motoko

Just to be clear, there is a distinction between functions provided by the System API and functions provided by the so-called ManagementCanister.

Your code for accessing the ManagementCanister and its functionality (like IC.raw_rand()) is correct, but much of the System API (including ic0.stable_size) is, by design, not accessible from the ManagementCanister but is instead made available to wasm programs as imported Wasm functions.

Sorry for the confusion.

5 Likes