You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18591 lines
204 KiB

9 years ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: Script</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Class: Script</h1>
<section>
<header>
8 years ago
<h2>
<span class="ancestors"><a href="module-script.html">script</a>.</span>Script</h2>
9 years ago
</header>
<article>
<div class="container-overview">
8 years ago
<h4 class="name" id="Script"><span class="type-signature"></span>new Script<span class="signature">(code)</span><span class="type-signature"></span></h4>
9 years ago
<div class="description">
<p>Represents a input or output script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
<span class="param-type">Array</span>
|
<span class="param-type">Object</span>
|
<span class="param-type"><a href="global.html#NakedScript">NakedScript</a></span>
</td>
<td class="description last"><p>Array
of script code or a serialized script Buffer.</p></td>
</tr>
</tbody>
</table>
<h5 class="subsection-title">Properties:</h5>
<table class="props">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
9 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
9 years ago
<td class="attributes">
</td>
9 years ago
8 years ago
<td class="description last"><p>Parsed script code.</p></td>
9 years ago
</tr>
<tr>
<td class="name"><code>raw</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
9 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
<td class="description last"><p>Serialized script.</p></td>
</tr>
<tr>
8 years ago
<td class="name"><code>length</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
9 years ago
</td>
<td class="attributes">
</td>
8 years ago
<td class="description last"><p>Number of parsed opcodes.</p></td>
9 years ago
</tr>
9 years ago
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line45">line 45</a>
9 years ago
</li></ul></dd>
</dl>
</div>
8 years ago
<h3 class="subsection-title">Members</h3>
9 years ago
8 years ago
<h4 class="name" id=".flags"><span class="type-signature">(static) </span>flags<span class="type-signature"> :Number</span></h4>
<div class="description">
<p>Script and locktime flags. See <a href="global.html#VerifyFlags">VerifyFlags</a>.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Number</span>
</li>
</ul>
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line76">line 76</a>
</li></ul></dd>
9 years ago
8 years ago
9 years ago
8 years ago
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id=".hashType"><span class="type-signature">(static) </span>hashType<span class="type-signature"> :<a href="global.html#SighashType">SighashType</a></span></h4>
9 years ago
8 years ago
<div class="description">
<p>Sighash Types.</p>
</div>
9 years ago
8 years ago
<h5>Type:</h5>
<ul>
<li>
9 years ago
8 years ago
<span class="param-type"><a href="global.html#SighashType">SighashType</a></span>
9 years ago
8 years ago
</li>
</ul>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line84">line 84</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h4 class="name" id=".hashTypeByVal"><span class="type-signature">(static, constant) </span>hashTypeByVal<span class="type-signature"> :<a href="global.html#RevMap">RevMap</a></span></h4>
9 years ago
8 years ago
<div class="description">
<p>Sighash types by value.</p>
</div>
9 years ago
8 years ago
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#RevMap">RevMap</a></span>
9 years ago
8 years ago
</li>
</ul>
9 years ago
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line91">line 91</a>
</li></ul></dd>
9 years ago
8 years ago
9 years ago
8 years ago
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id=".opcodes"><span class="type-signature">(static) </span>opcodes<span class="type-signature"> :Number</span></h4>
9 years ago
8 years ago
<div class="description">
<p>Script opcodes.</p>
</div>
9 years ago
8 years ago
<h5>Type:</h5>
<ul>
<li>
<span class="param-type">Number</span>
9 years ago
8 years ago
</li>
</ul>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line62">line 62</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h4 class="name" id=".opcodesByVal"><span class="type-signature">(static, constant) </span>opcodesByVal<span class="type-signature"> :<a href="global.html#RevMap">RevMap</a></span></h4>
9 years ago
8 years ago
<div class="description">
<p>Opcodes by value.</p>
</div>
9 years ago
8 years ago
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#RevMap">RevMap</a></span>
9 years ago
8 years ago
</li>
</ul>
9 years ago
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line69">line 69</a>
</li></ul></dd>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
</dl>
9 years ago
8 years ago
<h4 class="name" id=".types"><span class="type-signature">(static) </span>types<span class="type-signature"> :Number</span></h4>
9 years ago
8 years ago
<div class="description">
<p>Output script types.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
9 years ago
<span class="param-type">Number</span>
8 years ago
</li>
</ul>
9 years ago
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line98">line 98</a>
</li></ul></dd>
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id=".typesByVal"><span class="type-signature">(static, constant) </span>typesByVal<span class="type-signature"> :<a href="global.html#RevMap">RevMap</a></span></h4>
9 years ago
8 years ago
<div class="description">
<p>Output script types by value.</p>
</div>
<h5>Type:</h5>
<ul>
<li>
<span class="param-type"><a href="global.html#RevMap">RevMap</a></span>
</li>
</ul>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line105">line 105</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h3 class="subsection-title">Methods</h3>
9 years ago
8 years ago
<h4 class="name" id=".array"><span class="type-signature">(static) </span>array<span class="signature">(value)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a script array. Will convert Numbers and big
numbers to a little-endian buffer while taking into
account negative zero, minimaldata, etc.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">Number</span>
8 years ago
|
9 years ago
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
9 years ago
8 years ago
</td>
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1489">line 1489</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</dd>
</dl>
8 years ago
<h5>Example</h5>
<pre class="prettyprint"><code>assert.deepEqual(Script.array(0), new Buffer(0));
assert.deepEqual(Script.array(0xffee), new Buffer('eeff00', 'hex'));
assert.deepEqual(Script.array(new BN(0xffee)), new Buffer('eeff00', 'hex'));
assert.deepEqual(Script.array(new BN(0x1e).ineg()), new Buffer('9e', 'hex'));</code></pre>
9 years ago
8 years ago
<h4 class="name" id=".bool"><span class="type-signature">(static) </span>bool<span class="signature">(value)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Cast a big number or Buffer to a bool.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>value</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
|
9 years ago
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1446">line 1446</a>
9 years ago
</li></ul></dd>
8 years ago
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li>CastToBool</li>
</ul>
</dd>
9 years ago
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id=".checksig"><span class="type-signature">(static) </span>checksig<span class="signature">(msg, sig, key, flags<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Verify a signature, taking into account sighash type
and whether the signature is historical.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>msg</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Signature hash.</p></td>
</tr>
<tr>
<td class="name"><code>sig</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
9 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p>If none of VERIFY_DERSIG,
VERIFY_LOW_S, or VERIFY_STRICTENC are enabled, the signature
is treated as historical, allowing odd signature lengths
and high S values.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3520">line 3520</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromAddress"><span class="type-signature">(static) </span>fromAddress<span class="signature">(address)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create an output script from an address.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>address</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Address</span>
|
<span class="param-type"><a href="global.html#Base58Address">Base58Address</a></span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1881">line 1881</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromArray"><span class="type-signature">(static) </span>fromArray<span class="signature">(code)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Instantiate script from an array
of buffers and numbers.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>code</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Array</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line238">line 238</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromCode"><span class="type-signature">(static) </span>fromCode<span class="signature">(code)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Instantiate script from an array of opcodes.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>code</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Array:<a href="global.html"></a>.&lt;Opcode:<a href="global.html"></a>></span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line277">line 277</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromCommitment"><span class="type-signature">(static) </span>fromCommitment<span class="signature">(hash, flags)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a witness block commitment.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
8 years ago
<tr>
<td class="name"><code>hash</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
9 years ago
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
8 years ago
<span class="param-type">String</span>
|
9 years ago
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1916">line 1916</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromJSON"><span class="type-signature">(static) </span>fromJSON<span class="signature">()</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Instantiate script from a hex string.</p>
9 years ago
</div>
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line415">line 415</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
9 years ago
8 years ago
<dl>
<dt>
Type
</dt>
<dd>
9 years ago
8 years ago
<span class="param-type">Script</span>
9 years ago
8 years ago
</dd>
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id=".fromMultisig"><span class="type-signature">(static) </span>fromMultisig<span class="signature">(m, n, keys)</span><span class="type-signature"> &rarr; {Script}</span></h4>
<div class="description">
<p>Create a pay-to-multisig script.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>m</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>n</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>keys</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Array:<a href="global.html"></a>.&lt;Buffer:<a href="global.html"></a>></span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
8 years ago
</tbody>
</table>
9 years ago
8 years ago
<dl class="details">
9 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1749">line 1749</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromNulldata"><span class="type-signature">(static) </span>fromNulldata<span class="signature">(flags)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a nulldata/opreturn script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1808">line 1808</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromOptions"><span class="type-signature">(static) </span>fromOptions<span class="signature">(options)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Insantiate script from options object.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>options</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Object</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line170">line 170</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromProgram"><span class="type-signature">(static) </span>fromProgram<span class="signature">(version, data)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a witness program.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1847">line 1847</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromPubkey"><span class="type-signature">(static) </span>fromPubkey<span class="signature">(key)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a pay-to-pubkey script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1667">line 1667</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromPubkeyhash"><span class="type-signature">(static) </span>fromPubkeyhash<span class="signature">(hash)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a pay-to-pubkeyhash script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>hash</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1705">line 1705</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromRaw"><span class="type-signature">(static) </span>fromRaw<span class="signature">(data, enc<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a script from a serialized buffer.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Buffer</span>
|
<span class="param-type">String</span>
</td>
<td class="attributes">
</td>
<td class="description last"><p>Serialized script.</p></td>
</tr>
<tr>
<td class="name"><code>enc</code></td>
<td class="type">
<span class="param-type">String</span>
9 years ago
</td>
8 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
8 years ago
<td class="description last"><p>Either <code>&quot;hex&quot;</code> or <code>null</code>.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3608">line 3608</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromReader"><span class="type-signature">(static) </span>fromReader<span class="signature">(br, enc<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a script from buffer reader.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>br</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">BufferReader</span>
9 years ago
</td>
8 years ago
<td class="attributes">
</td>
9 years ago
<td class="description last"></td>
</tr>
8 years ago
<tr>
<td class="name"><code>enc</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">String</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"><p>Either <code>&quot;hex&quot;</code> or <code>null</code>.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
9 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3597">line 3597</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromScripthash"><span class="type-signature">(static) </span>fromScripthash<span class="signature">(hash)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a pay-to-scripthash script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>hash</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1783">line 1783</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".fromString"><span class="type-signature">(static) </span>fromString<span class="signature">(items)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Parse a bitcoind test script
string into a script object.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>items</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">String</span>
9 years ago
</td>
8 years ago
<td class="description last"><p>Script string.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3163">line 3163</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h5>Throws:</h5>
<div class="param-desc">
<p>Parse error.</p>
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".getCoinbaseHeight"><span class="type-signature">(static) </span>getCoinbaseHeight<span class="signature">(raw)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Get coinbase height.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>raw</code></td>
9 years ago
<td class="type">
9 years ago
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="description last"><p>Raw script.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2532">line 2532</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p><code>-1</code> if not present.</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".getSmall"><span class="type-signature">(static) </span>getSmall<span class="signature">(index)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Get a small integer from an opcode (OP_0-OP_16).</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>index</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3173">line 3173</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
9 years ago
9 years ago
9 years ago
9 years ago
8 years ago
<h4 class="name" id=".getWitnessSigops"><span class="type-signature">(static) </span>getWitnessSigops<span class="signature">(input, output, witness, flags)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
9 years ago
<div class="description">
8 years ago
<p>Count the sigops in a script, taking into account witness programs.</p>
9 years ago
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
8 years ago
<th>Type</th>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>input</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Script</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>output</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Script</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
9 years ago
8 years ago
<tr>
<td class="name"><code>witness</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Witness</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
9 years ago
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3066">line 3066</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>sigop count</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".isCode"><span class="type-signature">(static) </span>isCode<span class="signature">(raw)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test a buffer to see if it is valid
script code (no non-existent opcodes).</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>raw</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1619">line 1619</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".isCompressedEncoding"><span class="type-signature">(static) </span>isCompressedEncoding<span class="signature">(key)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a compressed key.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2826">line 2826</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".isDummy"><span class="type-signature">(static) </span>isDummy<span class="signature">(data<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a null dummy (a zero-length array).</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2787">line 2787</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isHash"><span class="type-signature">(static) </span>isHash<span class="signature">(hash<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a ripemd160 hash.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>hash</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2755">line 2755</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isHashType"><span class="type-signature">(static) </span>isHashType<span class="signature">(sig)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test a signature to see whether it contains a valid sighash type.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>sig</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2899">line 2899</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isKey"><span class="type-signature">(static) </span>isKey<span class="signature">(key<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a public key. Note that
this does not verify the format of the key, only the length.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
9 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
9 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2766">line 2766</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isKeyEncoding"><span class="type-signature">(static) </span>isKeyEncoding<span class="signature">(key)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a valid key.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
9 years ago
<span class="param-type">Buffer</span>
</td>
9 years ago
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2836">line 2836</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isLowDER"><span class="type-signature">(static) </span>isLowDER<span class="signature">(sig)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test a signature to see whether it contains a low S value.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>sig</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2921">line 2921</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".isMinimal"><span class="type-signature">(static) </span>isMinimal<span class="signature">(data, opcode, flags<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Check to see if a pushdata Buffer abides by minimaldata.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="attributes">
</td>
9 years ago
<td class="description last"></td>
</tr>
8 years ago
<tr>
<td class="name"><code>opcode</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Number</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
9 years ago
</td>
8 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1581">line 1581</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id=".isScript"><span class="type-signature">(static) </span>isScript<span class="signature">(obj)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
8 years ago
<p>Test whether an object a Script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>obj</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3620">line 3620</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id=".isSignature"><span class="type-signature">(static) </span>isSignature<span class="signature">(sig<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Test whether the data element is a signature. Note that
this does not verify the format of the signature, only the length.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>sig</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2777">line 2777</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id=".isSignatureEncoding"><span class="type-signature">(static) </span>isSignatureEncoding<span class="signature">(sig)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Test a signature to see if it abides by BIP66.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>sig</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2889">line 2889</a>
9 years ago
</li></ul></dd>
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki">https://github.com/bitcoin/bips/blob/master/bip-0066.mediawiki</a></li>
</ul>
</dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".num"><span class="type-signature">(static) </span>num<span class="signature">(value, flags<span class="signature-attributes">nullable</span>, size<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {<a href="global.html#BN">BN</a>}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Create a CScriptNum.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>value</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
8 years ago
</td>
<td class="attributes">
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
<span class="param-type">Number</span>
9 years ago
</td>
<td class="attributes">
&lt;nullable><br>
</td>
8 years ago
<td class="description last"><p>Script standard flags.</p></td>
</tr>
<tr>
<td class="name"><code>size</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p>Max size in bytes.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1472">line 1472</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
8 years ago
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".sign"><span class="type-signature">(static) </span>sign<span class="signature">(msg, key, type)</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Sign a message, appending the sighash type.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>msg</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="description last"><p>Signature hash.</p></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</td>
8 years ago
<td class="description last"><p>Public key.</p></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>type</code></td>
9 years ago
<td class="type">
<span class="param-type">Number</span>
</td>
8 years ago
<td class="description last"><p>Sighash type.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3551">line 3551</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p>signature</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Buffer</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".validateKey"><span class="type-signature">(static) </span>validateKey<span class="signature">(key, flags<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a valid key if VERIFY_STRICTENC is enabled.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>key</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
9 years ago
</td>
<td class="attributes">
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
<td class="attributes">
&lt;nullable><br>
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2799">line 2799</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
8 years ago
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".validateSignature"><span class="type-signature">(static) </span>validateSignature<span class="signature">(sig, flags<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the data element is a valid signature based
on the encoding, S value, and sighash type. Requires
VERIFY_DERSIG|VERIFY_LOW_S|VERIFY_STRICTENC, VERIFY_LOW_S
and VERIFY_STRING_ENC to be enabled respectively. Note that
this will allow zero-length signatures.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>sig</code></td>
9 years ago
<td class="type">
<span class="param-type">Buffer</span>
</td>
8 years ago
<td class="attributes">
9 years ago
8 years ago
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
8 years ago
<td class="attributes">
&lt;nullable><br>
</td>
9 years ago
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2852">line 2852</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
8 years ago
</div>
9 years ago
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
9 years ago
8 years ago
<h4 class="name" id=".verify"><span class="type-signature">(static) </span>verify<span class="signature">(input, witness, output, tx, i, value, flags)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Verify an input and output script, and a witness if present.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>input</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Script</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
8 years ago
<tr>
<td class="name"><code>witness</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Witness</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>output</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Script</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>tx</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">TX</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>i</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Number</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
9 years ago
8 years ago
<tr>
<td class="name"><code>value</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type"><a href="global.html#Amount">Amount</a></span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
<tr>
8 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
9 years ago
<td class="description last"></td>
9 years ago
</tr>
9 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3199">line 3199</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
8 years ago
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".verifyMast"><span class="type-signature">(static) </span>verifyMast<span class="signature">(program, stack, output, flags, tx, i, value)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Verify a MAST witness program.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>program</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Program</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>stack</code></td>
<td class="type">
9 years ago
8 years ago
<span class="param-type">Stack</span>
</td>
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>output</code></td>
<td class="type">
9 years ago
8 years ago
<span class="param-type">Script</span>
</td>
9 years ago
9 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
9 years ago
<td class="name"><code>flags</code></td>
9 years ago
<td class="type">
9 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>tx</code></td>
<td class="type">
9 years ago
8 years ago
<span class="param-type">TX</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>i</code></td>
<td class="type">
9 years ago
8 years ago
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>value</code></td>
9 years ago
8 years ago
<td class="type">
9 years ago
8 years ago
<span class="param-type"><a href="global.html#Amount">Amount</a></span>
</td>
9 years ago
9 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3383">line 3383</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
9 years ago
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
9 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id=".verifyProgram"><span class="type-signature">(static) </span>verifyProgram<span class="signature">(witness, output, flags, tx, i, value)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Verify a witness program. This runs after regular script
execution if a witness program is present. It will convert
the witness to a stack and execute the program.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>witness</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Witness</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
<tr>
8 years ago
<td class="name"><code>output</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Script</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
8 years ago
<tr>
<td class="name"><code>flags</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
<tr>
<td class="name"><code>tx</code></td>
<td class="type">
8 years ago
<span class="param-type">TX</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>i</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
8 years ago
<td class="name"><code>value</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type"><a href="global.html#Amount">Amount</a></span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3311">line 3311</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
<h5>Throws:</h5>
<div class="param-desc">
8 years ago
<span class="param-type">ScriptError</span>
9 years ago
</div>
9 years ago
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id=".witnessSigops"><span class="type-signature">(static) </span>witnessSigops<span class="signature">(program, witness, flags)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Count the sigops for a program.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>program</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Program</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
<tr>
8 years ago
<td class="name"><code>witness</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Witness</span>
9 years ago
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
9 years ago
<span class="param-type"><a href="global.html#VerifyFlags">VerifyFlags</a></span>
9 years ago
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3038">line 3038</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
8 years ago
<h5>Returns:</h5>
9 years ago
8 years ago
<div class="param-desc">
<p>sigop count</p>
</div>
9 years ago
8 years ago
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
9 years ago
9 years ago
8 years ago
</dd>
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id="clear"><span class="type-signature"></span>clear<span class="signature">()</span><span class="type-signature"></span></h4>
9 years ago
<div class="description">
8 years ago
<p>Clear the script code.</p>
9 years ago
</div>
8 years ago
<dl class="details">
9 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2734">line 2734</a>
</li></ul></dd>
9 years ago
8 years ago
9 years ago
8 years ago
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id="clone"><span class="type-signature"></span>clone<span class="signature">()</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
8 years ago
<div class="description">
<p>Clone the script.</p>
</div>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line286">line 286</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>Cloned script.</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="compile"><span class="type-signature"></span>compile<span class="signature">()</span><span class="type-signature"></span></h4>
9 years ago
<div class="description">
8 years ago
<p>Re-encode the script internally. Useful if you
changed something manually in the <code>code</code> array.</p>
9 years ago
</div>
9 years ago
9 years ago
<dl class="details">
9 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line354">line 354</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h4 class="name" id="execute"><span class="type-signature"></span>execute<span class="signature">(stack, flags<span class="signature-attributes">nullable</span>, tx<span class="signature-attributes">nullable</span>, index<span class="signature-attributes">nullable</span>, value<span class="signature-attributes">nullable</span>, version<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Execute and interpret the script.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
8 years ago
<th>Attributes</th>
9 years ago
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>stack</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Stack</span>
9 years ago
</td>
8 years ago
<td class="attributes">
</td>
9 years ago
8 years ago
<td class="description last"><p>Script execution stack.</p></td>
9 years ago
</tr>
8 years ago
<tr>
<td class="name"><code>flags</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Number</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"><p>Script standard flags.</p></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>tx</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">TX</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"><p>Transaction being verified.</p></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>index</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Number</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"><p>Index of input being verified.</p></td>
</tr>
9 years ago
8 years ago
9 years ago
8 years ago
<tr>
<td class="name"><code>value</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type"><a href="global.html#Amount">Amount</a></span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
</td>
<td class="description last"><p>Previous output value.</p></td>
</tr>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p>Signature hash version (0=legacy, 1=segwit).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line503">line 503</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<dl>
<dt>
<div class="param-desc">
<p>Will be thrown on VERIFY failures, among other things.</p>
</div>
</dt>
<dd></dd>
<dt>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">ScriptError</span>
8 years ago
</dd>
</dl>
</dt>
<dd></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Whether the execution was successful.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
<h4 class="name" id="forWitness"><span class="type-signature"></span>forWitness<span class="signature">()</span><span class="type-signature"> &rarr; {Program|null}</span></h4>
<div class="description">
<p>Get the script to the equivalent witness
program (mimics bitcoind's scriptForWitness).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2302">line 2302</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Program</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="fromAddress"><span class="type-signature">(private) </span>fromAddress<span class="signature">(address)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from an address.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>address</code></td>
<td class="type">
<span class="param-type">Address</span>
|
<span class="param-type"><a href="global.html#Base58Address">Base58Address</a></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1857">line 1857</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromArray"><span class="type-signature">(private) </span>fromArray<span class="signature">(code)</span><span class="type-signature"> &rarr; {Script}</span></h4>
<div class="description">
<p>Inject properties from an array of
of buffers and numbers.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line201">line 201</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Script</span>
</dd>
</dl>
<h4 class="name" id="fromCode"><span class="type-signature">(private) </span>fromCode<span class="signature">(code)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from an array of opcodes.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>code</code></td>
<td class="type">
<span class="param-type">Array:<a href="global.html"></a>.&lt;Opcode:<a href="global.html"></a>></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line257">line 257</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromCommitment"><span class="type-signature">(private) </span>fromCommitment<span class="signature">(hash, flags)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a witness block commitment.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hash</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
<span class="param-type">String</span>
|
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1892">line 1892</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromJSON"><span class="type-signature">(private) </span>fromJSON<span class="signature">(json)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from json object.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line404">line 404</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromMultisig"><span class="type-signature">(private) </span>fromMultisig<span class="signature">(m, n, keys)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from pay-to-multisig script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>m</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>n</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>keys</code></td>
<td class="type">
<span class="param-type">Array:<a href="global.html"></a>.&lt;Buffer:<a href="global.html"></a>></span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1717">line 1717</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromNulldata"><span class="type-signature">(private) </span>fromNulldata<span class="signature">(flags)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a nulldata/opreturn script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>flags</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1793">line 1793</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromOptions"><span class="type-signature">(private) </span>fromOptions<span class="signature">(options)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from options object.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line138">line 138</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromProgram"><span class="type-signature">(private) </span>fromProgram<span class="signature">(version, data)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a witness program.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>version</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1819">line 1819</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromPubkey"><span class="type-signature">(private) </span>fromPubkey<span class="signature">(key)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a pay-to-pubkey script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1645">line 1645</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromPubkeyhash"><span class="type-signature">(private) </span>fromPubkeyhash<span class="signature">(hash)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a pay-to-pubkeyhash script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hash</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1677">line 1677</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromRaw"><span class="type-signature">(private) </span>fromRaw<span class="signature">(data)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from serialized data.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3579">line 3579</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromReader"><span class="type-signature">(private) </span>fromReader<span class="signature">(br)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from buffer reader.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>br</code></td>
<td class="type">
<span class="param-type">BufferReader</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3569">line 3569</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromScripthash"><span class="type-signature">(private) </span>fromScripthash<span class="signature">(hash)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from a pay-to-scripthash script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>hash</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1759">line 1759</a>
</li></ul></dd>
</dl>
<h4 class="name" id="fromString"><span class="type-signature">(private) </span>fromString<span class="signature">(items)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Inject properties from bitcoind test string.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>items</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="description last"><p>Script string.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3103">line 3103</a>
</li></ul></dd>
</dl>
<h5>Throws:</h5>
<div class="param-desc">
<p>Parse error.</p>
</div>
<h4 class="name" id="get"><span class="type-signature"></span>get<span class="signature">(index)</span><span class="type-signature"> &rarr; {Buffer|Number}</span></h4>
<div class="description">
<p>Get an item from the <code>code</code> array.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2678">line 2678</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
|
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getAddress"><span class="type-signature"></span>getAddress<span class="signature">()</span><span class="type-signature"> &rarr; {Address|null}</span></h4>
<div class="description">
<p>Get the address of the script if present. Note that
pubkey and multisig scripts will be treated as though
they are pubkeyhash and scripthashes respectively.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2051">line 2051</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Address</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="getCodeSize"><span class="type-signature"></span>getCodeSize<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Calculate size of code to be compiled.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line337">line 337</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getCoinbaseHeight"><span class="type-signature"></span>getCoinbaseHeight<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Get coinbase height.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2522">line 2522</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p><code>-1</code> if not present.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getCommitmentHash"><span class="type-signature"></span>getCommitmentHash<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer|null}</span></h4>
<div class="description">
<p>Get the commitment hash if present.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2250">line 2250</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="getInputAddress"><span class="type-signature"></span>getInputAddress<span class="signature">()</span><span class="type-signature"> &rarr; {Address|null}</span></h4>
<div class="description">
<p>&quot;Guess&quot; the address of the input script.
This method is not 100% reliable.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2040">line 2040</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Address</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="getInputType"><span class="type-signature"></span>getInputType<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#ScriptType">ScriptType</a>}</span></h4>
<div class="description">
<p>&quot;Guess&quot; the type of the input script.
This method is not 100% reliable.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2373">line 2373</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#ScriptType">ScriptType</a></span>
</dd>
</dl>
<h4 class="name" id="getNumber"><span class="type-signature"></span>getNumber<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#BN">BN</a>}</span></h4>
<div class="description">
<p>Get a number from the <code>code</code> array (5-byte limit).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2704">line 2704</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#BN">BN</a></span>
</dd>
</dl>
<h4 class="name" id="getRedeem"><span class="type-signature"></span>getRedeem<span class="signature">()</span><span class="type-signature"> &rarr; {Script|null}</span></h4>
<div class="description">
<p>Grab and deserialize the redeem script.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1925">line 1925</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Redeem script.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Script</span>
|
<span class="param-type">null</span>
</dd>
</dl>
<h4 class="name" id="getScripthashSigops"><span class="type-signature"></span>getScripthashSigops<span class="signature">(input)</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Count the sigops in the script, taking into account redeem scripts.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>input</code></td>
<td class="type">
<span class="param-type">Script</span>
</td>
<td class="description last"><p>Input script, needed for access to redeem script.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line3000">line 3000</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>sigop count</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getSigops"><span class="type-signature"></span>getSigops<span class="signature">(accurate)</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Count the sigops in the script.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>accurate</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="description last"><p>Whether to enable accurate counting. This will
take into account the <code>n</code> value for OP_CHECKMULTISIG(VERIFY).</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2960">line 2960</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>sigop count</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getSize"><span class="type-signature"></span>getSize<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Calculate the size of the script
excluding the varint size bytes.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2020">line 2020</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getSmall"><span class="type-signature"></span>getSmall<span class="signature">(index)</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Get a small integer from an opcode (OP_0-OP_16).</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2691">line 2691</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="getString"><span class="type-signature"></span>getString<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
<p>Get a string from the <code>code</code> array (utf8).</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2723">line 2723</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">String</span>
</dd>
</dl>
<h4 class="name" id="getSubscript"><span class="type-signature"></span>getSubscript<span class="signature">(lastSep<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {Script}</span></h4>
<div class="description">
<p>Get the script's &quot;subscript&quot; starting at a separator.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>lastSep</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"><p>The last separator to sign/verify beyond.</p></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line425">line 425</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
<p>Subscript.</p>
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Script</span>
</dd>
</dl>
<h4 class="name" id="getType"><span class="type-signature"></span>getType<span class="signature">()</span><span class="type-signature"> &rarr; {<a href="global.html#ScriptType">ScriptType</a>}</span></h4>
<div class="description">
<p>Get the standard script type.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1947">line 1947</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="global.html#ScriptType">ScriptType</a></span>
</dd>
</dl>
<h4 class="name" id="getVarSize"><span class="type-signature"></span>getVarSize<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Calculate the size of the script
including the varint size bytes.</p>
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2030">line 2030</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="hash160"><span class="type-signature"></span>hash160<span class="signature">(enc<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {<a href="global.html#Hash">Hash</a>}</span></h4>
<div class="description">
<p>Get the hash160 of the raw script.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>enc</code></td>
<td class="type">
<span class="param-type">String</span>
</td>
<td class="attributes">
&lt;nullable><br>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2061">line 2061</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type"><a href="global.html#Hash">Hash</a></span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="indexOf"><span class="type-signature"></span>indexOf<span class="signature">(data)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Find a data element in a script.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Data element to match against.</p></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1554">line 1554</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>Index (<code>-1</code> if not present).</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="inject"><span class="type-signature">(private) </span>inject<span class="signature">(script)</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Inject properties from script.
Used for cloning.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>script</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Script</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
8 years ago
</tbody>
</table>
9 years ago
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line298">line 298</a>
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Script</span>
</dd>
</dl>
9 years ago
8 years ago
<h4 class="name" id="insert"><span class="type-signature"></span>insert<span class="signature">(index, data)</span><span class="type-signature"></span></h4>
<div class="description">
<p>Insert an item into the <code>code</code> array.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
8 years ago
<th>Type</th>
9 years ago
8 years ago
9 years ago
8 years ago
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
<tr>
8 years ago
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
<span class="param-type">Number</span>
8 years ago
|
9 years ago
8 years ago
<span class="param-type">String</span>
|
9 years ago
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
|
9 years ago
8 years ago
<span class="param-type">Buffer</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2667">line 2667</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
8 years ago
<h4 class="name" id="inspect"><span class="type-signature"></span>inspect<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
9 years ago
9 years ago
8 years ago
<div class="description">
<p>Inspect the script.</p>
9 years ago
</div>
8 years ago
<dl class="details">
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line309">line 309</a>
</li></ul></dd>
9 years ago
8 years ago
9 years ago
8 years ago
</dl>
9 years ago
8 years ago
<h5>Returns:</h5>
9 years ago
8 years ago
<div class="param-desc">
<p>Human-readable script code.</p>
</div>
9 years ago
8 years ago
<dl>
<dt>
Type
</dt>
<dd>
9 years ago
8 years ago
<span class="param-type">String</span>
9 years ago
8 years ago
</dd>
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id="isCommitment"><span class="type-signature"></span>isCommitment<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Test whether the output script is a segregated witness
commitment.</p>
</div>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2238">line 2238</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isMultisig"><span class="type-signature"></span>isMultisig<span class="signature">(minimal<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
<div class="description">
<p>Test whether the output script is pay-to-multisig.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>minimal</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Boolean</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
&lt;optional><br>
9 years ago
8 years ago
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="default">
false
</td>
9 years ago
8 years ago
<td class="description last"><p>Minimaldata only.</p></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2130">line 2130</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isMultisigInput"><span class="type-signature"></span>isMultisigInput<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>&quot;Guess&quot; whether the input script is pay-to-multisig.
This method is not 100% reliable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2445">line 2445</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isNulldata"><span class="type-signature"></span>isNulldata<span class="signature">(minimal<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is nulldata/opreturn.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>minimal</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Minimaldata only.</p></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2188">line 2188</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isProgram"><span class="type-signature"></span>isProgram<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is a witness program.
Note that this will return true even for malformed
witness v0 programs.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2264">line 2264</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isPubkey"><span class="type-signature"></span>isPubkey<span class="signature">(minimal<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is pay-to-pubkey.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>minimal</code></td>
<td class="type">
<span class="param-type">Boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last"><p>Minimaldata only.</p></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2087">line 2087</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isPubkeyhash"><span class="type-signature"></span>isPubkeyhash<span class="signature">(minimal<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is pay-to-pubkeyhash.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
8 years ago
<th>Type</th>
9 years ago
8 years ago
<th>Attributes</th>
9 years ago
8 years ago
<th>Default</th>
9 years ago
8 years ago
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>minimal</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Boolean</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
&lt;optional><br>
9 years ago
8 years ago
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="default">
false
</td>
9 years ago
8 years ago
<td class="description last"><p>Minimaldata only.</p></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2106">line 2106</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isPubkeyhashInput"><span class="type-signature"></span>isPubkeyhashInput<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>&quot;Guess&quot; whether the input script is pay-to-pubkeyhash.
This method is not 100% reliable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2424">line 2424</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isPubkeyInput"><span class="type-signature"></span>isPubkeyInput<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>&quot;Guess&quot; whether the input script is pay-to-pubkey.
This method is not 100% reliable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2405">line 2405</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isPushOnly"><span class="type-signature"></span>isPushOnly<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test the script to see if it contains only push ops.
Push ops are: OP_1NEGATE, OP_0-OP_16 and all PUSHDATAs.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2934">line 2934</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isScripthash"><span class="type-signature"></span>isScripthash<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is pay-to-scripthash. Note that
bitcoin itself requires scripthashes to be in strict minimaldata
encoding. Using <code>OP_HASH160 OP_PUSHDATA1 [hash] OP_EQUAL</code> will
<em>not</em> be recognized as a scripthash.</p>
9 years ago
</div>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2175">line 2175</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isScripthashInput"><span class="type-signature"></span>isScripthashInput<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>&quot;Guess&quot; whether the input script is pay-to-scripthash.
This method is not 100% reliable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2479">line 2479</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isStandard"><span class="type-signature"></span>isStandard<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the script is standard by policy standards.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1989">line 1989</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isUnknown"><span class="type-signature"></span>isUnknown<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether a script is of an unknown/non-standard type.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1980">line 1980</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isUnknownInput"><span class="type-signature"></span>isUnknownInput<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>&quot;Guess&quot; whether the input script is an unknown/non-standard type.
This method is not 100% reliable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2395">line 2395</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isUnspendable"><span class="type-signature"></span>isUnspendable<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is unspendable.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2360">line 2360</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isWitnessMasthash"><span class="type-signature"></span>isWitnessMasthash<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script
is a pay-to-mast program.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2349">line 2349</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Boolean</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="isWitnessPubkeyhash"><span class="type-signature"></span>isWitnessPubkeyhash<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is
a pay-to-witness-pubkeyhash program.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2325">line 2325</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id="isWitnessScripthash"><span class="type-signature"></span>isWitnessScripthash<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test whether the output script is
a pay-to-witness-scripthash program.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2337">line 2337</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id="length_getter"><span class="type-signature">(private) </span>length_getter<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Getter to retrieve code length.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line107">line 107</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="length_setter"><span class="type-signature">(private) </span>length_setter<span class="signature">(value)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Setter to set code length.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>value</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line119">line 119</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="pop"><span class="type-signature"></span>pop<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer|Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Pop an item off of the <code>code</code> array.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2641">line 2641</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Buffer</span>
|
<span class="param-type">Number</span>
</dd>
</dl>
<h4 class="name" id="push"><span class="type-signature"></span>push<span class="signature">(data)</span><span class="type-signature"> &rarr; {Number}</span></h4>
<div class="description">
<p>Push an item onto the <code>code</code> array.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
8 years ago
<th>Type</th>
9 years ago
8 years ago
9 years ago
8 years ago
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Number</span>
|
9 years ago
8 years ago
<span class="param-type">String</span>
|
9 years ago
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
|
9 years ago
8 years ago
<span class="param-type">Buffer</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2620">line 2620</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p>Length.</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="remove"><span class="type-signature"></span>remove<span class="signature">(index)</span><span class="type-signature"> &rarr; {Buffer|Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Remove an item from the <code>code</code> array.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2654">line 2654</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Buffer</span>
|
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="removeData"><span class="type-signature"></span>removeData<span class="signature">(data)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Remove all matched data elements from
a script's code (used to remove signatures
before verification). Note that this
compares and removes data on the <em>byte level</em>.
It also reserializes the data to a single
script with minimaldata encoding beforehand.
A signature will <em>not</em> be removed if it is
not minimaldata.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Buffer</span>
</td>
<td class="description last"><p>Data element to match against.</p></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line1508">line 1508</a>
9 years ago
</li></ul></dd>
8 years ago
<dt class="tag-see">See:</dt>
<dd class="tag-see">
<ul>
<li><a href="https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2014-November/006878.html">https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2014-November/006878.html</a></li>
<li><a href="https://test.webbtc.com/tx/19aa42fee0fa57c45d3b16488198b27caaacc4ff5794510d0c17f173f05587ff">https://test.webbtc.com/tx/19aa42fee0fa57c45d3b16488198b27caaacc4ff5794510d0c17f173f05587ff</a></li>
</ul>
</dd>
9 years ago
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p>Total.</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="removeSeparators"><span class="type-signature"></span>removeSeparators<span class="signature">()</span><span class="type-signature"> &rarr; {Script}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Get the script's &quot;subscript&quot; starting at a separator.
Remove all OP_CODESEPARATORs if present. This bizarre
behavior is necessary for signing and verification when
code separators are present.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line452">line 452</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p>Subscript.</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Script</span>
9 years ago
8 years ago
</dd>
</dl>
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id="set"><span class="type-signature"></span>set<span class="signature">(index, data)</span><span class="type-signature"></span></h4>
9 years ago
8 years ago
<div class="description">
<p>Set an item in the <code>code</code> array.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
9 years ago
8 years ago
<th>Type</th>
9 years ago
8 years ago
9 years ago
8 years ago
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">Number</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
<tr>
<td class="name"><code>data</code></td>
<td class="type">
<span class="param-type">Buffer</span>
|
9 years ago
8 years ago
<span class="param-type">Number</span>
|
9 years ago
8 years ago
<span class="param-type">String</span>
|
9 years ago
8 years ago
<span class="param-type"><a href="global.html#BN">BN</a></span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2744">line 2744</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
9 years ago
8 years ago
9 years ago
8 years ago
<h4 class="name" id="sha256"><span class="type-signature"></span>sha256<span class="signature">(enc<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {<a href="global.html#Hash">Hash</a>}</span></h4>
9 years ago
8 years ago
<div class="description">
<p>Get the sha256 of the raw script.</p>
</div>
9 years ago
8 years ago
<h5>Parameters:</h5>
9 years ago
8 years ago
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>enc</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">String</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2074">line 2074</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type"><a href="global.html#Hash">Hash</a></span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="shift"><span class="type-signature"></span>shift<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer|Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Shift an item off of the <code>code</code> array.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2629">line 2629</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Buffer</span>
|
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="test"><span class="type-signature"></span>test<span class="signature">(filter)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Test the script against a bloom filter.</p>
9 years ago
</div>
8 years ago
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>filter</code></td>
<td class="type">
<span class="param-type">Bloom</span>
</td>
<td class="description last"></td>
</tr>
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2585">line 2585</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Boolean</span>
</dd>
</dl>
8 years ago
<h4 class="name" id="toArray"><span class="type-signature"></span>toArray<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Convert the script to an array of
Buffers (pushdatas) and Numbers
(opcodes).</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line181">line 181</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Array</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toASM"><span class="type-signature"></span>toASM<span class="signature">(decode<span class="signature-attributes">nullable</span>)</span><span class="type-signature"> &rarr; {String}</span></h4>
<div class="description">
<p>Format the script as bitcoind asm.</p>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th class="last">Description</th>
</tr>
</thead>
9 years ago
8 years ago
<tbody>
9 years ago
8 years ago
<tr>
<td class="name"><code>decode</code></td>
9 years ago
8 years ago
<td class="type">
<span class="param-type">Boolean</span>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
<td class="attributes">
9 years ago
8 years ago
&lt;nullable><br>
9 years ago
8 years ago
</td>
9 years ago
8 years ago
9 years ago
8 years ago
<td class="description last"><p>Attempt to decode hash types.</p></td>
</tr>
9 years ago
8 years ago
</tbody>
</table>
9 years ago
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line328">line 328</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
8 years ago
<div class="param-desc">
<p>Human-readable script.</p>
</div>
9 years ago
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">String</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toCode"><span class="type-signature"></span>toCode<span class="signature">()</span><span class="type-signature"> &rarr; {Array:<a href="global.html"></a>.&lt;Opcode:<a href="global.html"></a>>}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Return an array of opcodes.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line247">line 247</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Array:<a href="global.html"></a>.&lt;Opcode:<a href="global.html"></a>></span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Convert script to a hex string.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line394">line 394</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">String</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toProgram"><span class="type-signature"></span>toProgram<span class="signature">()</span><span class="type-signature"> &rarr; {Program|null}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Get the witness program if present.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2284">line 2284</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Program</span>
|
<span class="param-type">null</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toRaw"><span class="type-signature"></span>toRaw<span class="signature">(enc)</span><span class="type-signature"> &rarr; {Buffer|String}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Encode the script to a Buffer. See Script#encode.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>enc</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">String</span>
9 years ago
</td>
8 years ago
<td class="description last"><p>Encoding, either <code>'hex'</code> or <code>null</code>.</p></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line385">line 385</a>
9 years ago
</li></ul></dd>
</dl>
9 years ago
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>Serialized script.</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Buffer</span>
|
<span class="param-type">String</span>
9 years ago
</dd>
</dl>
9 years ago
9 years ago
8 years ago
<h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Convert the script to a bitcoind test string.</p>
9 years ago
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line318">line 318</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>Human-readable script code.</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">String</span>
9 years ago
</dd>
</dl>
8 years ago
<h4 class="name" id="toWriter"><span class="type-signature"></span>toWriter<span class="signature">(bw)</span><span class="type-signature"></span></h4>
9 years ago
<div class="description">
8 years ago
<p>Write the script to a buffer writer.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>bw</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">BufferWriter</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line374">line 374</a>
9 years ago
</li></ul></dd>
</dl>
8 years ago
<h4 class="name" id="unshift"><span class="type-signature"></span>unshift<span class="signature">(data)</span><span class="type-signature"> &rarr; {Number}</span></h4>
9 years ago
<div class="description">
8 years ago
<p>Unshift an item onto the <code>code</code> array.</p>
9 years ago
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
8 years ago
<td class="name"><code>data</code></td>
9 years ago
<td class="type">
8 years ago
<span class="param-type">Number</span>
|
9 years ago
<span class="param-type">String</span>
8 years ago
|
<span class="param-type"><a href="global.html#BN">BN</a></span>
|
<span class="param-type">Buffer</span>
9 years ago
</td>
8 years ago
<td class="description last"></td>
9 years ago
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
8 years ago
<a href="script_script.js.html">script/script.js</a>, <a href="script_script.js.html#line2610">line 2610</a>
9 years ago
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
8 years ago
<p>Length.</p>
9 years ago
</div>
<dl>
<dt>
Type
</dt>
<dd>
8 years ago
<span class="param-type">Number</span>
9 years ago
</dd>
</dl>
9 years ago
</article>
</section>
</div>
<nav>
8 years ago
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-bcoin.html">bcoin</a></li><li><a href="module-bip70.html">bip70</a></li><li><a href="module-bip70_pk.html">bip70/pk</a></li><li><a href="module-bip70_x509.html">bip70/x509</a></li><li><a href="module-blockchain.html">blockchain</a></li><li><a href="module-blockchain_common.html">blockchain/common</a></li><li><a href="module-btc.html">btc</a></li><li><a href="module-coins.html">coins</a></li><li><a href="module-crypto.html">crypto</a></li><li><a href="module-crypto_chachapoly.html">crypto/chachapoly</a></li><li><a href="module-crypto_ec.html">crypto/ec</a></li><li><a href="module-crypto_pk.html">crypto/pk</a></li><li><a href="module-crypto_schnorr.html">crypto/schnorr</a></li><li><a href="module-crypto_siphash.html">crypto/siphash</a></li><li><a href="module-db.html">db</a></li><li><a href="module-hd.html">hd</a></li><li><a href="module-http.html">http</a></li><li><a href="module-mempool.html">mempool</a></li><li><a href="module-mining.html">mining</a></li><li><a href="module-net.html">net</a></li><li><a href="module-net_bip152.html">net/bip152</a></li><li><a href="module-net_common.html">net/common</a></li><li><a href="module-net_dns.html">net/dns</a></li><li><a href="module-net_packets.html">net/packets</a></li><li><a href="module-net_socks.html">net/socks</a></li><li><a href="module-net_tcp.html">net/tcp</a></li><li><a href="module-node.html">node</a></li><li><a href="module-node_config.html">node/config</a></li><li><a href="module-primitives.html">primitives</a></li><li><a href="module-protocol.html">protocol</a></li><li><a href="module-protocol_consensus.html">protocol/consensus</a></li><li><a href="module-protocol_errors.html">protocol/errors</a></li><li><a href="module-protocol_networks.html">protocol/networks</a></li><li><a href="module-protocol_policy.html">protocol/policy</a></li><li><a href="module-script.html">script</a></li><li><a href="module-script_common.html">script/common</a></li><li><a href="module-utils.html">utils</a></li><li><a href="module-utils_asn1.html">utils/asn1</a></li><li><a href="module-utils_base32.html">utils/base32</a></li><li><a href="module-utils_base58.html">utils/base58</a></li><li><a href="module-utils_co.html">utils/co</a></li><li><a href="module-utils_encoding.html">utils/encoding</a></li><li><a href="module-utils_ip.html">utils/ip</a></li><li><a href="module-utils_pem.html">utils/pem</a></li><li><a href="module-utils_protobuf.html">utils/protobuf</a></li><li><a href="module-utils_util.html">utils/util</a></li><li><a href="module-wallet.html">wallet</a></li><li><a href="module-wallet_common.html">wallet/common</a></li><li><a href="module-wallet_records.html">wallet/records</a></li><li><a href="module-workers.html">workers</a></li><li><a href="module-workers_jobs.html">workers/jobs</a></li><li><a href="module-workers_packets.html">workers/packets</a></li></ul><h3>Classes</h3><ul><li><a href="Environment.html">Environment</a></li><li><a href="module-bip70.Payment.html">Payment</a></li><li><a href="module-bip70.PaymentACK.html">PaymentACK</a></li><li><a href="module-bip70.PaymentDetails.html">PaymentDetails</a></li><li><a href="module-bip70.PaymentRequest.html">PaymentRequest</a></li><li><a href="module-blockchain.Chain.html">Chain</a></li><li><a href="module-blockchain.ChainDB.html">ChainDB</a></li><li><a href="module-blockchain.ChainEntry.html">ChainEntry</a></li><li><a href="module-blockchain.ChainFlags.html">ChainFlags</a></li><li><a href="module-blockchain.ChainOptions.html">ChainOptions</a></li><li><a href="module-blockchain.ChainState.html">ChainState</a></li><li><a href="module-blockchain.DeploymentState.html">DeploymentState</a></li><li><a href="module-blockchain.StateCache.html">StateCache</a></li><li><a href="module-btc.Amount.html">Amount</a></li><li><a href="module-btc.URI.html">URI</a></li><li><a href="module-coins.CoinEntry.html">CoinEntry</a></li><li><a href="module-coins.Coins.html">Coins</a></li><li><a href="module-coins.CoinView.html">CoinView</a></li><li><a href="module-coins.UndoCoi
9 years ago
</nav>
<br class="clear">
<footer>
8 years ago
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Tue Feb 07 2017 16:09:48 GMT-0800 (PST)
9 years ago
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>