certified-variables

Serve cryptographically verified query responses using Merkle trees and subnet BLS signatures.

Updated Apr 3, 2026
One-click install
npx skills add https://github.com/phukrit7171/Relationship-Smart-Contract-ICP --skill certified-variables-phukrit7171
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: certified-variables
Source: https://github.com/phukrit7171/Relationship-Smart-Contract-ICP/tree/main/.agents/skills/certified-variables
Command: npx skills add https://github.com/phukrit7171/Relationship-Smart-Contract-ICP --skill certified-variables-phukrit7171

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ic-certified-map, ic-cdk, ic-http-certification, ic-certification, @dfinity/certificate-verification, @icp-sdk/core.

What problem does it solve? Query responses on the Internet Computer come from a single replica and are not verified by consensus, so a malicious or faulty replica could return fabricated data. This Skill shows how to certify canister data so query responses carry cryptographic proof of authenticity while staying fast. ## Core Features & Use Cases - Merkle-tree certification: Build an RbTree or CertTree over canister data, certify the 32-byte root hash during update calls, and generate per-key witnesses for query responses. - Rust, Motoko, and frontend coverage: Complete implementations using ic-certified-map, the ic-certification mops package, and client-side verification with @dfinity/certificate-verification. - HTTP certification: Certify custom HTTP canister responses with ic-http-certification so the HTTP gateway can verify them. - Use Case: A canister stores user records that a frontend displays. Use this Skill to return each record with a certificate and witness so the browser can verify the data against the IC root key and reject tampered responses. ## Quick Start Ask the AI to implement a certified key-value store on the Internet Computer where update calls set the certified root hash and query calls return the value with its certificate and Merkle witness.

Frequently Asked Questions about certified-variables

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I certify query responses on the Internet Computer?

Build a Merkle tree over your data with ic-certified-map (Rust) or ic-certification (Motoko), call certified_data_set with the 32-byte root hash during update calls, then return the value, certificate from data_certificate(), and a per-key witness in query responses.

How do I verify an IC certificate in a frontend?

Use verifyCertification from @dfinity/certificate-verification with the canister ID, encoded certificate, encoded witness, and IC root key. It checks the BLS signature, certificate freshness, and witness root hash, then you look up the key in the returned HashTree.

Why does certified_data_set trap or fail in my canister?

certified_data_set only works during update calls and accepts at most 32 bytes, so calling it in a query traps and passing raw data exceeds the limit. Certify only the Merkle root hash, and re-set it in post_upgrade because upgrades clear certified data.

Can I certify more than 32 bytes of canister data?

No, the certified_data_set API accepts a single blob of at most 32 bytes. Instead, build a Merkle tree over your data and certify only its root hash, using witnesses to prove individual values.

Why does data_certificate return null in my canister call?

data_certificate returns None or null during update calls because certificates are only produced in query call contexts. Restructure your code so certificate retrieval happens inside query methods.