# Bithoven – A high-level, imperative language for Bitcoin Sm…

Hey HN! I’m a researcher working on Bitcoin smart contracts, and today I’m releasing Bithoven—a high-level imperative language that compiles to native Bitcoin Script (Legacy, SegWit, and Taproot). The Goal: Raw Bitcoin Script is notoriously difficult to reason about. Writing raw Bitcoin Script toda…

- **Page:** https://magpie.gallery/i/bithoven-a-high-level-imperative-language-for-bitc-hcls
- **Type:** Link to an idea elsewhere
- **Category:** AI & dev
- **Runs on:** web
- **Tags:** bitcoin, smart-contracts, compiler, programming-language, script

## Source

Web · hyunhum: Bithoven – A high-level, imperative language for Bitcoin Smart Contract

- **Original:** https://news.ycombinator.com/item?id=46273877

> Hey HN! I’m a researcher working on Bitcoin smart contracts, and today I’m releasing Bithoven—a high-level imperative language that compiles to native Bitcoin Script (Legacy, SegWit, and Taproot). The Goal: Raw Bitcoin Script is notoriously difficult to reason about. Writing raw Bitcoin Script today feels like writing Assembly in the 1970s. You have to mentally juggle the stack (`OP_SWAP`, `OP_ROT`), manually manage distinct execution branches, and pray you didn't leave a stack item unconsumed (which crashes the script). My goal was to bridge the gap between complex contract logic and raw opcodes, allowing developers to write readable, compile-time-safe code. Key Features: - Imperative Syntax: Write logic using familiar if/else and return statements instead of mental stack juggling. - Type Safety: First-class support for bool, signature, string, and number types to prevent runtime errors. - Targeted Compilation: Support for Legacy, SegWit, and Taproot compilation targets. - Native Primitives: Built-in keywords for timelocks (older, after) and cryptography (sha256, checksig). You can try it in the browser here (runs via WASM): https://bithoven-lang.github.io/bithoven/ide/ Here is an example of a Hashed Time-Locked Contract (HTLC): (condition: bool, sig_alice: signature) (condition: bool, preimage: string, sig_bob: signature) { if condition { // Relative locktime (Sequence) older 1000; return checksig (sig_alice, alice_pk); } else { // Hashlock verification verify sha256 sha256 preimage == hash; return checksig (sig_bob, bob_pk); } } The project is free open source and the academic paper is currently under review. I’d love to hear any feedback. Thanks for checking it out! https://github.com/ChrisCho-H/bithoven

## GitHub projects

- https://github.com/ChrisCho-H/bithoven

## Rules for reuse

- Build your own version: don't copy another product's code, look, icons, colours or copy.
- The original belongs to its author; Magpie only links to it.
- The original content's copyright belongs to its creator. Magpie doesn't download or re-upload it; we only show the link and the official preview.
