Bitcoin Forum
May 12, 2024, 07:55:17 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Miniscript: Enabling Composition and Analysis of Bitcoin Script  (Read 161 times)
achow101 (OP)
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6635


Just writing some code


View Profile WWW
August 20, 2019, 04:49:19 AM
Merited by ABCbits (2), bones261 (2), Carlton Banks (1), hugeblack (1), TechPriest (1)
 #1

Hi all,

Miniscript is a project we've been working on for the past year or so,
and is now at a stage where I'd like to get it some more attention. It is joint
work with Andrew Poelstra and Sanket Sanjalkar.

It's a language for writing (a subset of) Bitcoin Scripts in a structured way,
enabling analysis, composition, generic signing and more.

For example the script

  <A> OP_CHECKSIG OP_IFDUP OP_NOTIF OP_DUP OP_HASH160 <hash160(B)>
  OP_EQUALVERIFY OP_CHECKSIGVERIFY <144> OP_CSV OP_ENDIF

in Miniscript notation would be

  or_d(c:pk(A),and_v(vc:pk_h(B),older(144)))

making it human (engineer?) readable that this is a script that permits A to
take the coins at any time, and B after 1 day. A full description of the
language can be found on the project website http://bitcoin.sipa.be/miniscript

Using Miniscript it's possible to:
* Write descriptors for addresses for scripts that implement things more
  complicated than multisig.
* Make software that can deal with composition of policies (e.g. have funds
  in a 2-of-3 setup where one of the 3 "keys" is itself a policy that involves
  perhaps multiple devices and timeouts).
* Compile complex spending policies to efficient scripts.
* Figure out under what necessary and/or sufficient conditions a script can be
  satisfied.
* Given signatures for a sufficient set of keys (and hash preimages, if needed),
  generically construct a witness for arbitrary scripts, without metadata
  apart from the script itself and public keys appearing in it. This means
  generic PSBT signers are possible for this class of scripts.
* Compute the bounds on the size of a witness for arbitrary scripts.
* Perform static analysis to see if any of Script's resource limitations
  (ops limit, stack size, ...) might interfere with the ability to spend.
* Who knows what else...

We have two implementations:
* a C++ one (https://github.com/sipa/miniscript)
* a Rust library (https://github.com/apoelstra/rust-miniscript).

The implementations are a work in progress, but through large scale randomized
tests we have confidence that the language design and associated witnesses are
compatible with the existing consensus and standardness rules.

To be clear: Miniscript is designed for Bitcoin as it exists today (primarily
P2WSH), and does not need any consensus changes. That said, we plan to extend
the design to support future script changes Bitcoin may include.

Cheers,

--
Pieter

Some more layman's explanation on twitter: https://twitter.com/pwuille/status/1163592166062473217

Website to play around with Miniscript: http://bitcoin.sipa.be/miniscript/

1715543717
Hero Member
*
Offline Offline

Posts: 1715543717

View Profile Personal Message (Offline)

Ignore
1715543717
Reply with quote  #2

1715543717
Report to moderator
1715543717
Hero Member
*
Offline Offline

Posts: 1715543717

View Profile Personal Message (Offline)

Ignore
1715543717
Reply with quote  #2

1715543717
Report to moderator
If you want to be a moderator, report many posts with accuracy. You will be noticed.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715543717
Hero Member
*
Offline Offline

Posts: 1715543717

View Profile Personal Message (Offline)

Ignore
1715543717
Reply with quote  #2

1715543717
Report to moderator
1715543717
Hero Member
*
Offline Offline

Posts: 1715543717

View Profile Personal Message (Offline)

Ignore
1715543717
Reply with quote  #2

1715543717
Report to moderator
Carlton Banks
Legendary
*
Offline Offline

Activity: 3430
Merit: 3074



View Profile
August 20, 2019, 09:53:13 AM
 #2

gonna try this out, thanks for linking achow101

Vires in numeris
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!