Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

copied the bitcoin wiki site of bitcoin script

  • Loading branch information...
commit fe69b2ce10197176c863de6bec46b8d1ccf4a136 1 parent 286f366
authored October 26, 2011

Showing 1 changed file with 1,691 additions and 0 deletions. Show diff stats Hide diff stats

  1. 1,691  docu.html
1,691  docu.html
... ...
@@ -0,0 +1,1691 @@
  1
+<html dir="ltr" lang="en"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  2
+<!-- base href="https://en.bitcoin.it/wiki/Script" --><title>Script - Bitcoin</title><meta charset="UTF-8"><meta name="generator" content="MediaWiki 1.19alpha"><meta name="ResourceLoaderDynamicStyles" content=""></head><body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-Script action-view skin-vector"><div style="background: none repeat scroll 0% 0% rgb(255, 255, 255); border: 1px solid rgb(153, 153, 153); margin: -1px -1px 0pt; padding: 0pt;"><div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); border: 1px solid rgb(153, 153, 153); color: rgb(0, 0, 0); font: 13px arial,sans-serif; margin: 12px; padding: 8px; text-align: left;">Dies ist der Cache von Google von <a href="https://en.bitcoin.it/wiki/Script" style="text-decoration: underline; color: rgb(0, 0, 204);">https://en.bitcoin.it/wiki/Script</a>. Es handelt sich dabei um ein Abbild der Seite, wie diese am 20. Okt. 2011 16:27:03 GMT angezeigt wurde. Die <a href="https://en.bitcoin.it/wiki/Script" style="text-decoration: underline; color: rgb(0, 0, 204);">aktuelle Seite</a> sieht mittlerweile eventuell anders aus. <a href="http://www.google.com/intl/de/help/features_list.html#cached" style="text-decoration: underline; color: rgb(0, 0, 204);">Weitere Informationen</a><br><br><div style="float: right;"><a href="http://webcache.googleusercontent.com/search?q=cache:isSyIy2stOMJ:https://en.bitcoin.it/wiki/Script+bitcoin+script&amp;hl=de&amp;strip=0" style="text-decoration: underline; color: rgb(0, 0, 204);">Vollständige Version</a></div>
  3
+<div>Diese Suchbegriffe sind markiert: <span style="background: none repeat scroll 0% 0% rgb(255, 255, 102); color: black; font-weight: bold;">bitcoin</span>&nbsp;<span style="background: none repeat scroll 0% 0% rgb(160, 255, 255); color: black; font-weight: bold;">script</span>&nbsp;&nbsp;</div></div></div><div style="position: relative;">
  4
+
  5
+
  6
+
  7
+
  8
+
  9
+
  10
+
  11
+
  12
+
  13
+
  14
+
  15
+
  16
+
  17
+
  18
+
  19
+
  20
+
  21
+<!--[if lt IE 7]><style type="text/css">body{behavior:url("/w/skins/vector/csshover.min.htc")}</style><![endif]-->
  22
+		<div id="mw-page-base" class="noprint"></div>
  23
+		<div id="mw-head-base" class="noprint"></div>
  24
+		<!-- content -->
  25
+		<div id="content">
  26
+			<a id="top"></a>
  27
+			<div id="mw-js-message" style="display: none;"></div>
  28
+						<!-- firstHeading -->
  29
+			<h1 id="firstHeading" class="firstHeading"><b style="color: black; background-color: rgb(160, 255, 255);">Script</b></h1>
  30
+			<!-- /firstHeading -->
  31
+			<!-- bodyContent -->
  32
+			<div id="bodyContent">
  33
+								<!-- tagline -->
  34
+				<div id="siteSub">From <b style="color: black; background-color: rgb(255, 255, 102);">Bitcoin</b></div>
  35
+				<!-- /tagline -->
  36
+								<!-- subtitle -->
  37
+				<div id="contentSub"></div>
  38
+				<!-- /subtitle -->
  39
+																<!-- jumpto -->
  40
+				<div id="jump-to-nav">
  41
+					Jump to: <a href="#mw-head">navigation</a>,
  42
+					<a href="#p-search">search</a>
  43
+				</div>
  44
+				<!-- /jumpto -->
  45
+								<!-- bodytext -->
  46
+				<div dir="ltr" class="mw-content-ltr" lang="en"><p><b style="color: black; background-color: rgb(255, 255, 102);">Bitcoin</b> uses a scripting system for <a href="https://en.bitcoin.it/wiki/Transactions" title="Transactions">transactions</a>. <a href="http://en.wikipedia.org/wiki/FORTH" class="extiw" title="wikipedia:FORTH">Forth</a>-like, <b style="color: black; background-color: rgb(160, 255, 255);">Script</b> is simple, stack-based, and processed from left to right. It is purposefully not Turing-complete, with no loops or nesting <i>if</i> statements.
  47
+</p><p>A <b style="color: black; background-color: rgb(160, 255, 255);">script</b>
  48
+ is essentially a list of instructions recorded with each transaction 
  49
+that describe how the next person wanting to spend the Bitcoins being 
  50
+transferred can gain access to them.  The <b style="color: black; background-color: rgb(160, 255, 255);">script</b> for a typical <b style="color: black; background-color: rgb(255, 255, 102);">Bitcoin</b> transfer to destination <b style="color: black; background-color: rgb(255, 255, 102);">Bitcoin</b> address D simply encumbers future spending of the bitcoins with two things: the spender must provide
  51
