Skip to main content


Certified data.

The Internet Computer allows canister smart contracts to store a small amount of data during update method processing so that during query call processing, the canister can obtain a certificate about that data.

This module provides a low-level interface to this API, aimed at advanced users and library implementors. See the Internet Computer Functional Specification and corresponding documentation for how to use this to make query calls to your canister tamperproof.

Value set

let set : (data : Blob) -> ()

Set the certified data.

Must be called from an update method, else traps. Must be passed a blob of at most 32 bytes, else traps.


import CertifiedData "mo:base/CertifiedData";
import Blob "mo:base/Blob";

// Must be in an update call

let array : [Nat8] = [1, 2, 3];
let blob = Blob.fromArray(array);

See a full example on how to use certified variables here:

Value getCertificate

let getCertificate : () -> ?Blob

Gets a certificate

Returns null if no certificate is available, e.g. when processing an update call or inter-canister call. This returns a non-null value only when processing a query call.


import CertifiedData "mo:base/CertifiedData";
// Must be in a query call


See a full example on how to use certified variables here: