Skip to content

Offchain Calls

TODO: Write content for this page.

Call canister functions from outside the IC using agent libraries. Explain the IC agent concept: a client-side library that constructs ingress messages, signs them, and sends them to boundary nodes. Cover the agent ecosystem: official agents for JavaScript/TypeScript (@dfinity/agent / @icp-sdk/core) and Rust (ic-agent), plus community agents for Go, Python, Java, Dart, .NET, Elixir, C, and others. Show basic setup and a query/update call example for the two official agents. Cover canister discovery (env vars, ic_env cookie, PUBLIC_*_CANISTER_ID), the query vs update distinction from the caller perspective (agents route queries to a single replica for speed and route updates through consensus for reliability — Candid annotations determine which type each method uses, and generated bindings handle this automatically), authentication context (anonymous, delegations from Internet Identity), and error handling. Show how generated bindings (from binding-generation) provide a typed interface. Link to community agents for other languages.

  • guides/canister-calls/candid — interface definitions (shared by all agents)
  • guides/canister-calls/binding-generation — generating typed clients
  • guides/canister-calls/onchain-calls — canister-to-canister alternative
  • guides/frontends/asset-canister — deploying the frontend that makes these calls
  • guides/authentication/internet-identity — adding auth to calls