+</p>
  52
+<ol><li> a public key that, when hashed, yields destination address D embedded in the <b style="color: black; background-color: rgb(160, 255, 255);">script</b>, and
  53
+</li><li> a signature to show evidence of the private key corresponding to the public key just provided.
  54
+</li></ol>
  55
+<p>Scripting provides the flexibility to change the parameters of what's
  56
+ needed to spend transferred Bitcoins.  For example, the scripting 
  57
+system could be used to require two private keys, or a combination of 
  58
+several, or even no keys at all.
  59
+</p><p>A transaction is valid if nothing in the combined <b style="color: black; background-color: rgb(160, 255, 255);">script</b> triggers failure and the top stack item is true (1).  The party who originally <i>sent</i> the Bitcoins now being spent, dictates the <b style="color: black; background-color: rgb(160, 255, 255);">script</b> operations that will occur <i>last</i>
  60
+ in order to release them for use in another transaction.  The party 
  61
+wanting to spend them must provide the input(s) to the previously 
  62
+recorded <b style="color: black; background-color: rgb(160, 255, 255);">script</b> that results in those operations occurring last leaving behind true (1).
  63
+</p><p>Scripts are big-endian. (Is all data, also?)
  64
+</p>
  65
+<table id="toc" class="toc"><tbody><tr><td><div id="toctitle"><h2>Contents</h2></div>
  66
+<ul>
  67
+<li class="toclevel-1 tocsection-1"><a href="#Words">1 Words</a>
  68
+<ul>
  69
+<li class="toclevel-2 tocsection-2"><a href="#Constants">1.1 Constants</a></li>
  70
+<li class="toclevel-2 tocsection-3"><a href="#Flow_control">1.2 Flow control</a></li>
  71
+<li class="toclevel-2 tocsection-4"><a href="#Stack">1.3 Stack</a></li>
  72
+<li class="toclevel-2 tocsection-5"><a href="#Splice">1.4 Splice</a></li>
  73
+<li class="toclevel-2 tocsection-6"><a href="#Bitwise_logic">1.5 Bitwise logic</a></li>
  74
+<li class="toclevel-2 tocsection-7"><a href="#Arithmetic">1.6 Arithmetic</a></li>
  75
+<li class="toclevel-2 tocsection-8"><a href="#Crypto">1.7 Crypto</a></li>
  76
+<li class="toclevel-2 tocsection-9"><a href="#Pseudo-words">1.8 Pseudo-words</a></li>
  77
+<li class="toclevel-2 tocsection-10"><a href="#Reserved_words">1.9 Reserved words</a></li>
  78
+</ul>
  79
+</li>
  80
+<li class="toclevel-1 tocsection-11"><a href="#Scripts">2 Scripts</a>
  81
+<ul>
  82
+<li class="toclevel-2 tocsection-12"><a href="#Standard_Transaction_to_Bitcoin_address">2.1 Standard Transaction to <b style="color: black; background-color: rgb(255, 255, 102);">Bitcoin</b> address</a></li>
  83
+<li class="toclevel-2 tocsection-13"><a href="#Standard_Generation_.2F_transaction_to_IP_address">2.2 Standard Generation / transaction to IP address</a></li>
  84
+<li class="toclevel-2 tocsection-14"><a href="#Transaction_with_a_message">2.3 Transaction with a message</a></li>
  85
+<li class="toclevel-2 tocsection-15"><a href="#Example_non_standard_transaction_on_Testnet">2.4 Example non standard transaction on Testnet</a></li>
  86
+</ul>
  87
+</li>
  88
+<li class="toclevel-1 tocsection-16"><a href="#See_Also">3 See Also</a></li>
  89
+</ul>
  90
+</td></tr></tbody></table>
  91
+<h2>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=1" title="Edit section: Words">edit</a>]  Words </h2>
  92
+<p>This is a list of all <b style="color: black; background-color: rgb(160, 255, 255);">Script</b> words (commands/functions). Some are currently disabled for security reasons.
  93
+</p><p>True=1 and False=0.
  94
+</p>
  95
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=2" title="Edit section: Constants">edit</a>]  Constants </h3>
  96
+<p>When talking about scripts, these value-pushing words are usually omitted.
  97
+</p>
  98
+Word
  99
+
  100
+Opcode
  101
+
  102
+Input
  103
+
  104
+Output
  105
+
  106
+Description
  107
+
  108
+<table class="wikitable">
  109
+
  110
+<tbody><tr>
  111
+</tr>
  112
+</tbody><tbody>
  113
+<tr>
  114
+<td>OP_0, OP_FALSE
  115
+</td>
  116
+<td>0
  117
+</td>
  118
+<td>Nothing.
  119
+</td>
  120
+<td>0
  121
+</td>
  122
+<td>The number 0 is pushed onto the stack.
  123
+</td>
  124
+</tr>
  125
+<tr>
  126
+<td>N/A
  127
+</td>
  128
+<td>1-75
  129
+</td>
  130
+<td>(special)
  131
+</td>
  132
+<td>data
  133
+</td>
  134
+<td>The next <i>opcode</i> bytes is data to be pushed onto the stack
  135
+</td>
  136
+</tr>
  137
+<tr>
  138
+<td>OP_PUSHDATA1
  139
+</td>
  140
+<td>76
  141
+</td>
  142
+<td>(special)
  143
