Inspiration

Bitcoin is able to express complex and powerful spending conditions using script, the language bitcoin uses to define the spending conditions of UTXOs. Unfortunately, this capability is currently underused. One reason that we’re not anywhere close to using Script’s full potential is that actually constructing scripts for non-trivial tasks is cumbersome: it’s hard to verify their correctness and security, and even harder to find the most economical way to write things.

That’s only part of the problem: even when you know the right script, designing applications and protocols to negotiate and construct transactions using it needs a lot of ad-hoc development work each time a new script is designed. Enter Miniscript, a language for representing Bitcoin Scripts in a structured way, enabling efficient analysis, composition, generic signing and more. Miniscript enables users to take advantage of the full power enabled by Bitcoin Script, introducing new possibilities for self custody.

What it Does

Bitscriptr is a visual tool for crafting Miniscript policies for bitcoin wallet descriptors. It can serve as a valuable learning aid, a prototyping tool for developers, and a way for advanced users to confidently build complex spending conditions. A descriptor is also known as an “output descriptor” because it’s technically defining the conditions for creating and spending transaction outputs within a wallet.

The wallet descriptor can then be imported into wallets supporting miniscript e.g bitcoin core, sparrow wallet, hardware wallets such as ledger, blockstream jade, BitBox02 etc. Allowing them to correctly track the funds and build spending transactions according to those complex rules, all without the user needing to understand the underlying bitcoin scripting language.

With Bitscriptr, you can set up truly unique and powerful security rules for your Bitcoin, beyond what standard wallets typically offer.

Bitscriptr has complete support of miniscript policies and the composition of spending conditions

  • Single signature (pk(key): Require public key named NAME to sign. )
  • Multisignature (thresh(NUM,key,key,...))
  • Time-Based Conditions (after(NUM), older(NUM))
  • Hash-Based Conditions (sha256(HEX), hash256(HEX),ripemd160(HEX), hash160(HEX))

Composition of Policies

  • and(POL,POL)
  • Thresholds (thresh(NUM,POL,POL,...))
  • or([N@]POL,[N@]POL)

Bitscriptr also implement some of the more common complex spending patterns for easy configurations

  • Simple Escrow:
    • N of N keys can spend
    • Arbiter can spend after delay.
  • Basic Vault policy: Vaults typically involve multiple keys, time locks, and potentially "veto" keys to enhance security and provide recovery mechanisms.
    • M of N key can spend after some delay
    • A cancel key can spend before delay. (serves as some sort of veto)
  • Inheritance Schemes:
    • Owner's key (can always spend).
    • After some configured time, Any two (2) keys from the owner's spouse and kids can spend -A third party, in case all else failed after some presumably longer duration

All spending conditions are enforced onchain by the bitcoin network. Your data stays private: Everything is done client-side and never leaves your browser.

Accomplishments

  • The foundational pieces to solve the problem of providing a GUI builder for Miniscript policies and descriptors have been built.
  • By making constructing miniscript policies more accessible and less error-prone, the project has the potential to lower the barrier to entry for using advanced scripting features, which can enhance the security and functionality of Bitcoin wallets and applications.

What’s Next

  • Display spending cost of miniscript to the user.
  • Display all valid spending pathways of the the script to the user in a coherent manner.
  • Implement additional common spending patterns.
  • Implement proper error reporting for invalid miniscript: why a specific miniscript is invalid, instead of just failing.

Built With

Share this project:

Updates