Rúnar

Rúnar

Write smart contracts in TypeScript, Go, Rust, or Python. Compile to Bitcoin Script. Deploy to BSV.

[ 01 ] What is Rúnar

The Compiler

Write Bitcoin smart contracts in TypeScript, Go, Rust, Python, Solidity, or Move — languages you already know. Rúnar compiles them to optimized Bitcoin Script that runs natively on BSV's UTXO model.

The SDK

Deploy, call, and manage contracts on BSV with a type-safe SDK that handles the complexity of UTXO-based transactions, fee management, and state tracking for you.

[ 02 ] Languages

Write contracts in the language you're most productive in. Rúnar compiles them all to the same optimized Bitcoin Script.

TypeScript

stable
class Counter extends StatefulSmartContract {
  count: bigint;

  constructor(count: bigint) {
    super(count);
    this.count = count;
  }

  public increment() {
    this.count++;
  }
}

Go

stable
type Counter struct {
    runar.StatefulSmartContract
    Count runar.Bigint
}

func (c *Counter) Increment() {
    c.Count++
}

Rust

beta
#[runar::contract]
pub struct Counter {
    pub count: Bigint,
}

#[runar::methods(Counter)]
impl Counter {
    #[public]
    pub fn increment(&mut self) {
        self.count += 1;
    }
}

Python

stable
class Counter(StatefulSmartContract):
    count: Bigint

    def __init__(self, count: Bigint):
        super().__init__(count)
        self.count = count

    @public
    def increment(self):
        self.count += 1

Solidity

planned
contract Counter {
    int64 count;

    function increment() public {
        count++;
    }
}

Move

planned
module Counter {
    resource struct Counter {
        count: bigint,
    }

    public fun increment(c: &mut Counter) {
        c.count = c.count + 1;
    }
}
[ 03 ] Features

Multi-Language Compiler

Write contracts in TypeScript, Go, Rust, Python, Solidity, or Move. One compiler, many languages.

Type-Safe SDK

Deploy and call contracts with full type inference. Catch errors at compile time, not on-chain.

Stateful Contracts

Build stateful applications using UTXO-native state machines. No account model needed.

Token Standard

First-class support for fungible and non-fungible tokens with built-in compliance.

Built-In Testing

Test contracts locally with a purpose-built test runner. No network required.

Deterministic Output

Same source always compiles to the same Bitcoin Script. Reproducible and auditable.

[ 04 ] Quick Start

From source code to a deployed contract in three steps.

TypeScript
import { StatefulSmartContract, assert } from 'runar-lang';

class Counter extends StatefulSmartContract {
  count: bigint;

  constructor(count: bigint) {
    super(count);
    this.count = count;
  }

  public increment() {
    this.count++;
  }

  public decrement() {
    assert(this.count > 0n);
    this.count--;
  }
}

Follow the full tutorial →

[ 05 ] How It Works

Rúnar transforms high-level contract code into optimized Bitcoin Script through a multi-stage compilation pipeline.

Source Code
TS / Go / Rust
Parser
Language-specific
AST
Typed tree
IR
Intermediate repr
Optimizer
Size & fees
Bitcoin Script
OP_CODES

Each source language has its own parser, but all converge on a shared intermediate representation (IR). The optimizer works on this IR to minimize script size and execution cost before emitting final Bitcoin Script opcodes. The result is a deterministic, auditable output that can be deployed directly to BSV.

Learn more about the compiler →
[ 06 ] Try It Now

Rúnar Playground

Write, compile, and debug contracts directly in your browser. No installation required.

  • Monaco editor with all six languages and auto-completion
  • In-browser compilation — no backend, everything runs in Web Workers
  • Full pipeline visualization: AST, ANF IR, Script (ASM / Hex / Annotated)
  • Step-through Bitcoin Script debugger with real ECDSA signatures
  • Stack and alt-stack inspection at every opcode
  • Stateful contract execution with checkPreimage support
  • Ready-to-run example contracts with auto-generated arguments
Open Playground
runar.run
Editor
class Counter extends StatefulSmartContract {
  count: bigint

  public increment() {
    this.count++
  }
}
Debugger
OP_DUP
OP_HASH160
› OP_EQUALVERIFY
OP_CHECKSIG
Stack
01
a1b2c3d4...