[#miniscript-FromScript]
= xref:miniscript.adoc[miniscript]::FromScript
:relfileprefix: ../
:mrdocs:

Decodes a Miniscript from a Bitcoin Script&period;

== Synopsis

Declared in `&lt;script&sol;miniscript&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;typename Ctx&gt;
std::optional&lt;Node&lt;Ctx::Key&gt;&gt;
FromScript(
    xref:CScript.adoc[CScript] const& script,
    Ctx const& ctx);
----

== Return Value

The decoded node tree, or std&colon;&colon;nullopt on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *script*
| The CScript to decode&period;
| *ctx*
| Context providing key decoding and the script context&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
