Skip to content

Commit 876dda5

Browse files
committed
Clarifications
1 parent 1f3d9e6 commit 876dda5

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

index.html

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,17 +82,17 @@ <h3 class="card-header">Introduction</h3>
8282
Bitcoin Script is an unusual stack-based language with many edge cases, designed for implementing spending conditions consisting of various combinations of
8383
signatures, hash locks, and time locks. Yet despite being limited in functionality it is still highly nontrivial to:<ul>
8484
<li>Given a combination of spending conditions, finding the most economical script to implement it.</li>
85-
<li>Given a two scripts, construct a script that implements a composition of their spending conditions (e.g. a multisig where one of the "keys" is another multisig).</li>
85+
<li>Given two scripts, construct a script that implements a composition of their spending conditions (e.g. a multisig where one of the "keys" is another multisig).</li>
8686
<li>Given a script, find out what spending conditions it permits.</li>
8787
<li>Given a script and access to a sufficient set of private keys, construct a general satisfying witness for it.</li>
8888
<li>Given a script, be able to predict the cost of spending an output.</li>
89-
<li>Given a script, know whether any code path requires violating particular resource limitations like the ops limit.</li>
89+
<li>Given a script, know whether particular resource limitations like the ops limit might be hit when spending.</li>
9090
</ul>
9191

9292
<p>
9393
Miniscript functions as a representation for scripts that makes these sort of operations possible. It has a structure that allows composition. It is very easy to
9494
statically analyze for various properties (spending conditions, correctness, security properties, malleability, ...). It can be targeted by spending policy compilers
95-
(see further). Finally, compatible scripts easily can be converted to miniscript - avoiding the need for additional metadata for e.g. signing devices that support it.
95+
(see further). Finally, compatible scripts can easily be converted to Miniscript form - avoiding the need for additional metadata for e.g. signing devices that support it.
9696

9797
<p>
9898
For now, Miniscript is really only designed for P2WSH and P2SH-P2WSH embedded scripts. Most of its constructions works fine in P2SH as well, but some of the (optional) security properties
@@ -101,7 +101,6 @@ <h3 class="card-header">Introduction</h3>
101101
<p>
102102
Miniscript was designed and implemented by Pieter Wuille, Andrew Poelstra, and Sanket Kanjalkar at Blockstream Research, but is the result of discussions with several other people.
103103

104-
105104
<p>
106105
Links:<ul>
107106
<li>This <a href="http://bitcoin.sipa.be/miniscript">website</a> and C++ compiler: <a href="https://github.com/sipa/miniscript">[code]</a></li>
@@ -116,20 +115,20 @@ <h3 class="card-header">Introduction</h3>
116115
<h3 class="card-header">Policy to Miniscript compiler</h3>
117116
<div class="card-block">
118117

119-
<p>Here you can see a demonstration of the Miniscript compiler. Write a spending policy following the instructions below, and observe how it affects the constructed Miniscript.
118+
<p>Here you can see a demonstration of the Miniscript compiler. Write a spending policy according to the instructions below, and observe how it affects the constructed Miniscript.
120119
<form>
121120
<div class="form-group">
122121
<label for="source">Policy</label>
123122
<textarea class="form-control" id="source" rows="1">and(pk(A),or(pk(B),or(9@pk(C),older(1000))))</textarea>
124-
<div class="small form-text test-muted">Supported expressions:
123+
<div class="small form-text test-muted">Supported policies:
125124
<ul>
126125
<li><samp>pk(<em>NAME</em>)</samp>: Require public key named <em>NAME</em> to sign. <em>NAME</em> can be any string up to 16 characters.</li>
127126
<li><samp>after(<em>NUM</em>)</samp>, <samp>older(<em>NUM</em>)</samp>: Require that the <samp>nLockTime</samp>/<samp>nSequence</samp> value is at least <em>NUM</em>. <em>NUM</em> cannot be 0.</li>
128127
<li><samp>sha256(<em>HEX</em>)</samp>, <samp>hash256(<em>HEX</em>)</samp>: Require that the preimage of 64-character <em>HEX</em> is revealed. The special value <samp>H</samp> can be used as <em>HEX</em>.</li>
129128
<li><samp>ripemd160(<em>HEX</em>)</samp>, <samp>hash160(<em>HEX</em>)</samp>: Require that the preimage of 40-character <em>HEX</em> is revealed. The special value <samp>H</samp> can be used as <em>HEX</em>.</li>
130-
<li><samp>and(<em>EXPR</em>,<em>EXPR</em>)</samp>: Require that both subexpressions are satisfied.</li>
131-
<li><samp>or([<em>N</em>@]<em>EXPR</em>,[<em>N</em>@]<em>EXPR</em>)</samp>: Require that one of the subexpressions is satisfied. The numbers N indicate the relative probability of each of the subexpressions.</li>
132-
<li><samp>thresh(<em>NUM</em>,<em>EXPR</em>,<em>EXPR</em>,...)</samp>: Require that NUM out of the following subexpressions are satisfied (all combinations are assumed to be equally likely).</li>
129+
<li><samp>and(<em>POL</em>,<em>POL</em>)</samp>: Require that both subpolicies are satisfied.</li>
130+
<li><samp>or([<em>N</em>@]<em>POL</em>,[<em>N</em>@]<em>POL</em>)</samp>: Require that one of the subpolicies is satisfied. The numbers N indicate the relative probability of each of the subexpressions (so <samp>9@</samp> is 9 times more likely than the default).</li>
131+
<li><samp>thresh(<em>NUM</em>,<em>POL</em>,<em>POL</em>,...)</samp>: Require that NUM out of the following subpolicies are met (all combinations are assumed to be equally likely).</li>
133132
</ul></div>
134133
</div>
135134
<button type="button" class="btn btn-primary" onclick="miniscript_compile();">Compile</button>
@@ -144,6 +143,7 @@ <h3 class="card-header">Policy to Miniscript compiler</h3>
144143
<h3 class="card-header">Analyze a Miniscript</h3>
145144
<div class="card-block">
146145