+</td>
  144
+<td>data
  145
+</td>
  146
+<td>The next byte contains the number of bytes to be pushed onto the stack.
  147
+</td>
  148
+</tr>
  149
+<tr>
  150
+<td>OP_PUSHDATA2
  151
+</td>
  152
+<td>77
  153
+</td>
  154
+<td>(special)
  155
+</td>
  156
+<td>data
  157
+</td>
  158
+<td>The next two bytes contain the number of bytes to be pushed onto the stack.
  159
+</td>
  160
+</tr>
  161
+<tr>
  162
+<td>OP_PUSHDATA4
  163
+</td>
  164
+<td>78
  165
+</td>
  166
+<td>(special)
  167
+</td>
  168
+<td>data
  169
+</td>
  170
+<td>The next four bytes contain the number of bytes to be pushed onto the stack.
  171
+</td>
  172
+</tr>
  173
+<tr>
  174
+<td>OP_1NEGATE
  175
+</td>
  176
+<td>79
  177
+</td>
  178
+<td>Nothing.
  179
+</td>
  180
+<td>-1
  181
+</td>
  182
+<td>The number -1 is pushed onto the stack.
  183
+</td>
  184
+</tr>
  185
+<tr>
  186
+<td>OP_1, OP_TRUE
  187
+</td>
  188
+<td>81
  189
+</td>
  190
+<td>Nothing.
  191
+</td>
  192
+<td>1
  193
+</td>
  194
+<td>The number 1 is pushed onto the stack.
  195
+</td>
  196
+</tr>
  197
+<tr>
  198
+<td>OP_2-OP_16
  199
+</td>
  200
+<td>82-96
  201
+</td>
  202
+<td>Nothing.
  203
+</td>
  204
+<td>2-16
  205
+</td>
  206
+<td>The number in the word name (2-16) is pushed onto the stack.
  207
+</td>
  208
+</tr></tbody>
  209
+</table>
  210
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=3" title="Edit section: Flow control">edit</a>]  Flow control </h3>
  211
+Word
  212
+
  213
+Opcode
  214
+
  215
+Input
  216
+
  217
+Output
  218
+
  219
+Description
  220
+
  221
+<table class="wikitable">
  222
+
  223
+<tbody><tr>
  224
+</tr>
  225
+</tbody><tbody>
  226
+<tr>
  227
+<td>OP_NOP
  228
+</td>
  229
+<td>97
  230
+</td>
  231
+<td>Nothing
  232
+</td>
  233
+<td>Nothing
  234
+</td>
  235
+<td>Does nothing.
  236
+</td>
  237
+</tr>
  238
+<tr>
  239
+<td>OP_IF
  240
+</td>
  241
+<td>99
  242
+</td>
  243
+<td colspan="2">&lt;expression&gt; if [statements] [else [statements]] endif
  244
+</td>
  245
+<td>If the top stack value is 1, the statements are executed. The top stack value is removed.
  246
+</td>
  247
+</tr>
  248
+<tr>
  249
+<td>OP_NOTIF
  250
+</td>
  251
+<td>100
  252
+</td>
  253
+<td colspan="2">&lt;expression&gt; if [statements] [else [statements]] endif
  254
+</td>
  255
+<td>If the top stack value is 0, the statements are executed. The top stack value is removed.
  256
+</td>
  257
+</tr>
  258
+<tr>
  259
+<td>OP_ELSE
  260
+</td>
  261
+<td>103
  262
+</td>
  263
+<td colspan="2">&lt;expression&gt; if [statements] [else [statements]] endif
  264
+</td>
  265
+<td>If the preceding OP_IF or OP_NOTIF was not executed then these statements are.
  266
+</td>
  267
+</tr>
  268
+<tr>
  269
+<td>OP_ENDIF
  270
+</td>
  271
+<td>104
  272
+</td>
  273
+<td colspan="2">&lt;expression&gt; if [statements] [else [statements]] endif
  274
+</td>
  275
+<td>Ends an if/else block.
  276
+</td>
  277
+</tr>
  278
+<tr>
  279
+<td>OP_VERIFY
  280
+</td>
  281
+<td>105
  282
+</td>
  283
+<td>True / false
  284
+</td>
  285
+<td>Nothing / False
  286
+</td>
  287
+<td><b>Marks transaction as invalid</b> if top stack value is not true. True is removed, but false is not.
  288
+</td>
  289
+</tr>
  290
+<tr>
  291
+<td>OP_RETURN
  292
+</td>
  293
+<td>106
  294
+</td>
  295
+<td>Nothing
  296
+</td>
  297
+<td>Nothing
  298
+</td>
  299
+<td><b>Marks transaction as invalid</b>.
  300
+</td>
  301
+</tr></tbody>
  302
+</table>
  303
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=4" title="Edit section: Stack">edit</a>]  Stack </h3>
  304
+Word
  305
+
  306
+Opcode
  307
+
  308
+Input
  309
+
  310
+Output
  311
+
  312
+Description
  313
+
  314
+<table class="wikitable">
  315
+
  316
+<tbody><tr>
  317
+</tr>
  318
+</tbody><tbody>
  319
+<tr>
  320
+<td>OP_TOALTSTACK
  321
+</td>
  322
+<td>107
  323
+</td>
  324
+<td>x1
  325
+</td>
  326
+<td>(alt)x1
  327
+</td>
  328
