BLOG

Kontor SDK Alpha Release

NEW
DEV
January 19, 2026
We're releasing the first alpha of the Kontor SDK — a TypeScript SDK for building applications on Bitcoin with the Kontor metaprotocol.

Today we're releasing the first alpha of the Kontor SDK — a TypeScript SDK for building applications on Bitcoin with the Kontor metaprotocol.

Kontor distinguishes itself from other smart-contracts-on-Bitcoin systems by offering a full-featured platform with rich, developer-friendly tooling.

What makes the SDK special: from a WIT specification, developers get a fully typed contract interface at compile time.

No code generation. No hand-rolled serialization logic. Just simple interfaces and transparent types.

Links:


WIT as the source of truth

The Kontor SDK treats contract interfaces as executable type definitions. From a WIT specification, the SDK derives function names, call modes (view vs proc), parameter types, return values, and encoding rules — all at the type level.

No codegen step. No generated files. No runtime schema validation.

Contract call correctness is enforced at compile time, not discovered after a transaction fails.


Developer experience

The SDK is intentionally explicit and modular, providing clear separation between querying state, composing calls, and signing transactions. The goal is to abstract away implementation details of Kontor while maintaing transparency of the underlying programming model.

You get:

  • Autocomplete for contract methods
  • Inferred argument and return types
  • Static validation of call signatures
  • Immediate feedback when WIT definitions change


Getting started


Install the SDK:

npm install @kontor/kontor-sdk@alpha

Reading contract state (fully typed)


Define a contract interface using WIT:

import {
  parseWit,
  getContract,
  signet,
  createKontorIndexerClient,
  http,
} from "@kontor/kontor-sdk";

const token = parseWit([
  "record balance { acc: string, amt: decimal }",
  "export balances: func(ctx: borrow<view-context>) -> list<balance>;",
] as const);

The as const is important — it allows the SDK to extract literal types directly from the WIT definition.

Create an indexer client and get a typed contract handle:

const indexerClient = createKontorIndexerClient({
  chain: signet,
  transport: http(),
});

const contract = getContract({
  wit: token,
  contractAddress: "token_0_0",
  client: indexerClient,
});


Call a view function:

const balances = await contract.view.balances();


What you get back is not any:

Array<{  acc: string;  amt: bigint;}>


Key details:

  • The ctx: borrow<view-context> parameter is supplied by the runtime, not the caller
  • Only user-supplied parameters appear in the TypeScript signature
  • When WIT changes, TypeScript errors guide you to update your code

Composing and signing (commit → reveal)

Kontor uses a Taproot P2TR commit-and-reveal scheme to encode contract execution on Bitcoin.

The SDK separates responsibilities:

Indexer client:

  • Composes contract calls ( over proc methods )
  • Queries contract state ( over view methods )

Wallet client:

  • Signs commit and reveal transactions
  • Works with local keys or wallet extensions

Every write follows the same flow:

compose → sign commit → sign reveal → broadcast

For walkthroughs, see Getting Started and Composing + signing a transfer.

What's in the SDK today

The alpha covers the "real application" baseline:

  • Published TypeScript package: @kontor/kontor-sdk
  • WIT-first contract interaction with end-to-end type safety
  • Commit-and-reveal signing abstractions
  • Indexer client (WebSocket support coming soon)
  • Wallet client (supports local keys and browser extensions)

Explore the building blocks:

Alpha status

This is an alpha release. We're optimizing for:

  • Correctness of WIT-derived typing
  • A small, composable API surface
  • Real-world wallet compatibility
  • Developer experience

Expect rough edges — and please tell us when you hit them. Open an issue or PR on GitHub, or reach out through Kontor community channels.

Continue Reading
Text Link
GENERAL
DEV

Write Elegant Smart Contracts with Sigil