Lucid (cdk-c) - Alpha Release: Build IC Canisters in C

Lucid (cdk-c) Alpha: Build Internet Computer Canisters in C

Build Internet Computer canisters in C with Lucid (cdk-c) – a lightweight, intuitive Canister Dev Kit.

:warning: Alpha Release: This is an early release. The project is under active development and continuously being improved. API may change, and feedback is welcome.

Write Canisters in C

If you’re a C developer, you’ll feel right at home. No new languages to learn, no complex frameworks to master—just clean C code that compiles directly to efficient WASM.

Here’s what a simple canister code looks like:


#include "ic_c_sdk.h"

IC_CANDID_EXPORT_DID()

// Simple query returning text

IC_API_QUERY(greet, "(text) -> (text)") {

IC_API_REPLY_TEXT("Hello from C canister!");

}

That’s it. Three lines of actual code, and you have a fully functional canister query. The API automatically handles memory management, Candid serialization/deserialization, IC system call details, and error handling. No boilerplate. No manual cleanup. Just write your logic.

What’s Included

Core Features

  • Clean, minimal apis (IC_API_QUERY, IC_API_UPDATE) for query/update calls

  • Candid support – primitives, vec, opt, nested types, automatic .did generation

  • Inter-canister calls with reply/reject callbacks

  • HTTP outcalls & stable memory API support

  • Python build system with automatic WASM optimization

  • PocketIC testing framework integration

  • Multiple working examples covering different use cases

Why Lucid?

Pure C, No Compromises

Built entirely in C from the ground up, straightforward C code that gives you precise control.

Simple API That Just Works

If you know C, you can start building canisters in minutes. The macros eliminate boilerplate and handle complexity automatically, so you can focus on your logic.

Lightweight & Fast

Minimal dependencies mean fast compilation and small WASM binaries. Your canisters will be lean and efficient.

Design Philosophy: Make the common case easy, and the complex case possible. For simple functions, you write minimal code. For complex scenarios, you have full control without fighting the framework.

Quick Start


# Clone repo

git clone https://github.com/q2333gh/Lucid --depth=1

cd Lucid

# create a new project

python build.py --new my_canister

python build.py --icwasm --examples my_canister

pytest examples/my_canister/test/

Example Projects

Core examples to get you started:

  • hello_lucid - Basic queries (greet, caller, canister ID)

  • adder - Simple counter with state update

  • types_example - Comprehensive Candid type usage (primitives, records, variants, vec, opt)

  • inter-canister-call - Cross-canister calls with reply/reject callbacks

  • http_request - HTTP outcalls (GET requests with headers)

  • timer - One-time and periodic timers

  • canister_lifecycle - Pre/post upgrade hooks with stable memory

See examples/ directory for more examples.

Current Status

What’s Working

  • :white_check_mark: Complete core CDK functionality with build script

  • :white_check_mark: Inter-canister calls with callback support

  • :white_check_mark: HTTP outcalls with automatic cycle calculation

  • :white_check_mark: Time and lifecycle APIs

  • :white_check_mark: Stable memory API

  • :white_check_mark: Multiple example projects

  • :white_check_mark: Testing infrastructure with PocketIC

What’s Coming Next

  • Few of supplyment apis to finish

  • Concise API reference documentation (in progress)

  • More examples and tutorials

  • API refinements based on community feedback

Getting Help & Feedback

  • GitHub: https://github.com/q2333gh/Lucid - Issues, discussions, and contributions welcome

  • Documentation:

  • See doc/ directory for guides

  • API Reference: Concise, key API documentation is currently being written and will be available soon (documentation is continuously being improved)

  • In the meantime, check header files in cdk-c/include/ for API details

  • Examples: Check examples/ for working code samples—these are the best way to learn the API right now

We’re actively refining the API based on community feedback. If you encounter bugs or issues, we’ll fix them. Feel free to share your thoughts—open a GitHub issue or join the discussion on the post.

If you find it useful, consider giving us a star on GitHub.

Thank You

Thank you for taking the time to check out Lucid. We’re excited to see what you’ll build with it!

7 Likes

You are a godsend sir, and this is a language I can actually write. I’ll have to try this later.

1 Like

Thanks, glad to hear that.

That’s exactly the audience Lucid is targeting—developers who are comfortable in C and just want to write canister logic without switching languages or fighting a heavy framework.

It’s still alpha, so if anything feels awkward or limiting when you try it, feedback is very welcome.

1 Like

Great job!

C is experiencing a rebirth especially for AI related local models, so this will be quite useful, not to mention the huge amount of algorithms written in C.

Happy New Year too :wink:

1 Like