+<td>Puts the input onto the top of the alt stack. Removes it from the main stack.
  329
+</td>
  330
+</tr>
  331
+<tr>
  332
+<td>OP_FROMALTSTACK
  333
+</td>
  334
+<td>108
  335
+</td>
  336
+<td>(alt)x1
  337
+</td>
  338
+<td>x1
  339
+</td>
  340
+<td>Puts the input onto the top of the main stack. Removes it from the alt stack.
  341
+</td>
  342
+</tr>
  343
+<tr>
  344
+<td>OP_IFDUP
  345
+</td>
  346
+<td>115
  347
+</td>
  348
+<td>x
  349
+</td>
  350
+<td>x / x x
  351
+</td>
  352
+<td>If the input is true or false, duplicate it.
  353
+</td>
  354
+</tr>
  355
+<tr>
  356
+<td>OP_DEPTH
  357
+</td>
  358
+<td>116
  359
+</td>
  360
+<td>Nothing
  361
+</td>
  362
+<td>&lt;Stack size&gt;
  363
+</td>
  364
+<td>Puts the number of stack items onto the stack.
  365
+</td>
  366
+</tr>
  367
+<tr>
  368
+<td>OP_DROP
  369
+</td>
  370
+<td>117
  371
+</td>
  372
+<td>x
  373
+</td>
  374
+<td>Nothing
  375
+</td>
  376
+<td>Removes the top stack item.
  377
+</td>
  378
+</tr>
  379
+<tr>
  380
+<td>OP_DUP
  381
+</td>
  382
+<td>118
  383
+</td>
  384
+<td>x
  385
+</td>
  386
+<td>x x
  387
+</td>
  388
+<td>Duplicates the top stack item.
  389
+</td>
  390
+</tr>
  391
+<tr>
  392
+<td>OP_NIP
  393
+</td>
  394
+<td>119
  395
+</td>
  396
+<td>x1 x2
  397
+</td>
  398
+<td>x2
  399
+</td>
  400
+<td>Removes the second-to-top stack item.
  401
+</td>
  402
+</tr>
  403
+<tr>
  404
+<td>OP_OVER
  405
+</td>
  406
+<td>120
  407
+</td>
  408
+<td>x1 x2
  409
+</td>
  410
+<td>x1 x2 x1
  411
+</td>
  412
+<td>Copies the second-to-top stack item to the top.
  413
+</td>
  414
+</tr>
  415
+<tr>
  416
+<td>OP_PICK
  417
+</td>
  418
+<td>121
  419
+</td>
  420
+<td>xn ... x2 x1 x0 &lt;n&gt;
  421
+</td>
  422
+<td>xn ... x2 x1 x0 xn
  423
+</td>
  424
+<td>The item <i>n</i> back in the stack is copied to the top.
  425
+</td>
  426
+</tr>
  427
+<tr>
  428
+<td>OP_ROLL
  429
+</td>
  430
+<td>122
  431
+</td>
  432
+<td>xn ... x2 x1 x0 &lt;n&gt;
  433
+</td>
  434
+<td>... x2 x1 x0 xn
  435
+</td>
  436
+<td>The item <i>n</i> back in the stack is moved to the top.
  437
+</td>
  438
+</tr>
  439
+<tr>
  440
+<td>OP_ROT
  441
+</td>
  442
+<td>123
  443
+</td>
  444
+<td>x1 x2 x3
  445
+</td>
  446
+<td>x2 x3 x1
  447
+</td>
  448
+<td>The top three items on the stack are rotated to the left.
  449
+</td>
  450
+</tr>
  451
+<tr>
  452
+<td>OP_SWAP
  453
+</td>
  454
+<td>124
  455
+</td>
  456
+<td>x1 x2
  457
+</td>
  458
+<td>x2 x1
  459
+</td>
  460
+<td>The top two items on the stack are swapped.
  461
+</td>
  462
+</tr>
  463
+<tr>
  464
+<td>OP_TUCK
  465
+</td>
  466
+<td>125
  467
+</td>
  468
+<td>x1 x2
  469
+</td>
  470
+<td>x2 x1 x2
  471
+</td>
  472
+<td>The item at the top of the stack is copied and inserted before the second-to-top item.
  473
+</td>
  474
+</tr>
  475
+<tr>
  476
+<td>OP_2DROP
  477
+</td>
  478
+<td>109
  479
+</td>
  480
+<td>x1 x2
  481
+</td>
  482
+<td>Nothing
  483
+</td>
  484
+<td>Removes the top two stack items.
  485
+</td>
  486
+</tr>
  487
+<tr>
  488
+<td>OP_2DUP
  489
+</td>
  490
+<td>110
  491
+</td>
  492
+<td>x1 x2
  493
+</td>
  494
+<td>x1 x2 x1 x2
  495
+</td>
  496
+<td>Duplicates the top two stack items.
  497
+</td>
  498
+</tr>
  499
+<tr>
  500
+<td>OP_3DUP
  501
+</td>
  502
+<td>111
  503
+</td>
  504
+<td>x1 x2 x3
  505
+</td>
  506
+<td>x1 x2 x3 x1 x2 x3
  507
+</td>
  508
+<td>Duplicates the top three stack items.
  509
+</td>
  510
+</tr>
  511
+<tr>
  512
+<td>OP_2OVER
  513
+</td>
  514
+<td>112
  515
+</td>
  516
