#bitcoin #sdk #charms-sdk

charms-sdk

Charms SDK: the only dependency needed to build ZK apps on Bitcoin

18 releases (4 breaking)

0.5.4 Apr 5, 2025
0.5.3 Mar 31, 2025
0.4.1 Feb 24, 2025
0.3.4 Feb 20, 2025
0.1.10 Dec 31, 2024

#226 in #bitcoin

35 downloads per month

MIT license

6KB

This is the only crate you need to get started coding a Charms app.

Usage

Run this command to create a new Charms app:

charms app new my-app

It will create a new directory called my-app with a basic Charms app template.

It'll have this in Cargo.toml:

[dependencies]
charms-sdk = { version = "0.3.0" }

This is how the entire src/main.rs looks like:

#![no_main]
charms_sdk::main!(my_app::app_contract);

The most important function in the app is app_contract in src/lib.rs:

use charms_sdk::data::{
    check, App, Data, Transaction, NFT, TOKEN,
};

pub fn app_contract(app: &App, tx: &Transaction, x: &Data, w: &Data) -> bool {
    match app.tag {
        NFT => {
            check!(nft_contract_satisfied(app, tx, x, w))
        }
        TOKEN => {
            check!(token_contract_satisfied(app, tx, x, w))
        }
        _ => todo!(),
    }
    true
}

Dependencies

~8MB
~174K SLoC