12

Both answers by James C. and sanket1729 are very good, but I wanted to give a very high-level answer: Miniscript is an intermediate more structured representation for actual Bitcoin Scripts. It is useful as a toolbox because it simplifies static analysis of scripts, and things like generic signing. The policy language is intended to simplify designing ...


9

At a high level: The policy is compiled to Minsicript. Miniscript is encoded to bitcoin Script. (One to One Mapping) Bitcoin Script is decoded back to Miniscript. (One to One Mapping) Policy and Miniscript can both be lifted to another representation for static analysis. Following invariants are respected in Miniscript: Let ms be a miniscript, s be ...


8

Miniscript doesn't compile down to script. It encodes a subset of all Bitcoin script. It is a (very crafty) template language which reduces the Bitcoin script language to specific script expressions which are composable, which means the properties of a miniscript expression only depend on the property of its children. Properties include malleability, ...


6

I think that's both very premature, and misses the point. Simplicity is a completely different approach to scripting, with significant advantages, but it's being designed from the ground up. There is lots of progress, but it will require more than just the base layer. You can't just write scripts in Simplicity, and if you have one, you can't just sign for it....


5

Correct. A Miniscript satisfier needs to provide the 0/1 in the witness for these fragments. To give more than a one-word answer, we assume MINIMALIF in our analysis (for size/fee estimation). Our original design enforced it in script using the opcodes SIZE EQUALVERIFY, but we dropped it because our design assumes standardness everywhere. (If we did not ...


4

There is no specification, or really documentation, for Miniscript other than sipa's website. There is no "correct" or singular way to compile a miniscript policy into miniscript. The two existing implementations actually go about compiling in different ways, although both arrive at the same result (occasionally they differ, but the two results are ...


3

Yes. Such descriptors are referred to as ranged descriptors. In a descriptor, keys are provided in the form of a Key expression. Key expressions can be individual keys themselves, or BIP 32 extended keys, followed by derivation information. The derivation information can end with a * to indicate that child keys should be derived. In that case, the descriptor ...


3

This answer was provided by Pieter Wuille (@pwuille) on Twitter. Conceptually it doesn't make sense, because script conditions are monotonic. What would and(pk(A),not(pk(B))) mean? "B does not sign" is trivially satisfied; B would just never bother signing. Similarly, not(older(N)) would not mean younger(N). There (intentionally) does not exist a way in ...


3

The mapping between Miniscript and Script will never change. (At least, not without a major version bump of this library and at this point, probably a "Miniscript 2" which is billed as a different language.) The mapping from Policy to Miniscript may change even between successive runs of the compiler. Currently, the Miniscript compiler produces ...


2

To construct the script you could use Pieter Wuille's Miniscript site. If you go to the Policy to Miniscript compiler section there is an example in Policy for a 2-of-2 multisig that turns into a 1-of-2 multisig after 90 days. and(pk(key_user),or(99@pk(key_service),older(12960))) You would need to adjust it for your desired example. A Policy that fits your ...


1

Miniscript is an encoding of Bitcoin Script. The functionality of Miniscript is a subset of Script so there is nothing you can do with Miniscript that you can't do with Script. Therefore scripts decoded from Miniscript can be used on Bitcoin mainnet today in addition to testnet, regtest, signet and Elements. In terms of Miniscript resources (in addition to ...


1

OP_CHECKSEQUENCEVERIFY is a redefined OP_NOP code, so it cannot manipulate the stack - only abort or continue. In your script, that means it leaves the 10 on the stack, and no <any-nonzero> is necessary in the witness (and adding one would be a violation of the CLEANSTACK standardness rule).


1

Minsc has a runtime environment with a Policy data type that gets constructed as the result of evaluating the program. The program evaluation could be considered part of the compilation process, in which case you could say that Minsc compiles to Policy but it is also possible to consider this evaluation as the runtime and say that Minsc doesn't compile at ...


Only top voted, non community-wiki answers of a minimum length are eligible