+<td>x1 x2 x3 x4
  517
+</td>
  518
+<td>x1 x2 x3 x4 x1 x2
  519
+</td>
  520
+<td>Copies the pair of items two spaces back in the stack to the front.
  521
+</td>
  522
+</tr>
  523
+<tr>
  524
+<td>OP_2ROT
  525
+</td>
  526
+<td>113
  527
+</td>
  528
+<td>x1 x2 x3 x4 x5 x6
  529
+</td>
  530
+<td>x3 x4 x5 x6 x1 x2
  531
+</td>
  532
+<td>The fifth and sixth items back are moved to the top of the stack.
  533
+</td>
  534
+</tr>
  535
+<tr>
  536
+<td>OP_2SWAP
  537
+</td>
  538
+<td>114
  539
+</td>
  540
+<td>x1 x2 x3 x4
  541
+</td>
  542
+<td>x3 x4 x1 x2
  543
+</td>
  544
+<td>Swaps the top two pairs of items.
  545
+</td>
  546
+</tr></tbody>
  547
+</table>
  548
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=5" title="Edit section: Splice">edit</a>]  Splice </h3>
  549
+Word
  550
+
  551
+Opcode
  552
+
  553
+Input
  554
+
  555
+Output
  556
+
  557
+Description
  558
+
  559
+<table class="wikitable">
  560
+
  561
+<tbody><tr>
  562
+</tr>
  563
+</tbody><tbody>
  564
+<tr>
  565
+<td>OP_CAT
  566
+</td>
  567
+<td>126
  568
+</td>
  569
+<td>x1 x2
  570
+</td>
  571
+<td>out
  572
+</td>
  573
+<td>Concatenates two strings. <i>Currently disabled.</i>
  574
+</td>
  575
+</tr>
  576
+<tr>
  577
+<td>OP_SUBSTR
  578
+</td>
  579
+<td>127
  580
+</td>
  581
+<td>in begin size
  582
+</td>
  583
+<td>out
  584
+</td>
  585
+<td>Returns a section of a string. <i>Currently disabled.</i>
  586
+</td>
  587
+</tr>
  588
+<tr>
  589
+<td>OP_LEFT
  590
+</td>
  591
+<td>128
  592
+</td>
  593
+<td>in size
  594
+</td>
  595
+<td>out
  596
+</td>
  597
+<td>Keeps only characters left of the specified point in a string. <i>Currently disabled.</i>
  598
+</td>
  599
+</tr>
  600
+<tr>
  601
+<td>OP_RIGHT
  602
+</td>
  603
+<td>129
  604
+</td>
  605
+<td>in size
  606
+</td>
  607
+<td>out
  608
+</td>
  609
+<td>Keeps only characters right of the specified point in a string. <i>Currently disabled.</i>
  610
+</td>
  611
+</tr>
  612
+<tr>
  613
+<td>OP_SIZE
  614
+</td>
  615
+<td>130
  616
+</td>
  617
+<td>in
  618
+</td>
  619
+<td>in size
  620
+</td>
  621
+<td>Returns the length of the input string.
  622
+</td>
  623
+</tr></tbody>
  624
+</table>
  625
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=6" title="Edit section: Bitwise logic">edit</a>]  Bitwise logic </h3>
  626
+Word
  627
+
  628
+Opcode
  629
+
  630
+Input
  631
+
  632
+Output
  633
+
  634
+Description
  635
+
  636
+<table class="wikitable">
  637
+
  638
+<tbody><tr>
  639
+</tr>
  640
+</tbody><tbody>
  641
+<tr>
  642
+<td>OP_INVERT
  643
+</td>
  644
+<td>131
  645
+</td>
  646
+<td>in
  647
+</td>
  648
+<td>out
  649
+</td>
  650
+<td>Flips all of the bits in the input. <i>Currently disabled.</i>
  651
+</td>
  652
+</tr>
  653
+<tr>
  654
+<td>OP_AND
  655
+</td>
  656
+<td>132
  657
+</td>
  658
+<td>x1 x2
  659
+</td>
  660
+<td>out
  661
+</td>
  662
+<td>Boolean <i>and</i> between each bit in the inputs. <i>Currently disabled.</i>
  663
+</td>
  664
+</tr>
  665
+<tr>
  666
+<td>OP_OR
  667
+</td>
  668
+<td>133
  669
+</td>
  670
+<td>x1 x2
  671
+</td>
  672
+<td>out
  673
+</td>
  674
+<td>Boolean <i>or</i> between each bit in the inputs. <i>Currently disabled.</i>
  675
+</td>
  676
+</tr>
  677
+<tr>
  678
+<td>OP_XOR
  679
+</td>
  680
+<td>134
  681
+</td>
  682
+<td>x1 x2
  683
+</td>
  684
+<td>out
  685
+</td>
  686
+<td>Boolean <i>exclusive or</i> between each bit in the inputs. <i>Currently disabled.</i>
  687
+</td>
  688
+</tr>
  689
+<tr>
  690
+<td>OP_EQUAL
  691
+</td>
  692
+<td>135
  693
+</td>
  694
+<td>x1 x2
  695
+</td>
  696
+<td>True / false
  697
+</td>
  698
+<td>Returns 1 if the inputs are exactly equal, 0 otherwise.
  699
+</td>
  700
+</tr>
  701
+<tr>
  702
+<td>OP_EQUALVERIFY
  703
