Bitcoin Forum
December 15, 2025, 11:54:05 PM *
News: Latest Bitcoin Core release: 30.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bithoven: High-level, imperative programming language for Bitcoin smart contract  (Read 27 times)
hyunhum (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 18


View Profile
December 13, 2025, 11:39:06 AM
 #1

👋 Hi everyone,

We all know the challenges of working with raw Bitcoin Script. Raw Bitcoin Script is notoriously difficult. Mental stack management is error-prone, and security bugs are a constant worry.

I’ve spent some time developing 🎼 Bithoven—an experimental, high-level imperative Bitcoin smart contract language designed to bridge the gap between complex contract logic and the Bitcoin Script.

The goal is simple: write readable, compile-time-safe code that compiles down to efficient, native Bitcoin Script (supporting Legacy, SegWit, and Taproot).

Why Bithoven?

  • 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 common runtime errors.
  • Multiple Spending Paths: Define complex contracts (like HTLCs) with distinct execution branches and input stack requirements.
  • Targeted Compilation: Support for legacy, segwit, and taproot compilation targets via pragmas.
  • Native Bitcoin Primitives: Built-in keywords for timelocks (older, after), cryptography (sha256, checksig), and verification (verify).

Bithoven in a nutshell:

Instead of writing raw opcodes like OP_IF <timeout> OP_CHECKSEQUENCEVERIFY..., Bithoven allows you to define logic clearly. Here is the actual code for a Hashed Time-Locked Contract:

Code:
pragma bithoven version 0.0.1;
pragma bithoven target segwit;

(condition: bool, sig_alice: signature)
(condition: bool, preimage: string, sig_bob: signature)
{
    // If want to spend if branch, condition witness item should be true.
    if condition {
        // Relative locktime for 1000 block confirmation.
        older 1000;
        // If locktime satisfied, alice can redeem by providing signature.
        return checksig (sig_alice, "0245a6b3f8eeab8e88501a9a25391318dce9bf35e24c377ee82799543606bf5212");
    } else {
        // Bob needs to provide secret preimage to unlock hash lock.
        verify sha256 sha256 preimage == "53de742e2e323e3290234052a702458589c30d2c813bf9f866bef1b651c4e45f";
        // If hashlock satisfied, bob can redeem by providing signature.
        return checksig (sig_bob, "0345a6b3f8eeab8e88501a9a25391318dce9bf35e24c377ee82799543606bf5212");
    }
}

🛠️ Try it out:

I’ve put together a Web IDE so you can experiment with the syntax and see the compiled output instantly—no installation required.

Web IDE: https://bithoven-lang.github.io/bithoven/ide/
Documentation: https://bithoven-lang.github.io/bithoven/docs/
GitHub: https://github.com/ChrisCho-H/bithoven

⚠️ Current Status: Bithoven is free, open-source software. Please note that the project (and its accompanying academic paper) is currently under review and in the experimental stage.

I would be incredibly grateful for any feedback, code reviews, or contributions from the Bitcoin community. If you think this approach has potential, a Star ⭐ on GitHub would mean a lot!

Thanks for checking it out!
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!