14 votes
Accepted

What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?

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 ...
10 votes

What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?

At a high level: The policy is compiled to Miniscript. Miniscript is encoded to Bitcoin Script. (One to One Mapping) Bitcoin Script is decoded back to Miniscript. (One to One Mapping) Policy and ...
  • 1,224
10 votes

What does Bitcoin policy language offer the developer that Miniscript doesn't? What is the difference between Bitcoin policy language and Miniscript?

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 ...
  • 2,451
6 votes
Accepted

In theory could we skip the proposed Taproot soft fork, activate Simplicity instead and use Simplicity to write the equivalent of Taproot scripts?

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 ...
5 votes

Where can I find the miniscript policy language specification?

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 ...
  • 63.3k
5 votes
Accepted

Miniscript or_i, d: - do they always imply a witness input?

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 ...
4 votes

Why isn't it possible to add an OP_RETURN (or some arbitrary script) inside a taproot script path with a descriptor?

It's not clear to me why one would want to commit to an OP_RETURN inside of a P2TR output construction, let alone inside of a descriptor. I feel like there might be a misunderstanding here. Using the ...
  • 65.4k
3 votes
Accepted

Why isn't it possible to add an OP_RETURN (or some arbitrary script) inside a taproot script path with a descriptor?

The answer is twofold. First, the Bitcoin Core descriptors are in the process of being extended with Miniscript. In the upcoming version (24.0), Miniscript will only be supported in Segwit version 0 ...
3 votes
Accepted

Can output descriptors be used to encode any Miniscript expression?

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 ...
  • 63.3k
3 votes
Accepted

With Miniscript why is it not possible to invert conditions with something like not()?

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" ...
3 votes
Accepted

Should the Policy to Miniscript compiler(s) be considered as deterministic and is this the end goal?

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 ...
2 votes
Accepted

How do I write a script such that my funds are locked in a 2-of-2 multisig that converts into a 1-of-2 multisig after 365 days?

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 votes

Is there anything specific to the design of the Sapio language that makes it well suited to writing covenant scripts?

excerpted from Designing Bitcoin Contracts with Sapio How do we think about Smart Contracts and CTV? Before CTV, in most Bitcoin smart contracts, we think at the key-level. That is, what is a complex ...
2 votes

Difference and resources for Miniscript and Simplicity?

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 ...
2 votes
Accepted

How would one turn a Miniscript tree into a Taproot tree with Taproot'd Miniscript?

How would one turn a Miniscript "tree" into a Taproot tree with Taproot'd Miniscript? You wouldn't - they're incomparable things that don't get translated from one to another. Miniscript is ...
2 votes

Why has the Miniscript for this particular Policy changed over the past few months?

thresh(3,pk(key_1),s:pk(key_2),s:pk(key_3),sdv:older(12960)) is no longer a valid Miniscript and won't successfully pass through the Miniscript analyzer on sipa's site. The reason for this is there ...
2 votes
Accepted

What is a sane Miniscript? How does it differ to a valid Miniscript?

A valid Miniscript is any correctly typed Miniscript. A sane Miniscript needs to be valid, consensus and standardness-compliant (e.g. number of operations and script size), have non-malleable ...
1 vote
Accepted

Which wallets or libraries besides core support (or will support) P2TR descriptors?

At the time of writing (May 2022) the only Bitcoin implementation other than Bitcoin Core (and Core derivatives like Knots) and rust-bitcoin I'm aware of that supports Taproot is btcd (Go). The ...
1 vote

How would one turn a Miniscript tree into a Taproot tree with Taproot'd Miniscript?

A Taproot tree is a Merkle (binary) tree of (Tap)scripts. Every node (an intermediate state in the process of hashing the leaves up to the root) has at most 2 child nodes and every leaf script (at the ...
1 vote
Accepted

Loops in bitcoin scripting

You can code the loop... for i=1 to 10 print "Hello #",i endfor ...as... print "Hello #1" print "Hello #2" print "Hello #3" print "Hello #4" print ...
  • 276
1 vote

Loops in bitcoin scripting

Loops (while loops) in this sense are meant as potentially infinite. For loops are not such loops. In other words, in what is here called for loop, one does know the number of iterations of the ...
  • 1,024
1 vote
Accepted

and(older(10),pk(A)) malleable if top-level, can it be top-level? EDIT: not malleable, was mistaken

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 ...
1 vote
Accepted

What is the relationship between the Minsc language and Policy language?

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 ...

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