+</td>
  704
+<td>136
  705
+</td>
  706
+<td>x1 x2
  707
+</td>
  708
+<td>True / false
  709
+</td>
  710
+<td>Same as OP_EQUAL, but runs OP_VERIFY afterward.
  711
+</td>
  712
+</tr></tbody>
  713
+</table>
  714
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=7" title="Edit section: Arithmetic">edit</a>]  Arithmetic </h3>
  715
+Word
  716
+
  717
+Opcode
  718
+
  719
+Input
  720
+
  721
+Output
  722
+
  723
+Description
  724
+
  725
+<table class="wikitable">
  726
+
  727
+<tbody><tr>
  728
+</tr>
  729
+</tbody><tbody>
  730
+<tr>
  731
+<td>OP_1ADD
  732
+</td>
  733
+<td>139
  734
+</td>
  735
+<td>in
  736
+</td>
  737
+<td>out
  738
+</td>
  739
+<td>1 is added to the input.
  740
+</td>
  741
+</tr>
  742
+<tr>
  743
+<td>OP_1SUB
  744
+</td>
  745
+<td>140
  746
+</td>
  747
+<td>in
  748
+</td>
  749
+<td>out
  750
+</td>
  751
+<td>1 is subtracted from the input.
  752
+</td>
  753
+</tr>
  754
+<tr>
  755
+<td>OP_2MUL
  756
+</td>
  757
+<td>141
  758
+</td>
  759
+<td>in
  760
+</td>
  761
+<td>out
  762
+</td>
  763
+<td>The input is multiplied by 2. <i>Currently disabled.</i>
  764
+</td>
  765
+</tr>
  766
+<tr>
  767
+<td>OP_2DIV
  768
+</td>
  769
+<td>142
  770
+</td>
  771
+<td>in
  772
+</td>
  773
+<td>out
  774
+</td>
  775
+<td>The input is divided by 2. <i>Currently disabled.</i>
  776
+</td>
  777
+</tr>
  778
+<tr>
  779
+<td>OP_NEGATE
  780
+</td>
  781
+<td>143
  782
+</td>
  783
+<td>in
  784
+</td>
  785
+<td>out
  786
+</td>
  787
+<td>The sign of the input is flipped.
  788
+</td>
  789
+</tr>
  790
+<tr>
  791
+<td>OP_ABS
  792
+</td>
  793
+<td>144
  794
+</td>
  795
+<td>in
  796
+</td>
  797
+<td>out
  798
+</td>
  799
+<td>The input is made positive.
  800
+</td>
  801
+</tr>
  802
+<tr>
  803
+<td>OP_NOT
  804
+</td>
  805
+<td>145
  806
+</td>
  807
+<td>in
  808
+</td>
  809
+<td>out
  810
+</td>
  811
+<td>If the input is 0 or 1, it is flipped. Otherwise the output will be 0.
  812
+</td>
  813
+</tr>
  814
+<tr>
  815
+<td>OP_0NOTEQUAL
  816
+</td>
  817
+<td>146
  818
+</td>
  819
+<td>in
  820
+</td>
  821
+<td>out
  822
+</td>
  823
+<td>Returns 1 if the input is 0. 0 otherwise.
  824
+</td>
  825
+</tr>
  826
+<tr>
  827
+<td>OP_ADD
  828
+</td>
  829
+<td>147
  830
+</td>
  831
+<td>a b
  832
+</td>
  833
+<td>out
  834
+</td>
  835
+<td>a is added to b.
  836
+</td>
  837
+</tr>
  838
+<tr>
  839
+<td>OP_SUB
  840
+</td>
  841
+<td>148
  842
+</td>
  843
+<td>a b
  844
+</td>
  845
+<td>out
  846
+</td>
  847
+<td>b is subtracted from a.
  848
+</td>
  849
+</tr>
  850
+<tr>
  851
+<td>OP_MUL
  852
+</td>
  853
+<td>149
  854
+</td>
  855
+<td>a b
  856
+</td>
  857
+<td>out
  858
+</td>
  859
+<td>a is multiplied by b. <i>Currently disabled.</i>
  860
+</td>
  861
+</tr>
  862
+<tr>
  863
+<td>OP_DIV
  864
+</td>
  865
+<td>150
  866
+</td>
  867
+<td>a b
  868
+</td>
  869
+<td>out
  870
+</td>
  871
+<td>a is divided by b. <i>Currently disabled.</i>
  872
+</td>
  873
+</tr>
  874
+<tr>
  875
+<td>OP_MOD
  876
+</td>
  877
+<td>151
  878
+</td>
  879
+<td>a b
  880
+</td>
  881
+<td>out
  882
+</td>
  883
+<td>Returns the remainder after dividing a by b. <i>Currently disabled.</i>
  884
+</td>
  885
+</tr>
  886
+<tr>
  887
+<td>OP_LSHIFT
  888
+</td>
  889
+<td>152
  890
+</td>
  891
+<td>a b
  892
+</td>
  893
+<td>out
  894
+</td>
  895
+<td>Shifts a left b bits, preserving sign. <i>Currently disabled.</i>
  896
+</td>
  897
+</tr>
  898
+<tr>
  899
+<td>OP_RSHIFT
  900
+</td>
  901
+<td>153
  902
+</td>
  903
+<td>a b
  904
+</td>
  905
+<td>out
  906
+</td>
  907
