Skip to content
stxscript. GitHub

← Use cases

TypeScript teams shipping to Stacks

Teams whose devs come from TypeScript, Rust, or Swift

Bitcoin DeFi is pulling application developers toward Stacks, and most of them arrive from typed, C-family languages. Clarity’s Lisp surface is friction, not a flaw. StxScript lets your existing TypeScript, Rust, or Swift team read and write Bitcoin-secured contracts on day one, while the output stays plain, auditable Clarity that settles on Bitcoin.

Familiar surface syntax

Function signatures, generics, decorators, and match expressions read like TypeScript — the mental model your team already has.

A checked type system

Static types surface mistakes in the editor via the LSP, before a contract ever touches testnet.

No lock-in

The committed .clar file is the deployable artifact. If you ever leave StxScript, you keep working Clarity.

onboarding.stx
@public
function transfer(to: principal, amount: uint): Response<bool, uint> {
  let bal = balances.get(tx-sender) ?? 0u;
  if (bal < amount) { return err(1u); }
  balances.set(tx-sender, bal - amount);
  return ok(true);
}