Bitcoin Forum
December 29, 2025, 04:59:04 AM *
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 83 times)
hyunhum (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 18


View Profile
December 13, 2025, 11:39:06 AM
Last edit: December 18, 2025, 01:37:38 PM by hyunhum
 #1

Hi everyone, I'm a phd student researching in the area of cybersecurity, mostly blockchain Smiley

As you may know, Bitcoin doesn't support high-level smart contracts (unlike Ethereum), but only an assembly-like "Bitcoin Script," which is really challenging to write (just like in the 1970s assembly era). Since wrong code directly causes security vulnerabilities like unspendable or anyone-can-spend coins, I've researched how to build high-level Bitcoin smart contracts safely, studying many of the efforts ongoing both in the Bitcoin(e.g. miniscript) and Ethereum(e.g. EVM and Solidity).

Now, I have finally released Bithoven v0.0.1 as free, open-source software with a Web IDE, documentation, and the compiler code itself. I would be grateful for any feedback, code reviews, or contributions from anyone interested in security, programming languages, and obviously Bitcoin!

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

Key features are following:

  • Imperative Syntax: Write logic using familiar if, else, and return statements instead of agonizing Bitcoin Script.
  • Type Safety: First-class support for bool, signature, string, and number types to prevent common type 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).

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");
    }
}


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

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.
Thanks for checking it out!
hyunhum (OP)
Newbie
*
Offline Offline

Activity: 4
Merit: 18


View Profile
December 18, 2025, 01:35:48 PM
 #2

For more example bithoven codes(e.g. multi-sig, inheritance contract), you can see : https://github.com/ChrisCho-H/bithoven/tree/main/example
BattleDog
Full Member
***
Offline Offline

Activity: 122
Merit: 147


View Profile
December 23, 2025, 05:06:03 PM
 #3

Anything that gets people out of stack hell while still producing plain native Script is a win

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!