146+
<p>Here you can analyze the structure of a Miniscript expression and more.
147147
<form>
148148
<div class="form-group">
149149
<label for="analyze_ms">Miniscript</label>
@@ -199,7 +199,7 @@ <h4>Translation table</h4>
199199
<td><samp>&lt;n&gt; CHECKSEQUENCEVERIFY</samp></td>
200200
</tr>
201201
<tr>
202-
<td>nLockTime &ge; n (and compaitlbe)</td>
202+
<td>nLockTime &ge; n (and compatilbe)</td>
203203
<td><code>after(n)</code></td>
204204
<td><samp>&lt;n&gt; CHECKLOCKTIMEVERIFY</samp></td>
205205
</tr>
@@ -327,14 +327,14 @@ <h4>Correctness properties</h4>
327327
<li><b>"B"</b> Base expressions:<ul>
328328
<li>Takes its inputs from the top of the stack.</li>
329329
<li>When satisfied, pushes a nonzero value of up to 4 bytes onto the stack.</li>
330-
<li>When dissatisfied, pushes a 0 onto the stack.</li>
330+
<li>When dissatisfied, pushes a 0 onto the stack (if dissatisfaction without aborting is possible at all).</li>
331331
<li>This is used for most expressions, and required for the top level one.</li>
332332
<li>For example: <code>older(n)</code> = <samp>&lt;n&gt; CHECKSEQUENCEVERIFY</samp>.</li>
333333
</ul></li>
334334
<li><b>"V"</b> Verify expressions:<ul>
335335
<li>Takes its inputs from the top of the stack.</li>
336336
<li>When satisfactied, pushes nothing.</li>
337-
<li>Cannot be dissatisfied (aborts execution instead).</li>
337+
<li>Cannot be dissatisfied without aborting.</li>
338338
<li>A "V" can be obtained using the <code>v:</code> wrapper on a "B" expression, or by combining other "V" expressions using <code>and_v</code>, <code>or_i</code>, <code>or_c</code>, or <code>andor</code>.</li>
339339
<li>For example <code>vc:pk(key)</code> = <samp>&lt;key&gt; CHECKSIGVERIFY</samp>.</li>
340340
</ul></li>
@@ -358,7 +358,7 @@ <h4>Correctness properties</h4>
358358
Then there are 5 type modifiers, which guarantee additional properties:<ul>
359359
<li><b>"z"</b> Zero-arg: this expression always consumes exactly 0 stack elements.</li>
360360
<li><b>"o"</b> One-arg: this expression always consumes exactly 1 stack element.</li>
361-
<li><b>"n"</b> Nonzero: no satisfaction for this expression requires a top stack element that is zero.</li>
361+
<li><b>"n"</b> Nonzero: this expression always consumes at least 1 stack element, no satisfaction for this expression requires the top input stack to be zero.</li>
362362
<li><b>"d"</b> Dissatisfiable: a dissatisfaction for this expression can unconditionally be constructed.</li>
363363
<li><b>"u"</b> Unit: when satisfied, this expression will put an exact 1 on the stack (as opposed to any nonzero value).</li>
364364
</ul>
@@ -569,7 +569,7 @@ <h4>Guaranteeing non-malleability</h4>
569569
In order to do that, we add additional properties to the type system:<ul>
570570
<li><b>"s"</b> Signed: satisfying this expression always requires a signature (predicting whether all satisfactions will be HASSIG).</li>
571571
<li><b>"f"</b> Forced: dissatisfying this expression always requires a signature (predicting whether all dissatisfactions will be HASSIG). This conflicts with "d". </li>
572-
<li><b>"e"</b> Expressive: regardless of what conditions are met, exactly one dissatisfaction without signatures is available (predicting non-DONTUSE dissatisfactions). This implies "d".</li>
572+
<li><b>"e"</b> Expressive: an uncondition dissatisfaction must always be constructible (like "d"), but it also needs to be unique, and there cannot ever be any other dissatisfactions available except ones that require a signature.
573573
</ul>
574574

575575

0 commit comments

Comments
 (0)