+<td>Shifts a right b bits, preserving sign. <i>Currently disabled.</i>
  908
+</td>
  909
+</tr>
  910
+<tr>
  911
+<td>OP_BOOLAND
  912
+</td>
  913
+<td>154
  914
+</td>
  915
+<td>a b
  916
+</td>
  917
+<td>out
  918
+</td>
  919
+<td>If both a and b are not 0, the output is 1. Otherwise 0.
  920
+</td>
  921
+</tr>
  922
+<tr>
  923
+<td>OP_BOOLOR
  924
+</td>
  925
+<td>155
  926
+</td>
  927
+<td>a b
  928
+</td>
  929
+<td>out
  930
+</td>
  931
+<td>If a or b is not 0, the output is 1. Otherwise 0.
  932
+</td>
  933
+</tr>
  934
+<tr>
  935
+<td>OP_NUMEQUAL
  936
+</td>
  937
+<td>156
  938
+</td>
  939
+<td>a b
  940
+</td>
  941
+<td>out
  942
+</td>
  943
+<td>Returns 1 if the numbers are equal, 0 otherwise.
  944
+</td>
  945
+</tr>
  946
+<tr>
  947
+<td>OP_NUMEQUALVERIFY
  948
+</td>
  949
+<td>157
  950
+</td>
  951
+<td>a b
  952
+</td>
  953
+<td>out
  954
+</td>
  955
+<td>Same as OP_NUMEQUAL, but runs OP_VERIFY afterward.
  956
+</td>
  957
+</tr>
  958
+<tr>
  959
+<td>OP_NUMNOTEQUAL
  960
+</td>
  961
+<td>158
  962
+</td>
  963
+<td>a b
  964
+</td>
  965
+<td>out
  966
+</td>
  967
+<td>Returns 1 if the numbers are not equal, 0 otherwise.
  968
+</td>
  969
+</tr>
  970
+<tr>
  971
+<td>OP_LESSTHAN
  972
+</td>
  973
+<td>159
  974
+</td>
  975
+<td>a b
  976
+</td>
  977
+<td>out
  978
+</td>
  979
+<td>Returns 1 if a is less than b, 0 otherwise.
  980
+</td>
  981
+</tr>
  982
+<tr>
  983
+<td>OP_GREATERTHAN
  984
+</td>
  985
+<td>160
  986
+</td>
  987
+<td>a b
  988
+</td>
  989
+<td>out
  990
+</td>
  991
+<td>Returns 1 if a is greater than b, 0 otherwise.
  992
+</td>
  993
+</tr>
  994
+<tr>
  995
+<td>OP_LESSTHANOREQUAL
  996
+</td>
  997
+<td>161
  998
+</td>
  999
+<td>a b
  1000
+</td>
  1001
+<td>out
  1002
+</td>
  1003
+<td>Returns 1 if a is less than or equal to b, 0 otherwise.
  1004
+</td>
  1005
+</tr>
  1006
+<tr>
  1007
+<td>OP_GREATERTHANOREQUAL
  1008
+</td>
  1009
+<td>162
  1010
+</td>
  1011
+<td>a b
  1012
+</td>
  1013
+<td>out
  1014
+</td>
  1015
+<td>Returns 1 if a is greater than or equal to b, 0 otherwise.
  1016
+</td>
  1017
+</tr>
  1018
+<tr>
  1019
+<td>OP_MIN
  1020
+</td>
  1021
+<td>163
  1022
+</td>
  1023
+<td>a b
  1024
+</td>
  1025
+<td>out
  1026
+</td>
  1027
+<td>Returns the smaller of a and b.
  1028
+</td>
  1029
+</tr>
  1030
+<tr>
  1031
+<td>OP_MAX
  1032
+</td>
  1033
+<td>164
  1034
+</td>
  1035
+<td>a b
  1036
+</td>
  1037
+<td>out
  1038
+</td>
  1039
+<td>Returns the larger of a and b.
  1040
+</td>
  1041
+</tr>
  1042
+<tr>
  1043
+<td>OP_WITHIN
  1044
+</td>
  1045
+<td>165
  1046
+</td>
  1047
+<td>x min max
  1048
+</td>
  1049
+<td>out
  1050
+</td>
  1051
+<td>Returns 1 if x is within the specified range (left-inclusive), 0 otherwise.
  1052
+</td>
  1053
+</tr></tbody>
  1054
+</table>
  1055
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=8" title="Edit section: Crypto">edit</a>]  Crypto </h3>
  1056
+Word
  1057
+
  1058
+Opcode
  1059
+
  1060
+Input
  1061
+
  1062
+Output
  1063
+
  1064
+Description
  1065
+
  1066
+<table class="wikitable">
  1067
+
  1068
+<tbody><tr>
  1069
+</tr>
  1070
+</tbody><tbody>
  1071
+<tr>
  1072
+<td>OP_RIPEMD160
  1073
+</td>
  1074
+<td>166
  1075
+</td>
  1076
+<td>in
  1077
+</td>
  1078
+<td>hash
  1079
+</td>
  1080
+<td>The input is hashed using RIPEMD-160.
  1081
+</td>
  1082
+</tr>
  1083
+<tr>
  1084
+<td>OP_SHA1
  1085
+</td>
  1086
+<td>167
  1087
+</td>
  1088
+<td>in
  1089
+</td>
  1090
+<td>hash
  1091
+</td>
  1092
