The DFINITY Foundation is committed to restoring the internet’s free and open roots by launching the Internet Computer, the world’s first web-speed blockchain network with unlimited computing power, designed to enhance the developer experience and provide more choice, which is our focus going forward.
The Internet Computer hosts software containers, a scalable evolution of traditional smart contracts that bundles WebAssembly byte code with the memory pages in which the code runs.
This enables developers to build revolutionary interoperable applications, systems, and secure, reliable internet services, leveraging blockchain capabilities such as tokenization, and deploying software directly on the internet instead of on proprietary infrastructure.
To support the growth of the software landscape that is being redefined on open platforms, where different programs can directly integrate with each other and services can be easily combined and extended, our language team developed the Candid Interface Description Language (IDL).
This interface will enable those collaborating on building the Internet Computer ecosystem to connect their code completely and seamlessly, even if written in different languages, and we are excited to describe it in more detail today.
What is Candid?
Candid is an IDL designed specifically for the Internet Computer, which provides a common language for application program interfaces to facilitate communication between services written in different programming languages.
One of the main advantages of Candid is that it is language-agnostic, enabling interoperability between services and front-ends written in different programming languages, such as Motoko, Rust, and JavaScript, etc. It allows developers to safely and seamlessly build services that depend on each other without having to worry about interface upgrades of external services.
Through Candid, we seek to…
Provide interface and data description: Developers using Candid are able to describe the public interface of a service, usually in the form of a program deployed as a container. As a developer, you can call an external service running on the Internet Computer as an asynchronous function call.
Supports evolution of interfaces in principle: Candid supports evolution of service interfaces by specifying precisely the changes that can be made without breaking existing clients, e.g. this means you can safely add new optional parameters to your service without losing compatibility with existing clients.
Support Internet computer function: Candid is particularly suitable for developing Internet computer applications.
Candid is somewhat inspired by similar IDLs and data definition languages (DDLs) such as Protobuf, Thrift, and JSON, but Candid offers a unique combination of features not found in these other technologies:
Candid is a complete interface description language, not just a data description language.
Candid implementations can map Candid values directly to host language types and values.
Candid is essentially a high-level language that allows message parameters to contain references to other services and methods.
Candid has built-in support for specific Internet Computer features such as query annotation.
Candid defines rules about how to upgrade services and their interfaces in a reasonable and comprehensive way, including high-level usage.
How to use Candid?
The main purpose of Candid is to connect programs written in some host language (such as Motoko, Rust, or JavaScript) with the Internet Computer. In most cases, you don't have to deal with program data as Candid values.
Instead, you can use a host language like JavaScript using familiar JavaScript values, and then rely on Candid to transparently transfer those values to containers written in Rust or Motoko. The container receives these values and treats them as raw Rust or Motoko values.
In some cases, it is useful to view the Candid value directly in human-readable form - for example, when logging, debugging, or interacting with a service on the command line. In these cases, you can use the textual representation for the Candid value.
Candid is a strongly typed system, with a set of types that canonically cover most uses (to see the list, see our SDK page).
The rationale behind this set of types is that they are sufficient to describe the structure of data so that information can be encoded, passed, and decoded, but they do not attempt to describe semantic constraints beyond this.
Whether you're writing code in Motoko, Rust, JavaScript, or something else, Candid supports this set of types to allow for natural mapping of data types based on sensible, canonical choices appropriate for each host language.
Candid types can be used to describe services through a Candid service description file (.did file), which can be written manually or generated from a service implementation.
For example, if you write a container in Motoko, the compiler automatically generates a Candid description when it compiles your program.
In other languages, such as Rust, you would have to write the Candid interface description manually. With the help of types, we developed tools to automatically generate UIs and perform random tests based on the service description files.
Candid is also useful for service upgrades, services evolve over time, they gain new methods, and existing methods return more data, or expect additional parameters. Often, the service author wants to do this without breaking existing clients.
Candid helps services evolve safely by defining precise subtyping rules (formalized in Coq!) that dictate when a new service type will still be able to communicate with all other parties described using the previous interface.
Interested in learning more? Here are some Candid-related materials to get you started…
Tutorials and Resources by Candid
Candid's Explanation Video: You can watch the video tutorial on how to use Candid at the beginning of the article.
Candid documentation and tutorials: You can access the documentation for Candid on our SDK website: https://sdk.dfinity.org/docs/candid-guide/candid-intro.html
Candid Crate: Candid Crate is a serialization/deserialization library that can be used to create Candid services or clients in Rust: https://crates.io/crates/candid
Internet Computer Proxy Library for JavaScript: This proxy includes support for Candid.
Community supported Candid libraries: Libraries currently exist for Haskell, Elm, AssemblyScript, and Kotlin.
Candid UI: This container generates a front-end UI for any container running on the Internet Machine, enabling developers to interact with containers on the web (rather than a terminal) and providing debugging capabilities.

IC content you care about
Technology Progress | Project Information | Global Activities
Collect and follow IC Binance Channel
Answer your questions at any time

