[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GPS6SBGD2Q0FT9NR0JW7KP":3,"skill-same:01M6GPS6SBGD2Q0FT9NR0JW7KP":94},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":6,"ownerHtmlUrl":58,"ownerBlogUrl":59,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6GPS6SBGD2Q0FT9NR0JW7KP","certified-variables",null,"Serve cryptographically verified responses from query calls using Merkle trees and subnet BLS signatures. Covers the certified data API, RbTree\u002FCertTree construction, witness generation, HTTP response certification for custom http_request canisters (ic-http-certification), and frontend certificate validation (@dfinity\u002Fcertificate-verification). Use when query responses need verification, certified data, or response authenticity proofs. For static frontends served by the certified-assets canister, use the static-site skill instead: certification is automatic there.","jiayaoqijia\u002Fcryptoskill","jiayaoqijia","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1453879?v=4","01M6GMYTX7Q7S504VC6E756ENR","YQ","01M6GMYV1QKJ1CC75MTTGT9PR0",81,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"certified variables","Variables","icp","when","static","custom","for","calls","authenticity","trees","serve","witness","frontend","subnet","generation","static-site","signatures","query","use","assets","api","verification","http","cli","2026-11-10 10:12:30",false,"---\nname: certified-variables\ndescription: \"Serve cryptographically verified responses from query calls using Merkle trees and subnet BLS signatures. Covers the certified data API, RbTree\u002FCertTree construction, witness generation, HTTP response certification for custom http_request canisters (ic-http-certification), and frontend certificate validation (@dfinity\u002Fcertificate-verification). Use when query responses need verification, certified data, or response authenticity proofs. For static frontends served by the certified-assets canister, use the static-site skill instead: certification is automatic there.\"\nlicense: Apache-2.0\ncompatibility: \"icp-cli >= 0.2.2\"\nmetadata:\n  title: Certified Variables\n  category: Security\n---\n\n# Certified Variables\n\nA query call is answered by a single replica, without consensus, so a faulty or malicious replica can return fabricated data. Certification closes that gap: during update calls the canister stores a 32-byte hash (usually the root of a Merkle tree over its data) in the subnet's certified state, and query responses carry a certificate signed by the subnet's threshold BLS key. Clients verify the certificate and a Merkle witness, and get a fast query response that is as trustworthy as an update call.\n\n## Who Verifies What\n\nDecide this first. Certification only helps if something checks it.\n\n| Response | Verified by | Client code needed |\n|----------|-------------|--------------------|\n| HTTP from a frontend canister or `http_request`, via `\u003Cid>.icp.net` or a custom domain | the HTTP gateway | none |\n| The same, via `\u003Cid>.raw.icp.net` or your own HTTP client | nobody | `@dfinity\u002Fresponse-verification` (`verifyRequestResponsePair`) |\n| Update call through an actor (`agent.update`) | consensus; the agent checks the response certificate | none |\n| Candid **query** call through an actor | only the answering node's signature | **certified data + `@dfinity\u002Fcertificate-verification`** (this skill) |\n\nThe gateway never verifies Candid API calls (`\u002Fapi\u002F...`), even when the page came from a verifying host: on `ic0.app`, `icp0.io` or local origins the agent sends them through the page origin, and the gateway only proxies them. Certify a query when a client acts on its result: balances, permissions, prices, anything security-relevant. The alternative is to call the method as an update and accept consensus latency. Ledgers implementing ICRC-3 already certify their tip: `icrc3_get_tip_certificate` returns `opt { certificate; hash_tree }`, which verifies with `verifyCertification` like any witness below (labels `last_block_index`, a LEB128 number, and `last_block_hash`, so decode them instead of the helper's UTF-8 compare).\n\nStatic frontends served by the certified-assets canister (`@dfinity\u002Fstatic-site` recipe) are certified automatically: load the `static-site` skill for those.\n\n## Versions\n\n| Side | Package | Version | Used for |\n|------|---------|---------|----------|\n| Rust | `ic-cdk` | 0.20 | `certified_data_set` \u002F `data_certificate` |\n| Rust | `ic-certification` (feature `serde`) | 4 | `RbTree` Merkle map with witnesses |\n| Rust | `ic-http-certification` | 4 | certifying `http_request` responses |\n| Motoko | `core` | 2.6 | `mo:core\u002FCertifiedData` |\n| Motoko | `ic-certification` (mops) | 1.1 | `CertTree` Merkle tree with witnesses |\n| Motoko | `sha2` (mops) | 0.2 | hashing a single certified value |\n| Frontend | `@icp-sdk\u002Fcore` | ^6 | agent, `Certificate`, `lookup_path` |\n| Frontend | `@dfinity\u002Fcertificate-verification` | ^4 | witness verification (peers `@icp-sdk\u002Fcore` ^6, takes `Uint8Array`) |\n\n`ic-certified-map` 0.4 exposes the same `RbTree`\u002F`AsHashTree` API and still works, but `ic-certification` is maintained alongside `ic-http-certification` and is what the official examples use.\n\n## Root Key\n\nClient-side verification needs the root key of the network the canister runs on:\n- **Browser:** `safeGetCanisterEnv()?.IC_ROOT_KEY` from the `ic_env` cookie (`@icp-sdk\u002Fcore\u002Fagent\u002Fcanister-env`), set by the frontend canister on local networks and mainnet alike. It is the key of the network serving the page; to verify a canister on another network (e.g. mainnet data from a local dev server), use that network's key. It is only as trustworthy as the page: on a verifying hostname the gateway verifies the cookie along with the page, but a page from a `raw` hostname can carry a forged key, so a client verifying `raw` responses needs an independently obtained key.\n- **Node scripts and tests:** `root_key` from `icp network status --json`, hex-decoded to bytes.\n- **Mainnet:** the agent's built-in default (`agent.rootKey` on an agent created without `rootKey`): `308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae`\n\nNever call `fetchRootKey()` in shipped code: it trusts whatever key the replica sends (see the `canister-security` skill).\n\n## Pitfalls\n\n1. **Certifying more than 32 bytes.** `certified_data_set` \u002F `CertifiedData.set` accept at most 32 bytes. Build a Merkle tree over the data and certify its root hash; the tree provides per-key proofs.\n\n2. **Setting certified data in a query, or not at install and after every change.** `certified_data_set` can be called from `canister_init`, `canister_post_upgrade`, `canister_pre_upgrade`, update methods, reply\u002Freject callbacks, and system tasks (heartbeat, global timer, low-Wasm-memory hook); it traps anywhere else, including any query (even one called as an update) and cleanup callbacks. Certified data starts empty on install, so certify the initial state in `init` (Rust) or the actor body (Motoko), or queries fail verification until the first write. Forgetting to set it after a mutation leaves a stale hash with the same result. Batch writes need only one `certified_data_set` after the last insert.\n\n3. **Expecting a certificate from a call that is not a query call.** `data_certificate()` \u002F `CertifiedData.getCertificate()` return `None`\u002F`null` in update calls, and a query method invoked as an update call counts as one. **`icp canister call` sends an update call unless you pass `--query`**: without it, the Rust example below traps on its `expect`, and the Motoko examples return `certificate = null`. Frontend code calling a `query` method through an actor sends a query call automatically.\n\n4. **Losing the tree on upgrade, not the certified data.** The certified data itself survives upgrades (install and reinstall start it empty). What does not survive is a Merkle tree kept on the heap: the Rust `RbTree` below is wiped on upgrade while the old hash stays set, so `#[post_upgrade]` must rebuild the tree (from stable storage in a real app, see the `stable-memory` skill) and call `certified_data_set` again. A Motoko `CertTree.Store` persists with the actor, so nothing needs re-setting after an upgrade.\n\n5. **Building the witness for the wrong key.** The witness must reveal the exact path being queried; a witness for `users\u002Falice` proves nothing about `users\u002Fbob`.\n\n6. **Treating every non-`Found` lookup as \"absent\".** `lookup_path` returns a status: `Found` (value proven), `Absent` (absence proven), or `Unknown`\u002F`Error` (the witness does not cover the path). Only `Absent` proves a key does not exist. Collapsing `Unknown` into \"not found\" (for example with `lookupResultToBuffer`, which returns `undefined` for all three) lets a replica send a witness for a different key and make a real value look missing.\n\n7. **Skipping the freshness check.** The certificate's `\u002Ftime` is when the subnet signed it; without a bound, a stale certificate with outdated data can be replayed. `verifyCertification` enforces `maxCertificateTimeOffsetMs` (5 minutes is a sensible value); `Certificate.create` enforces ±5 minutes by default (`maxAgeInMinutes`).\n\n8. **Declaring the Motoko `CertTree.Ops` object as stable.** In a persistent actor, `let ct = CertTree.Ops(certStore)` fails with `M0131` (`variable ct is declared stable but has non-stable type`). Declare it `transient let ct = CertTree.Ops(certStore);`; only the `CertTree.Store` is stable.\n\n9. **Certifying an HTTP response without its `IC-CertificateExpression` header.** With `ic-http-certification`, the header carrying the CEL expression must be part of the response you certify; `HttpCertification::response_only`\u002F`full` return `CertificateExpressionHeaderMissing` otherwise. Serve exactly that response, plus the `IC-Certificate` header from `add_v2_certificate_header`, or the HTTP gateway rejects it with `backend_response_verification`.\n\n## Canister\n\n### Rust\n\n```toml\n[package]\nname = \"certified_vars_backend\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lib]\ncrate-type = [\"cdylib\"]\n\n[dependencies]\ncandid = \"0.10\"\nic-cdk = \"0.20\"\nic-certification = { version = \"4\", features = [\"serde\"] }\nserde = { version = \"1\", features = [\"derive\"] }\nserde_bytes = \"0.11\"\nciborium = \"0.2\"\n```\n\n```rust\nuse candid::{CandidType, Deserialize};\nuse ic_cdk::{init, post_upgrade, query, update};\nuse ic_certification::{AsHashTree, RbTree};\nuse serde_bytes::ByteBuf;\nuse std::cell::RefCell;\n\nthread_local! {\n    \u002F\u002F RbTree is a Merkle-tree-backed map: keys and values are byte slices\n    static TREE: RefCell\u003CRbTree\u003CVec\u003Cu8>, Vec\u003Cu8>>> = RefCell::new(RbTree::new());\n}\n\n\u002F\u002F Update the certified data hash after any modification\nfn update_certified_data() {\n    TREE.with(|tree| {\n        let tree = tree.borrow();\n        \u002F\u002F root_hash() returns a 32-byte SHA-256 hash of the entire tree\n        ic_cdk::api::certified_data_set(&tree.root_hash());\n    });\n}\n\n#[init]\nfn init() {\n    update_certified_data();\n}\n\n#[post_upgrade]\nfn post_upgrade() {\n    \u002F\u002F This example keeps TREE on the heap only: it is empty after an upgrade, while the\n    \u002F\u002F old certified hash is kept. A real canister reinserts its entries from stable storage\n    \u002F\u002F here first; this one re-certifies the empty tree so the hash matches it again.\n    update_certified_data();\n}\n\n#[update]\nfn set(key: String, value: String) {\n    TREE.with(|tree| {\n        let mut tree = tree.borrow_mut();\n        tree.insert(key.as_bytes().to_vec(), value.as_bytes().to_vec());\n    });\n    \u002F\u002F Must update certified hash after every data change\n    update_certified_data();\n}\n\n#[update]\nfn delete(key: String) {\n    TREE.with(|tree| {\n        let mut tree = tree.borrow_mut();\n        tree.delete(key.as_bytes());\n    });\n    update_certified_data();\n}\n\n#[derive(CandidType, Deserialize)]\nstruct CertifiedResponse {\n    value: Option\u003CString>,\n    certificate: ByteBuf,      \u002F\u002F subnet BLS signature\n    witness: ByteBuf,          \u002F\u002F Merkle proof for this key\n}\n\n#[query]\nfn get(key: String) -> CertifiedResponse {\n    \u002F\u002F data_certificate() is only available in query calls (icp canister call --query)\n    let certificate = ic_cdk::api::data_certificate()\n        .expect(\"data_certificate only available in query calls\");\n\n    TREE.with(|tree| {\n        let tree = tree.borrow();\n\n        \u002F\u002F Look up the value\n        let value = tree.get(key.as_bytes())\n            .map(|v| String::from_utf8(v.clone()).unwrap());\n\n        \u002F\u002F Build a witness (Merkle proof) for this specific key\n        let witness = tree.witness(key.as_bytes());\n\n        \u002F\u002F Serialize the witness as CBOR\n        let mut witness_buf = vec![];\n        ciborium::into_writer(&witness, &mut witness_buf)\n            .expect(\"Failed to serialize witness as CBOR\");\n\n        CertifiedResponse {\n            value,\n            certificate: ByteBuf::from(certificate),\n            witness: ByteBuf::from(witness_buf),\n        }\n    })\n}\n\n\u002F\u002F Required by the icp-cli Rust recipe, which extracts the Candid interface from the wasm\nic_cdk::export_candid!();\n```\n\n### Motoko: single value\n\nA single value needs no Merkle tree: certify its hash, and the client compares `sha256(value)` with the certificate's `certified_data` (see \"Single value without a witness\").\n\n```motoko\nimport CertifiedData \"mo:core\u002FCertifiedData\";\nimport Text \"mo:core\u002FText\";\n\u002F\u002F Requires: mops add sha2\nimport Sha256 \"mo:sha2\u002FSha256\";\n\npersistent actor {\n\n  \u002F\u002F Simple certified single-value example:\n  var certifiedValue : Text = \"\";\n\n  \u002F\u002F Certify the hash of the current value (max 32 bytes; traps in a query call)\n  func certify() {\n    CertifiedData.set(Sha256.fromBlob(#sha256, Text.encodeUtf8(certifiedValue)));\n  };\n\n  \u002F\u002F Certify the initial value at install: certified data starts empty, not as sha256(\"\")\n  certify();\n\n  \u002F\u002F Set a certified value (update call only)\n  public func setCertifiedValue(value : Text) : async () {\n    certifiedValue := value;\n    certify();\n  };\n\n  \u002F\u002F Get the certified value with its certificate (query call)\n  public query func getCertifiedValue() : async {\n    value : Text;\n    certificate : ?Blob;\n  } {\n    {\n      value = certifiedValue;\n      certificate = CertifiedData.getCertificate();\n    }\n  };\n};\n```\n\n### Motoko: key-value store with witnesses\n\n`CertTree` from the `ic-certification` mops package (`mops add ic-certification`) is a Merkle tree that produces per-key witnesses:\n\n```motoko\nimport CertifiedData \"mo:core\u002FCertifiedData\";\nimport Blob \"mo:core\u002FBlob\";\nimport Text \"mo:core\u002FText\";\n\u002F\u002F Requires: mops add ic-certification\nimport CertTree \"mo:ic-certification\u002FCertTree\";\n\npersistent actor {\n\n  \u002F\u002F CertTree.Store is stable -- the tree persists across upgrades, and so does the certified data\n  let certStore : CertTree.Store = CertTree.newStore();\n  \u002F\u002F Ops is an object with functions, not stable data: it must be transient\n  transient let ct = CertTree.Ops(certStore);\n\n  \u002F\u002F Set certified data on init\n  ct.setCertifiedData();\n\n  \u002F\u002F Set a key-value pair and update certification\n  public func set(key : Text, value : Text) : async () {\n    ct.put([Text.encodeUtf8(key)], Text.encodeUtf8(value));\n    \u002F\u002F CRITICAL: call after every mutation to update the subnet-certified root hash\n    ct.setCertifiedData();\n  };\n\n  \u002F\u002F Delete a key and update certification\n  public func delete(key : Text) : async () {\n    ct.delete([Text.encodeUtf8(key)]);\n    ct.setCertifiedData();\n  };\n\n  \u002F\u002F Query with certificate and Merkle witness for the requested key\n  public query func get(key : Text) : async {\n    value : ?Blob;\n    certificate : ?Blob;\n    witness : Blob;\n  } {\n    let path = [Text.encodeUtf8(key)];\n    \u002F\u002F reveal() generates a Merkle proof for this specific path\n    let witness = ct.reveal(path);\n    {\n      value = ct.lookup(path);\n      certificate = CertifiedData.getCertificate();\n      witness = ct.encodeWitness(witness);\n    }\n  };\n};\n```\n\n### Custom `http_request` canisters\n\nCanisters that serve HTTP from their own `http_request` must certify each response with `ic-http-certification` so the HTTP gateway can verify it. Read `references\u002Fhttp-certification.md` before writing one: it has a complete, minimal canister (certify in `init`\u002F`post_upgrade`, attach the witness in `http_request`, and a certified 404 for every other path) and the header rules from pitfall 9. Every path the gateway can request needs a certified response: an uncertified error or 404 is rejected with `backend_response_verification`.\n\n## Client Verification (TypeScript)\n\n`@icp-sdk\u002Fcore` ships every primitive (`Certificate.create`, `Cbor`, `reconstruct`, `lookup_path`); `@dfinity\u002Fcertificate-verification` wraps them for the witness case: it verifies the certificate signature, checks `\u002Ftime`, decodes the witness, and checks that its root hash equals the certificate's `certified_data`. Candid `blob` fields arrive as `Uint8Array` in `@icp-sdk\u002Fbindgen` bindings. bindgen turns `opt` record fields into optional properties that are `undefined` when empty. The helpers take the getters' responses as returned: a Motoko `?Blob` value or certificate is `Uint8Array | undefined`, and the witness helper decodes a `Uint8Array` value as UTF-8. Take the root key from \"Root Key\".\n\n### With a witness\n\n```typescript\nimport { verifyCertification } from \"@dfinity\u002Fcertificate-verification\";\nimport { lookup_path, LookupPathStatus } from \"@icp-sdk\u002Fcore\u002Fagent\";\nimport { Principal } from \"@icp-sdk\u002Fcore\u002Fprincipal\";\n\nconst MAX_CERT_TIME_OFFSET_MS = 5 * 60 * 1000; \u002F\u002F 5 minutes\n\nexport async function getVerifiedValue(\n  rootKey: Uint8Array,\n  canisterId: string,\n  key: string,\n  \u002F\u002F value is opt text (Rust) or ?blob (Motoko); certificate is a blob (Rust) or ?blob (Motoko)\n  response: {\n    value?: string | Uint8Array | null;\n    certificate?: Uint8Array | null;\n    witness: Uint8Array;\n  },\n): Promise\u003Cstring | null> {\n  if (!response.certificate) throw new Error(\"no certificate: call the getter as a query\");\n  const value =\n    response.value instanceof Uint8Array\n      ? new TextDecoder().decode(response.value)\n      : (response.value ?? null);\n  \u002F\u002F Checks signature, time and root hash; throws CertificateTimeError or CertificateVerificationError.\n  const tree = await verifyCertification({\n    canisterId: Principal.fromText(canisterId),\n    encodedCertificate: response.certificate,\n    encodedTree: response.witness,\n    rootKey,\n    maxCertificateTimeOffsetMs: MAX_CERT_TIME_OFFSET_MS,\n  });\n\n  \u002F\u002F The path must match how the canister inserted the key (here: UTF-8 bytes).\n  const result = lookup_path([new TextEncoder().encode(key)], tree);\n  switch (result.status) {\n    case LookupPathStatus.Found: {\n      const verified = new TextDecoder().decode(result.value);\n      if (value !== verified) throw new Error(\"value does not match witness\");\n      return verified;\n    }\n    case LookupPathStatus.Absent:\n      if (value !== null) throw new Error(\"witness proves the key is absent\");\n      return null;\n    default:\n      \u002F\u002F Unknown\u002FError: the witness does not cover this key, so it proves nothing\n      throw new Error(`witness does not cover key (${result.status})`);\n  }\n}\n```\n\n### Single value without a witness\n\n`verifyCertification` needs a witness tree, so verify the Motoko single-value example with `Certificate.create` directly. It checks the signature and the ±5 minute freshness window:\n\n```typescript\nimport { Certificate, lookupResultToBuffer, uint8Equals } from \"@icp-sdk\u002Fcore\u002Fagent\";\nimport { Principal } from \"@icp-sdk\u002Fcore\u002Fprincipal\";\n\nexport async function verifySingleValue(\n  rootKey: Uint8Array,\n  canisterId: string,\n  \u002F\u002F certificate is ?blob in the Motoko getter; empty means it did not run as a query call\n  response: { value: string; certificate?: Uint8Array | null },\n): Promise\u003Cstring> {\n  if (!response.certificate) throw new Error(\"no certificate: call the getter as a query\");\n  const principal = Principal.fromText(canisterId);\n  const cert = await Certificate.create({\n    certificate: response.certificate,\n    rootKey,\n    principal: { canisterId: principal },\n  });\n  const certifiedData = lookupResultToBuffer(\n    cert.lookup_path([\"canister\", principal.toUint8Array(), \"certified_data\"]),\n  );\n  \u002F\u002F Recompute what the canister certified: sha256 of the UTF-8 value\n  const hash = new Uint8Array(\n    await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(response.value)),\n  );\n  if (!certifiedData || !uint8Equals(certifiedData, hash)) {\n    throw new Error(\"value does not match certified data\");\n  }\n  return response.value;\n}\n```\n\nA runnable single-value example with a browser frontend that verifies with `Certificate.create` is [dfinity\u002Fexamples `motoko\u002Fcert-var`](https:\u002F\u002Fgithub.com\u002Fdfinity\u002Fexamples\u002Ftree\u002Fmaster\u002Fmotoko\u002Fcert-var). It certifies the raw 4-byte `Nat32` instead of a hash.\n\n## Checking It Works\n\n```bash\nicp canister call backend set '(\"greeting\", \"hello world\")'\nicp canister call --query backend get '(\"greeting\")'\n# Expected: certificate = blob \"...\" (Rust) \u002F opt blob \"...\" (Motoko); null or a trap means the call was not a query\n```\n\nThen run the client function against a response: it must return the value, and must throw once `response.value` is changed.\n","# Certified Variables\n\nA query call is answered by a single replica, without consensus, so a faulty or malicious replica can return fabricated data. Certification closes that gap: during update calls the canister stores a 32-byte hash (usually the root of a Merkle tree over its data) in the subnet's certified state, and query responses carry a certificate signed by the subnet's threshold BLS key. Clients verify the certificate and a Merkle witness, and get a fast query response that is as trustworthy as an update call.\n\n## Who Verifies What\n\nDecide this first. Certification only helps if something checks it.\n\n| Response | Verified by | Client code needed |\n|----------|-------------|--------------------|\n| HTTP from a frontend canister or `http_request`, via `\u003Cid>.icp.net` or a custom domain | the HTTP gateway | none |\n| The same, via `\u003Cid>.raw.icp.net` or your own HTTP client | nobody | `@dfinity\u002Fresponse-verification` (`verifyRequestResponsePair`) |\n| Update call through an actor (`agent.update`) | consensus; the agent checks the response certificate | none |\n| Candid **query** call through an actor | only the answering node's signature | **certified data + `@dfinity\u002Fcertificate-verification`** (this skill) |\n\nThe gateway never verifies Candid API calls (`\u002Fapi\u002F...`), even when the page came from a verifying host: on `ic0.app`, `icp0.io` or local origins the agent sends them through the page origin, and the gateway only proxies them. Certify a query when a client acts on its result: balances, permissions, prices, anything security-relevant. The alternative is to call the method as an update and accept consensus latency. Ledgers implementing ICRC-3 already certify their tip: `icrc3_get_tip_certificate` returns `opt { certificate; hash_tree }`, which verifies with `verifyCertification` like any witness below (labels `last_block_index`, a LEB128 number, and `last_block_hash`, so decode them instead of the helper's UTF-8 compare).\n\nStatic frontends served by the certified-assets canister (`@dfinity\u002Fstatic-site` recipe) are certified automatically: load the `static-site` skill for those.\n\n## Versions\n\n| Side | Package | Version | Used for |\n|------|---------|---------|----------|\n| Rust | `ic-cdk` | 0.20 | `certified_data_set` \u002F `data_certificate` |\n| Rust | `ic-certification` (feature `serde`) | 4 | `RbTree` Merkle map with witnesses |\n| Rust | `ic-http-certification` | 4 | certifying `http_request` responses |\n| Motoko | `core` | 2.6 | `mo:core\u002FCertifiedData` |\n| Motoko | `ic-certification` (mops) | 1.1 | `CertTree` Merkle tree with witnesses |\n| Motoko | `sha2` (mops) | 0.2 | hashing a single certified value |\n| Frontend | `@icp-sdk\u002Fcore` | ^6 | agent, `Certificate`, `lookup_path` |\n| Frontend | `@dfinity\u002Fcertificate-verification` | ^4 | witness verification (peers `@icp-sdk\u002Fcore` ^6, takes `Uint8Array`) |\n\n`ic-certified-map` 0.4 exposes the same `RbTree`\u002F`AsHashTree` API and still works, but `ic-certification` is maintained alongside `ic-http-certification` and is what the official examples use.\n\n## Root Key\n\nClient-side verification needs the root key of the network the canister runs on:\n- **Browser:** `safeGetCanisterEnv()?.IC_ROOT_KEY` from the `ic_env` cookie (`@icp-sdk\u002Fcore\u002Fagent\u002Fcanister-env`), set by the frontend canister on local networks and mainnet alike. It is the key of the network serving the page; to verify a canister on another network (e.g. mainnet data from a local dev server), use that network's key. It is only as trustworthy as the page: on a verifying hostname the gateway verifies the cookie along with the page, but a page from a `raw` hostname can carry a forged key, so a client verifying `raw` responses needs an independently obtained key.\n- **Node scripts and tests:** `root_key` from `icp network status --json`, hex-decoded to bytes.\n- **Mainnet:** the agent's built-in default (`agent.rootKey` on an agent created without `rootKey`): `308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae`\n\nNever call `fetchRootKey()` in shipped code: it trusts whatever key the replica sends (see the `canister-security` skill).\n\n## Pitfalls\n\n1. **Certifying more than 32 bytes.** `certified_data_set` \u002F `CertifiedData.set` accept at most 32 bytes. Build a Merkle tree over the data and certify its root hash; the tree provides per-key proofs.\n\n2. **Setting certified data in a query, or not at install and after every change.** `certified_data_set` can be called from `canister_init`, `canister_post_upgrade`, `canister_pre_upgrade`, update methods, reply\u002Freject callbacks, and system tasks (heartbeat, global timer, low-Wasm-memory hook); it traps anywhere else, including any query (even one called as an update) and cleanup callbacks. Certified data starts empty on install, so certify the initial state in `init` (Rust) or the actor body (Motoko), or queries fail verification until the first write. Forgetting to set it after a mutation leaves a stale hash with the same result. Batch writes need only one `certified_data_set` after the last insert.\n\n3. **Expecting a certificate from a call that is not a query call.** `data_certificate()` \u002F `CertifiedData.getCertificate()` return `None`\u002F`null` in update calls, and a query method invoked as an update call counts as one. **`icp canister call` sends an update call unless you pass `--query`**: without it, the Rust example below traps on its `expect`, and the Motoko examples return `certificate = null`. Frontend code calling a `query` method through an actor sends a query call automatically.\n\n4. **Losing the tree on upgrade, not the certified data.** The certified data itself survives upgrades (install and reinstall start it empty). What does not survive is a Merkle tree kept on the heap: the Rust `RbTree` below is wiped on upgrade while the old hash stays set, so `#[post_upgrade]` must rebuild the tree (from stable storage in a real app, see the `stable-memory` skill) and call `certified_data_set` again. A Motoko `CertTree.Store` persists with the actor, so nothing needs re-setting after an upgrade.\n\n5. **Building the witness for the wrong key.** The witness must reveal the exact path being queried; a witness for `users\u002Falice` proves nothing about `users\u002Fbob`.\n\n6. **Treating every non-`Found` lookup as \"absent\".** `lookup_path` returns a status: `Found` (value proven), `Absent` (absence proven), or `Unknown`\u002F`Error` (the witness does not cover the path). Only `Absent` proves a key does not exist. Collapsing `Unknown` into \"not found\" (for example with `lookupResultToBuffer`, which returns `undefined` for all three) lets a replica send a witness for a different key and make a real value look missing.\n\n7. **Skipping the freshness check.** The certificate's `\u002Ftime` is when the subnet signed it; without a bound, a stale certificate with outdated data can be replayed. `verifyCertification` enforces `maxCertificateTimeOffsetMs` (5 minutes is a sensible value); `Certificate.create` enforces ±5 minutes by default (`maxAgeInMinutes`).\n\n8. **Declaring the Motoko `CertTree.Ops` object as stable.** In a persistent actor, `let ct = CertTree.Ops(certStore)` fails with `M0131` (`variable ct is declared stable but has non-stable type`). Declare it `transient let ct = CertTree.Ops(certStore);`; only the `CertTree.Store` is stable.\n\n9. **Certifying an HTTP response without its `IC-CertificateExpression` header.** With `ic-http-certification`, the header carrying the CEL expression must be part of the response you certify; `HttpCertification::response_only`\u002F`full` return `CertificateExpressionHeaderMissing` otherwise. Serve exactly that response, plus the `IC-Certificate` header from `add_v2_certificate_header`, or the HTTP gateway rejects it with `backend_response_verification`.\n\n## Canister\n\n### Rust\n\n```toml\n[package]\nname = \"certified_vars_backend\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[lib]\ncrate-type = [\"cdylib\"]\n\n[dependencies]\ncandid = \"0.10\"\nic-cdk = \"0.20\"\nic-certification = { version = \"4\", features = [\"serde\"] }\nserde = { version = \"1\", features = [\"derive\"] }\nserde_bytes = \"0.11\"\nciborium = \"0.2\"\n```\n\n```rust\nuse candid::{CandidType, Deserialize};\nuse ic_cdk::{init, post_upgrade, query, update};\nuse ic_certification::{AsHashTree, RbTree};\nuse serde_bytes::ByteBuf;\nuse std::cell::RefCell;\n\nthread_local! {\n    \u002F\u002F RbTree is a Merkle-tree-backed map: keys and values are byte slices\n    static TREE: RefCell\u003CRbTree\u003CVec\u003Cu8>, Vec\u003Cu8>>> = RefCell::new(RbTree::new());\n}\n\n\u002F\u002F Update the certified data hash after any modification\nfn update_certified_data() {\n    TREE.with(|tree| {\n        let tree = tree.borrow();\n        \u002F\u002F root_hash() returns a 32-byte SHA-256 hash of the entire tree\n        ic_cdk::api::certified_data_set(&tree.root_hash());\n    });\n}\n\n#[init]\nfn init() {\n    update_certified_data();\n}\n\n#[post_upgrade]\nfn post_upgrade() {\n    \u002F\u002F This example keeps TREE on the heap only: it is empty after an upgrade, while the\n    \u002F\u002F old certified hash is kept. A real canister reinserts its entries from stable storage\n    \u002F\u002F here first; this one re-certifies the empty tree so the hash matches it again.\n    update_certified_data();\n}\n\n#[update]\nfn set(key: String, value: String) {\n    TREE.with(|tree| {\n        let mut tree = tree.borrow_mut();\n        tree.insert(key.as_bytes().to_vec(), value.as_bytes().to_vec());\n    });\n    \u002F\u002F Must update certified hash after every data change\n    update_certified_data();\n}\n\n#[update]\nfn delete(key: String) {\n    TREE.with(|tree| {\n        let mut tree = tree.borrow_mut();\n        tree.delete(key.as_bytes());\n    });\n    update_certified_data();\n}\n\n#[derive(CandidType, Deserialize)]\nstruct CertifiedResponse {\n    value: Option\u003CString>,\n    certificate: ByteBuf,      \u002F\u002F subnet BLS signature\n    witness: ByteBuf,          \u002F\u002F Merkle proof for this key\n}\n\n#[query]\nfn get(key: String) -> CertifiedResponse {\n    \u002F\u002F data_certificate() is only available in query calls (icp canister call --query)\n    let certificate = ic_cdk::api::data_certificate()\n        .expect(\"data_certificate only available in query calls\");\n\n    TREE.with(|tree| {\n        let tree = tree.borrow();\n\n        \u002F\u002F Look up the value\n        let value = tree.get(key.as_bytes())\n            .map(|v| String::from_utf8(v.clone()).unwrap());\n\n        \u002F\u002F Build a witness (Merkle proof) for this specific key\n        let witness = tree.witness(key.as_bytes());\n\n        \u002F\u002F Serialize the witness as CBOR\n        let mut witness_buf = vec![];\n        ciborium::into_writer(&witness, &mut witness_buf)\n            .expect(\"Failed to serialize witness as CBOR\");\n\n        CertifiedResponse {\n            value,\n            certificate: ByteBuf::from(certificate),\n            witness: ByteBuf::from(witness_buf),\n        }\n    })\n}\n\n\u002F\u002F Required by the icp-cli Rust recipe, which extracts the Candid interface from the wasm\nic_cdk::export_candid!();\n```\n\n### Motoko: single value\n\nA single value needs no Merkle tree: certify its hash, and the client compares `sha256(value)` with the certificate's `certified_data` (see \"Single value without a witness\").\n\n```motoko\nimport CertifiedData \"mo:core\u002FCertifiedData\";\nimport Text \"mo:core\u002FText\";\n\u002F\u002F Requires: mops add sha2\nimport Sha256 \"mo:sha2\u002FSha256\";\n\npersistent actor {\n\n  \u002F\u002F Simple certified single-value example:\n  var certifiedValue : Text = \"\";\n\n  \u002F\u002F Certify the hash of the current value (max 32 bytes; traps in a query call)\n  func certify() {\n    CertifiedData.set(Sha256.fromBlob(#sha256, Text.encodeUtf8(certifiedValue)));\n  };\n\n  \u002F\u002F Certify the initial value at install: certified data starts empty, not as sha256(\"\")\n  certify();\n\n  \u002F\u002F Set a certified value (update call only)\n  public func setCertifiedValue(value : Text) : async () {\n    certifiedValue := value;\n    certify();\n  };\n\n  \u002F\u002F Get the certified value with its certificate (query call)\n  public query func getCertifiedValue() : async {\n    value : Text;\n    certificate : ?Blob;\n  } {\n    {\n      value = certifiedValue;\n      certificate = CertifiedData.getCertificate();\n    }\n  };\n};\n```\n\n### Motoko: key-value store with witnesses\n\n`CertTree` from the `ic-certification` mops package (`mops add ic-certification`) is a Merkle tree that produces per-key witnesses:\n\n```motoko\nimport CertifiedData \"mo:core\u002FCertifiedData\";\nimport Blob \"mo:core\u002FBlob\";\nimport Text \"mo:core\u002FText\";\n\u002F\u002F Requires: mops add ic-certification\nimport CertTree \"mo:ic-certification\u002FCertTree\";\n\npersistent actor {\n\n  \u002F\u002F CertTree.Store is stable -- the tree persists across upgrades, and so does the certified data\n  let certStore : CertTree.Store = CertTree.newStore();\n  \u002F\u002F Ops is an object with functions, not stable data: it must be transient\n  transient let ct = CertTree.Ops(certStore);\n\n  \u002F\u002F Set certified data on init\n  ct.setCertifiedData();\n\n  \u002F\u002F Set a key-value pair and update certification\n  public func set(key : Text, value : Text) : async () {\n    ct.put([Text.encodeUtf8(key)], Text.encodeUtf8(value));\n    \u002F\u002F CRITICAL: call after every mutation to update the subnet-certified root hash\n    ct.setCertifiedData();\n  };\n\n  \u002F\u002F Delete a key and update certification\n  public func delete(key : Text) : async () {\n    ct.delete([Text.encodeUtf8(key)]);\n    ct.setCertifiedData();\n  };\n\n  \u002F\u002F Query with certificate and Merkle witness for the requested key\n  public query func get(key : Text) : async {\n    value : ?Blob;\n    certificate : ?Blob;\n    witness : Blob;\n  } {\n    let path = [Text.encodeUtf8(key)];\n    \u002F\u002F reveal() generates a Merkle proof for this specific path\n    let witness = ct.reveal(path);\n    {\n      value = ct.lookup(path);\n      certificate = CertifiedData.getCertificate();\n      witness = ct.encodeWitness(witness);\n    }\n  };\n};\n```\n\n### Custom `http_request` canisters\n\nCanisters that serve HTTP from their own `http_request` must certify each response with `ic-http-certification` so the HTTP gateway can verify it. Read `references\u002Fhttp-certification.md` before writing one: it has a complete, minimal canister (certify in `init`\u002F`post_upgrade`, attach the witness in `http_request`, and a certified 404 for every other path) and the header rules from pitfall 9. Every path the gateway can request needs a certified response: an uncertified error or 404 is rejected with `backend_response_verification`.\n\n## Client Verification (TypeScript)\n\n`@icp-sdk\u002Fcore` ships every primitive (`Certificate.create`, `Cbor`, `reconstruct`, `lookup_path`); `@dfinity\u002Fcertificate-verification` wraps them for the witness case: it verifies the certificate signature, checks `\u002Ftime`, decodes the witness, and checks that its root hash equals the certificate's `certified_data`. Candid `blob` fields arrive as `Uint8Array` in `@icp-sdk\u002Fbindgen` bindings. bindgen turns `opt` record fields into optional properties that are `undefined` when empty. The helpers take the getters' responses as returned: a Motoko `?Blob` value or certificate is `Uint8Array | undefined`, and the witness helper decodes a `Uint8Array` value as UTF-8. Take the root key from \"Root Key\".\n\n### With a witness\n\n```typescript\nimport { verifyCertification } from \"@dfinity\u002Fcertificate-verification\";\nimport { lookup_path, LookupPathStatus } from \"@icp-sdk\u002Fcore\u002Fagent\";\nimport { Principal } from \"@icp-sdk\u002Fcore\u002Fprincipal\";\n\nconst MAX_CERT_TIME_OFFSET_MS = 5 * 60 * 1000; \u002F\u002F 5 minutes\n\nexport async function getVerifiedValue(\n  rootKey: Uint8Array,\n  canisterId: string,\n  key: string,\n  \u002F\u002F value is opt text (Rust) or ?blob (Motoko); certificate is a blob (Rust) or ?blob (Motoko)\n  response: {\n    value?: string | Uint8Array | null;\n    certificate?: Uint8Array | null;\n    witness: Uint8Array;\n  },\n): Promise\u003Cstring | null> {\n  if (!response.certificate) throw new Error(\"no certificate: call the getter as a query\");\n  const value =\n    response.value instanceof Uint8Array\n      ? new TextDecoder().decode(response.value)\n      : (response.value ?? null);\n  \u002F\u002F Checks signature, time and root hash; throws CertificateTimeError or CertificateVerificationError.\n  const tree = await verifyCertification({\n    canisterId: Principal.fromText(canisterId),\n    encodedCertificate: response.certificate,\n    encodedTree: response.witness,\n    rootKey,\n    maxCertificateTimeOffsetMs: MAX_CERT_TIME_OFFSET_MS,\n  });\n\n  \u002F\u002F The path must match how the canister inserted the key (here: UTF-8 bytes).\n  const result = lookup_path([new TextEncoder().encode(key)], tree);\n  switch (result.status) {\n    case LookupPathStatus.Found: {\n      const verified = new TextDecoder().decode(result.value);\n      if (value !== verified) throw new Error(\"value does not match witness\");\n      return verified;\n    }\n    case LookupPathStatus.Absent:\n      if (value !== null) throw new Error(\"witness proves the key is absent\");\n      return null;\n    default:\n      \u002F\u002F Unknown\u002FError: the witness does not cover this key, so it proves nothing\n      throw new Error(`witness does not cover key (${result.status})`);\n  }\n}\n```\n\n### Single value without a witness\n\n`verifyCertification` needs a witness tree, so verify the Motoko single-value example with `Certificate.create` directly. It checks the signature and the ±5 minute freshness window:\n\n```typescript\nimport { Certificate, lookupResultToBuffer, uint8Equals } from \"@icp-sdk\u002Fcore\u002Fagent\";\nimport { Principal } from \"@icp-sdk\u002Fcore\u002Fprincipal\";\n\nexport async function verifySingleValue(\n  rootKey: Uint8Array,\n  canisterId: string,\n  \u002F\u002F certificate is ?blob in the Motoko getter; empty means it did not run as a query call\n  response: { value: string; certificate?: Uint8Array | null },\n): Promise\u003Cstring> {\n  if (!response.certificate) throw new Error(\"no certificate: call the getter as a query\");\n  const principal = Principal.fromText(canisterId);\n  const cert = await Certificate.create({\n    certificate: response.certificate,\n    rootKey,\n    principal: { canisterId: principal },\n  });\n  const certifiedData = lookupResultToBuffer(\n    cert.lookup_path([\"canister\", principal.toUint8Array(), \"certified_data\"]),\n  );\n  \u002F\u002F Recompute what the canister certified: sha256 of the UTF-8 value\n  const hash = new Uint8Array(\n    await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(response.value)),\n  );\n  if (!certifiedData || !uint8Equals(certifiedData, hash)) {\n    throw new Error(\"value does not match certified data\");\n  }\n  return response.value;\n}\n```\n\nA runnable single-value example with a browser frontend that verifies with `Certificate.create` is [dfinity\u002Fexamples `motoko\u002Fcert-var`](https:\u002F\u002Fgithub.com\u002Fdfinity\u002Fexamples\u002Ftree\u002Fmaster\u002Fmotoko\u002Fcert-var). It certifies the raw 4-byte `Nat32` instead of a hash.\n\n## Checking It Works\n\n```bash\nicp canister call backend set '(\"greeting\", \"hello world\")'\nicp canister call --query backend get '(\"greeting\")'\n# Expected: certificate = blob \"...\" (Rust) \u002F opt blob \"...\" (Motoko); null or a trap means the call was not a query\n```\n\nThen run the client function against a response: it must return the value, and must throw once `response.value` is changed.\n",{"name":5,"license":15,"metadata":49,"description":7,"compatibility":52},{"title":50,"category":51},"Certified Variables","Security","icp-cli >= 0.2.2","main","3df1d0d67b30ff15236561f8c0f9f06d33f42dfd","skills\u002Fchains\u002Fdfinity-official-certified-variables",17,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia","https:\u002F\u002Feth2030.com","Hardcore infra. Building @alt-research and applied cryptography.","2026-11-15 02:28:10",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add jiayaoqijia\u002Fcryptoskill --skill certified-variables",{"tool":68,"command":69},"bunx","bunx skills add jiayaoqijia\u002Fcryptoskill --skill certified-variables",{"tool":71,"command":72},"pnpm","pnpm dlx skills add jiayaoqijia\u002Fcryptoskill --skill certified-variables","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002FSKILL.md",true,[76,80,86,90],{"path":77,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":16},"LICENSE","许可证",10770,{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fhttp-certification.md","REFERENCE","参考文档",5246,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002Freferences\u002Fhttp-certification.md",{"path":87,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":88,"sourceHtmlUrl":89},"SOURCE.md",337,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002FSOURCE.md",{"path":91,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":92,"sourceHtmlUrl":93},"TRUST.auto.yaml",2197,"https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fchains\u002Fdfinity-official-certified-variables\u002FTRUST.auto.yaml",[95,105,113,121,129,137],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":104},"01M7DTKCERMV0RNX3HZJP4CZ26","troves","Deposit and withdraw from Troves DeFi yield vault strategies on Starknet. View available strategies, check positions, and manage vault deposits. Use this skill when the user mentions Troves, vault, yield vault, DeFi vault, strategy, yield farming, vault deposit, vault withdraw, earning yield through vaults, passive yield strategies, or wants to deposit into or withdraw from a yield strategy — even if they don't say \"Troves\" explicitly.","MIT","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-troves\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":104},"01M7DTK6CJSMGC8KCQHGNYFZBD","trade","Swap tokens on Starknet via Fibrous DEX aggregator. Supports per-provider selection (avnu, ekubo, or auto to race all). Use this skill when the user wants to swap, exchange, trade, convert, buy, or sell one token for another on Starknet. Also use when the user asks about token prices, exchange rates, DEX routing, best swap route, or wants to check how much they would receive for a given amount — even if they don't explicitly say \"swap\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-trade\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":104},"01M7DTJZ6A0X4PAW3Y8W4J9K64","staking","Stake, unstake, claim, and compound rewards for STRK, WBTC, tBTC, SolvBTC, and LBTC on Starknet. View validators, pools, and staking positions. Use this skill when the user mentions staking, delegating, validators, staking pools, rewards, compounding, unstaking, earning yield, passive income on crypto, or wants to earn on their STRK or BTC tokens — even if they don't say \"stake\" explicitly.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-staking\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":104},"01M7DTJSDZJKCDMW7GHRF4BRH5","send","Send STRK, ETH, or any ERC-20 token to a Starknet address. Supports simulation (dry-run) before execution. Use this skill when the user wants to send, transfer, pay, tip, or move tokens to another wallet address on Starknet. Also trigger when the user mentions sending funds to someone, making a payment, transferring assets, or moving crypto to a specific address — even if they just say \"pay 10 STRK to 0x...\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-send\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":133,"sourceHtmlUrl":134,"categories":135,"keywords":136,"publishedAt":104},"01M7DTJG1E480D51ZQ7WKDQ26K","portfolio","View a comprehensive DeFi portfolio dashboard and optimize portfolio allocation via automated rebalancing. Use this skill when the user wants an overview, summary, dashboard, total value, net worth, portfolio rebalancing, target allocation, or wants to see all their DeFi positions across Starknet at once. Also trigger when the user asks \"what do I have\", \"show me everything\", \"how much am I worth\", \"my positions\", \"my investments\", \"rebalance my portfolio\", \"I want 50% ETH\", \"optimize my holdings\", or any request for a holistic view of their Starknet holdings — even if they don't explicitly say \"portfolio\".","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-portfolio\u002FSKILL.md",[],[],{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":99,"licenseFileUrl":141,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":104},"01M7DTJ7M8TE9R2N36HFBZDGVD","multi-swap","Execute multiple token swaps in a single Starknet transaction via Fibrous (default). Supports per-provider selection (avnu, ekubo, or auto to race all). Supports 2-3 swap pairs bundled into one multicall. Use this skill when the user wants to swap multiple token pairs at once, do batch swaps, execute several trades simultaneously, perform parallel swaps, or do bulk trading in one transaction. Also trigger when the user mentions \"two swaps\", \"three swaps\", \"swap X and Y at the same time\", or wants to convert multiple tokens in a single call.","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fjiayaoqijia\u002Fcryptoskill\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-servers\u002Fahmetenesdur-multi-swap\u002FSKILL.md",[],[]]