Rúnar
Write smart contracts in TypeScript, Go, Rust, or Python. Compile to Bitcoin Script. Deploy to BSV.
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.
Write contracts in the language you're most productive in. Rúnar compiles them all to the same optimized Bitcoin Script.
TypeScript
stableclass Counter extends StatefulSmartContract {
count: bigint;
constructor(count: bigint) {
super(count);
this.count = count;
}
public increment() {
this.count++;
}
} Go
stabletype 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
stableclass Counter(StatefulSmartContract):
count: Bigint
def __init__(self, count: Bigint):
super().__init__(count)
self.count = count
@public
def increment(self):
self.count += 1 Solidity
plannedcontract Counter {
int64 count;
function increment() public {
count++;
}
} Move
plannedmodule Counter {
resource struct Counter {
count: bigint,
}
public fun increment(c: &mut Counter) {
c.count = c.count + 1;
}
} 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.
From source code to a deployed contract in three steps.
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--;
}
}Rúnar transforms high-level contract code into optimized Bitcoin Script through a multi-stage compilation pipeline.
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 →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
class Counter extends StatefulSmartContract {
count: bigint
public increment() {
this.count++
}
}