<div dir="ltr"><div>Hi all,<br></div><div><br></div><div>I recently released Minsc, a high-level scripting language for expressing Bitcoin Script spending conditions using a simple and familiar syntax.</div><br>Minsc is based on the Miniscript Policy language, with additional features and syntactic sugar sprinkled on top, including variables, functions, infix notation, human-readable times and more.<br><br>A live compiler (Minsc->Policy->Miniscript->Script) and documentation are available on the website: <a href="https://min.sc">https://min.sc</a><br><br>Source code (in Rust) is available on github: <a href="https://github.com/shesek/minsc">https://github.com/shesek/minsc</a><br><br>Some example Minsc scripts:<br><br>- A user and a 2FA service need to sign off, but after 90 days the user alone is enough<br><br>      pk(user_pk) && (9@pk(service_pk) || older(90 days))<br><br>- Traditional preimage-based HTLC<br><br>      $redeem = pk(A) && sha256(H);<br>      $refund = pk(B) && older(10);<br><br>      likely@$redeem || $refund<br><br>- Liquid-like federated pegin with emergency recovery keys<br><br>      $federation = 4 of [ pk(A), pk(B), pk(C), pk(D), pk(E) ];<br>      $recovery = 2 of [ pk(F), pk(G), pk(H) ];<br>      $timeout = older(heightwise 2 weeks);<br><br>      likely@$federation || ($timeout && $recovery)<br><br>- The BOLT #3 received HTLC policy<br><br>      fn htlc_received($revoke_pk, $local_pk, $remote_pk, $secret, $delay) {<br>        $success = pk($local_pk) && hash160($secret);<br>        $timeout = older($delay);<br>        <br>        pk($revoke_pk) || (pk($remote_pk) && ($success || $timeout))<br>      }<br><br>      htlc_received(A, B, C, H, 3 hours)<br><br>- 2FA where the user has a 2-of-2 setup and the service provider is a 3-of-4 federation<br><br>      fn two_factor($user, $provider, $delay) = <br>        $user && (likely@$provider || older($delay));<br><br>      $user = pk(user_desktop) && pk(user_mobile);<br>      $providers = [ pk(P1), pk(P2), pk(P3), pk(P4) ];<br>      <br>      two_factor($user, 3 of $providers, 4 months)<br><br>- Easily add NSA backdoors to everything 🕵️🚪<br><br>      _backdoor=pk(usgovt), _pk=pk, _older=older, _after=after,<br>      _sha256=sha256, _ripemd160=ripemd160;<br><br>      fn pk(x) = _pk(x) || _backdoor;<br>      fn older(x) = _older(x) || _backdoor;<br>      fn after(x) = _after(x) || _backdoor;<br>      fn sha256(x) = _sha256(x) || _backdoor;<br>      fn ripemd160(x) = _ripemd160(x) || _backdoor;<br><br>      (pk(A) && sha256(H)) || (pk(B) && older(10))<br><br>Feedback is appreciated!<br><br>Nadav<br><br>P.S Since every Miniscript Policy is also a valid Minsc expression, the <a href="http://min.sc">min.sc</a> web code editor UI could also be useful for experimenting with bare policies. You'll get syntax highlighting, parentheses matching, real-time compilation (in a web worker so the browser doesn't freeze) and syntax error reporting.</div>