+<td>The input is hashed using SHA-1.
  1093
+</td>
  1094
+</tr>
  1095
+<tr>
  1096
+<td>OP_SHA256
  1097
+</td>
  1098
+<td>168
  1099
+</td>
  1100
+<td>in
  1101
+</td>
  1102
+<td>hash
  1103
+</td>
  1104
+<td>The input is hashed using SHA-256.
  1105
+</td>
  1106
+</tr>
  1107
+<tr>
  1108
+<td>OP_HASH160
  1109
+</td>
  1110
+<td>169
  1111
+</td>
  1112
+<td>in
  1113
+</td>
  1114
+<td>hash
  1115
+</td>
  1116
+<td>The input is hashed twice: first with SHA-256 and then with RIPEMD-160.
  1117
+</td>
  1118
+</tr>
  1119
+<tr>
  1120
+<td>OP_HASH256
  1121
+</td>
  1122
+<td>170
  1123
+</td>
  1124
+<td>in
  1125
+</td>
  1126
+<td>hash
  1127
+</td>
  1128
+<td>The input is hashed two times with SHA-256.
  1129
+</td>
  1130
+</tr>
  1131
+<tr>
  1132
+<td>OP_CODESEPARATOR
  1133
+</td>
  1134
+<td>171
  1135
+</td>
  1136
+<td>Nothing
  1137
+</td>
  1138
+<td>Nothing
  1139
+</td>
  1140
+<td>All of the signature checking words will only match signatures to the data after the most recently-executed OP_CODESEPARATOR.
  1141
+</td>
  1142
+</tr>
  1143
+<tr>
  1144
+<td><a href="https://en.bitcoin.it/wiki/OP_CHECKSIG" title="OP CHECKSIG">OP_CHECKSIG</a>
  1145
+</td>
  1146
+<td>172
  1147
+</td>
  1148
+<td>sig pubkey
  1149
+</td>
  1150
+<td>True / false
  1151
+</td>
  1152
+<td>The entire transaction's outputs, inputs, and <b style="color: black; background-color: rgb(160, 255, 255);">script</b>
  1153
+ (from the most recently-executed OP_CODESEPARATOR to the end) are 
  1154
+hashed. The signature used by OP_CHECKSIG must be a valid signature for 
  1155
+this hash and public key. If it is, 1 is returned, 0 otherwise.
  1156
+</td>
  1157
+</tr>
  1158
+<tr>
  1159
+<td>OP_CHECKSIGVERIFY
  1160
+</td>
  1161
+<td>173
  1162
+</td>
  1163
+<td>sig pubkey
  1164
+</td>
  1165
+<td>True / false
  1166
+</td>
  1167
+<td>Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.
  1168
+</td>
  1169
+</tr>
  1170
+<tr>
  1171
+<td>OP_CHECKMULTISIG
  1172
+</td>
  1173
+<td>174
  1174
+</td>
  1175
+<td>x sig1 sig2 ... &lt;number of signatures&gt; pub1 pub2 &lt;number of public keys&gt;
  1176
+</td>
  1177
+<td>True / False
  1178
+</td>
  1179
+<td>For each signature and public key pair, OP_CHECKSIG is executed. If 
  1180
+more public keys than signatures are listed, some key/sig pairs can 
  1181
+fail. All signatures need to match a public key. If all signatures are 
  1182
+valid, 1 is returned, 0 otherwise. Due to a bug, one extra unused value 
  1183
+is removed from the stack.
  1184
+</td>
  1185
+</tr>
  1186
+<tr>
  1187
+<td>OP_CHECKMULTISIGVERIFY
  1188
+</td>
  1189
+<td>175
  1190
+</td>
  1191
+<td>x sig1 sig2 ... &lt;number of signatures&gt; pub1 pub2 ... &lt;number of public keys&gt;
  1192
+</td>
  1193
+<td>True / False
  1194
+</td>
  1195
+<td>Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward.
  1196
+</td>
  1197
+</tr></tbody>
  1198
+</table>
  1199
+<h3>[<a href="https://en.bitcoin.it/w/index.php?title=Script&amp;action=edit&amp;section=9" title="Edit section: Pseudo-words">edit</a>] Pseudo-words</h3>
  1200
+<p>These words are used internally for assisting with transaction matching. They are invalid if used in actual scripts.
  1201
+</p>
  1202
+Word
  1203
+
  1204
+Opcode
  1205
+
  1206
+Description
  1207
+
  1208
+<table class="wikitable">
  1209
+
  1210
+<tbody><tr>
  1211
+</tr>
  1212
+</tbody><tbody>
  1213
+<tr>
  1214
+<td>OP_PUBKEYHASH
  1215
+</td>
  1216
+<td>253
  1217
+</td>
  1218
+<td>Represents a public key hashed with OP_HASH160.
  1219
+</td>
  1220
+</tr>
  1221
+<tr>
  1222
+<td>OP_PUBKEY
  1223
+</td>
  1224
+<td>254
  1225
+</td>
  1226
+<td>Represents a public key compatible with OP_CHECKSIG.
  1227
+</td>
  1228
+</tr>
  1229
+<tr>
  1230
+<td>OP_INVALIDOPCODE
  1231
+</td>
  1232
+<td>255
  1233
+</td>
  1234
+<td>Matches any opcode that is not yet assigned.
  1235
+</td>
  1236
+</tr></tbody>
  1237
+</table>