<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rusty</id>
	<title>Bitcoin Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://en.bitcoin.it/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Rusty"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Rusty"/>
	<updated>2026-05-01T14:45:04Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=66642</id>
		<title>Payment channels</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Payment_channels&amp;diff=66642"/>
		<updated>2019-07-18T04:54:20Z</updated>

		<summary type="html">&lt;p&gt;Rusty: Broken reference URL, fixed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;Micropayment Channel&#039;&#039;&#039; or &#039;&#039;&#039;Payment Channel&#039;&#039;&#039; is class of techniques designed to allow users to make multiple Bitcoin transactions without commiting all of the transactions to the Bitcoin block chain.&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;/&amp;gt;  In a typical payment channel, only two transactions are added to the block chain but an unlimited or nearly unlimted number of payments can be made between the participants.&lt;br /&gt;
&lt;br /&gt;
Several channel designs have been proposed or implemented over the years.  This article describes some of them.  Many designs are vulnerable to [[Transaction Malleability|transaction malleability]].  Specifically, many designs require a way to be able to spend an unsigned transaction, in order to ensure that the channel can be opened atomically.  Thus, these designs require a malleability fix that separates the signatures from the part of the transaction that is hashed to form the txid.&lt;br /&gt;
&lt;br /&gt;
=== Nakamoto high-frequency transactions ===&lt;br /&gt;
&lt;br /&gt;
Implemented in Bitcoin 0.1 were features such as [[Transaction Replacement|transaction replacement]]&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot; /&amp;gt;, input sequence numbers (nSequence), and [[nLockTime]] that would allow two or more parties to repeatedly update the state of an unconfirmed transaction prior to it becoming confirmed.&lt;br /&gt;
&lt;br /&gt;
Satoshi Nakamoto described the technique to a Bitcoin developer in a personal email:&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
An unrecorded open transaction can keep being replaced until nLockTime.  It may contain payments by multiple parties.  Each input owner signs their input.  For a new version to be written, each must sign a higher sequence number (see IsNewerThan).  By signing, an input owner says &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this.&amp;quot; There are other options in SignatureHash such as SIGHASH_SINGLE which means &amp;quot;I agree, as long as this one output (i.e. mine) is what I want, I don&#039;t care what you do with the other outputs.&amp;quot;.  If that&#039;s written with a high nSequenceNumber, the party can bow out of the negotiation except for that one stipulation, or sign SIGHASH_NONE and bow out completely.  &lt;br /&gt;
&lt;br /&gt;
The parties could create a pre-agreed default option by creating a higher nSequenceNumber tx using OP_CHECKMULTISIG that requires a subset of parties to sign to complete the signature.  The parties hold this tx in reserve and if need be, pass it around until it has enough signatures.&lt;br /&gt;
&lt;br /&gt;
One use of nLockTime is high frequency trades between a set of parties.  They can keep updating a tx by unanimous agreement.  The party giving money would be the first to sign the next version.  If one party stops agreeing to changes, then the last state will be recorded at nLockTime.  If desired, a default transaction can be prepared after each version so n-1 parties can push an unresponsive party out.  Intermediate transactions do not need to be broadcast.  Only the final outcome gets recorded by the network.  Just before nLockTime, the parties and a few witness nodes broadcast the highest sequence tx they saw.&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This design was not secure:{{citation needed}} one party could collude with a miner to commit a non-final version of the transaction, possibly stealing funds from the other party or parties.&lt;br /&gt;
&lt;br /&gt;
=== Spillman-style payment channels===&lt;br /&gt;
&lt;br /&gt;
Discussed on the bitcoin-development mailing list&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;/&amp;gt; and implemented in BitcoinJ,&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;/&amp;gt; this one transaction to create a secured deposit and a second transaction to release the deposit funds in the manner agreed to by both parties, preventing miners from being able to commit a non-final version of the transaction.  However, opening a channel in the Spillman model exposed the depositor to malleability risk where the counter party would be able to hold the depositor&#039;s funds hostage.&amp;lt;ref name=&amp;quot;bip65&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A full description of the protocol is in [[Contract#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|example 7 of the Contract page]].&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels are unidirectional (there is a payer and a payee, and it is not possible to transfer money back in the reverse direction).&lt;br /&gt;
&lt;br /&gt;
Spillman payment channels expire after a specific time, and the receiver needs to close the channel before the expiration.&lt;br /&gt;
&lt;br /&gt;
=== CLTV-style payment channels ===&lt;br /&gt;
&lt;br /&gt;
Were made possible in Decemember 2015 by the activation of the CLTV soft fork{{citation needed}} after discussion that began in the #bitcoin-wizards IRC channel{{citation needed}}, moved to the bitcoin-development and bitcoin-dev mailing lists&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;/&amp;gt;, and included a design specification in [https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65].  Channels constructed using the new OP_CLTV opcode were resistant to the malleability problem inherent in the Spillman-style construction.&amp;lt;ref name=&amp;quot;bip65&amp;quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Like Spillman payment channels, CLTV-style payment channels are unidirectional and expire after a specific time.&lt;br /&gt;
&lt;br /&gt;
=== Poon-Dryja payment channels ===&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels were presented in the paper&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;&amp;gt;[https://lightning.network/lightning-network-paper.pdf Lightning Network paper, v0.5.9.1]&amp;lt;br&amp;gt;Joseph Poon &amp;amp; Thaddeus Dryja&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-10&#039;&#039;&amp;lt;/ref&amp;gt; that also introduced the [[Lightning Network]].  Channel backing funds are locked into a 2-of-2 multisig, but before the funding transaction is even signed, commitment transactions for each party are first written and signed.  As it requires referring to transactions that have not been signed yet, it requires using a transaction format that separates signatures from the part of the transaction that is hashed to generate the txid, such as [[Segregated Witness]].&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja channels may be closed unilaterally (requires the participation of only one party) or bilaterally (requires the participation of both parties).  When closed bilaterally Poon-Dryja channels are indistinguishable on-chain from 2-of-2 multisig address spends.  When closed unilaterally, the funds of the party that closed the channel is temporarily timelocked; this allows the other party to dispute the state transmitted by the closing party (who might have given old state on closing).&lt;br /&gt;
&lt;br /&gt;
Poon-Dryja payment channels have indefinite lifetime.  They are also bidirectional, unlike Spilman and CLTV payment channels.&lt;br /&gt;
&lt;br /&gt;
The [https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md Lightning BOLT] specifications include recommended implementation of Poon-Dryja payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Wattenhofer duplex payment channels ===&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels were presented in a paper&amp;lt;ref name=&#039;duplex_pdf&#039;&amp;gt;[https://tik-old.ee.ethz.ch/file/716b955c130e6c703fac336ea17b1670/duplex-micropayment-channels.pdf A Fast and Scalable Payment Network with Bitcoin Duplex Micropayment Channels] Decker, C.; Wattenhofer, R.&amp;lt;/ref&amp;gt; by Christian Decker and Roger Wattenhofer.  This type of payment channel requires the new BIP68&amp;lt;ref name=&#039;bip68&#039;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68]&amp;lt;/ref&amp;gt; meaning of nSequence.  As the name implies, a duplex payment channel is composed of two unidirectional payment channels, one in both directions.  The unidirectional payment channels are essentially Spillman channels, but using relative lock time (nSequence) instead of nLockTime.&lt;br /&gt;
&lt;br /&gt;
However, instead of funding unidirectional payment channels directly from an on-chain funding transaction, there is an &amp;quot;invalidation tree&amp;quot; of off-chain transactions between the funding transaction and the payment channel finalization transactions.  The invalidation tree transactions also use relative lock time; the first version of the transaction has a large relative lock time, and the next version of the transaction (which &#039;&#039;invalidates&#039;&#039; the first) uses a slightly smaller relative lock time, and so on.  There is also a &amp;quot;kick-off&amp;quot; transaction that starts the timeout for the relative locktime.  The sequence of transactions is thus: funding -&amp;gt; kickoff -&amp;gt; invalidation tree -&amp;gt; payment channel.&lt;br /&gt;
&lt;br /&gt;
Initially, the invalidation transaction may have a relative lock time of 100 days, and then its outputs go to two unidirectional payment channels, one in either direction.  Both parties may then use the payment channels until one channel is exhausted.  The parties may then reset the payment channels, creating a new invalidation transaction with a relative lock time of 99 days that redistributes the money correctly, but with the unidirectional payment channels reset.&lt;br /&gt;
&lt;br /&gt;
The payment channel may be closed at any time by either party (without the help of the other) by broadcasting the kickoff transaction on the blockchain.  In case of such a unilateral close, both parties must wait out the relative lock times until they can broadcast the payment channel finalization transactions.&lt;br /&gt;
&lt;br /&gt;
Parties should prefer the bilateral (cooperative) close, which collapses the kickoff, invalidation tree, and payment channel transactions into a single simple transaction that pays out the funds to both parties.&lt;br /&gt;
&lt;br /&gt;
Duplex payment channels have indefinite lifetime, but there is a limit on number of updates possible due to the invalidation tree.  This limit can be multiplied by adding additional layers to the invalidation tree, with resetting of the lower layers.  Finally, in case of a unilateral close duplex payment channels require significant wait times and significant number of transactions to be published on the blockchain.&lt;br /&gt;
&lt;br /&gt;
The invalidation tree structure may actually have more than two participants; it would be possible for groups of 3 or more parties to build multiple payment channels between them that are backed by this invalidation tree structure, and to rebalance their payment channels without hitting the blockchain.&amp;lt;ref name=&#039;scaling_funding_pdf&#039;&amp;gt;[https://www.tik.ee.ethz.ch/file/a20a865ce40d40c8f942cf206a7cba96/Scalable_Funding_Of_Blockchain_Micropayment_Networks%20(1).pdf Scalable Funding of Bitcoin Micropayment Channel Networks]&amp;lt;/ref&amp;gt;  It would also be possible for the invalidation tree structure to fund Poon-Dryja rather than pairs of unidirectional payment channels.&lt;br /&gt;
&lt;br /&gt;
=== Decker-Russell-Osuntokun eltoo Channels ===&lt;br /&gt;
&lt;br /&gt;
Eltoo channels were presented in a paper&amp;lt;ref name=&#039;eltoo_pdf&#039;&amp;gt;[https://blockstream.com/eltoo.pdf eltoo: A Simple Layer2 Protocol for Bitcoin] Decker, C.; Russell, R., Osuntokun, O. &#039;&#039;&#039;Retrieved 2018-05-02&#039;&#039;&#039;&amp;lt;/ref&amp;gt; by Christian Decker, Rusty Russell, and Olauluwa Osuntokun in April 30, 2018. This type of channel requires a new &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;&amp;lt;ref name=&#039;bip_sighash_noinput&#039;&amp;gt;[https://github.com/cdecker/bips/blob/noinput/bip-xyz.mediawiki &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;]&amp;lt;/ref&amp;gt; signing flag.&lt;br /&gt;
&lt;br /&gt;
Roughly, each update of the channel requires creating two transactions: an update transaction and a CSV-encumbered settlement transaction that spends the update transaction. Via &amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt; and an unusual use of &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt;, any later update transaction can spend any earlier update transaction during the time that the settlement transaction is encumbered; only the latest update transaction cannot be spent by another update transaction (since it has no later update) and can only be spent by its corresponding settlement transaction after the CSV delay has passed.  Thus even if an attacker or disrupter publishes an old update transaction, it cannot get the old state published since the latest transaction can still be published while the CSV-delay on the old settlement transaction hasn&#039;t completed yet.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; is not used to enforce a particular future time, but rather to enforce an ordering on the update transactions, such that a later update transaction can spend an earlier update transaction, but not vice versa.  This is because &amp;lt;code&amp;gt;OP_CHECKLOCKTIMEVERIFY&amp;lt;/code&amp;gt; ensures that the spending transaction has a &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; equal to, &#039;&#039;&#039;or greater than&#039;&#039;&#039;, the value specified in the spent output SCRIPT.  Each update transaction&#039;s output SCRIPT has an &amp;quot;update&amp;quot; branch that allows any update transaction to spend it, as long as that update transaction has a higher &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; than it currently has.  We use past &amp;lt;code&amp;gt;nLockTime&amp;lt;/code&amp;gt; Unix timestamps, which start at 500,000,000 and reach up to about ~1,500,000,000 (somewhat less than the Unix timestamp as of time of writing), giving a limit of about 1,000,000,000 (1 billion) updates.  If an old update transaction is spent, it will allow any later update transaction to spend it, thus preventing publication of old settlement transactions.&lt;br /&gt;
&lt;br /&gt;
This has the advantage of not requiring a punishment branch (unlike Poon-Dryja), simplifying watchtower design and reducing the punishment of accidentally using old state (which would lead to total loss of funds under Poon-Dryja, but will only lead to wasting of fees in Decker-Russell-Osuntokun).  However, it requires a new feature in the base blockchain (&amp;lt;code&amp;gt;SIGHASH_NOINPUT&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
=== Hashed Time-Locked Contracts (HTLCs) ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;Full article: [[Hashed Timelock Contracts]]&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
A technique that can allow payments to be securely routed across multiple payment channels.{{citation needed}} For example, if Alice has a channel open to Bob and Bob has a channel open to Charlie, Alice can use a HTLC to pay Charlie through Bob without any risk of Bob stealing the payment in transit.  HTLCs are integral to the design of more advanced payment channels such as those used by the [[Lightning Network]].&lt;br /&gt;
&lt;br /&gt;
=== References ===&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoinorg_dev_guide&amp;quot;&amp;gt;[https://bitcoin.org/en/developer-guide#micropayment-channel Micropayment channel], Bitcoin.org Developer Guide&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;replacement_in_original_code&amp;quot;&amp;gt;[https://github.com/trottier/original-bitcoin/blob/master/src/main.cpp#L434 Replacement in original Bitcoin code]&amp;lt;br&amp;gt;Satoshi Nakamoto, GitHub&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;hearn_hft_quote&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002417.html Anti DoS for tx replacement], Mike Hearn, bitcoin-development mailing list, 17 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;spillman_channel_description&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Re: Anti DoS for tx replacement], Jeremy Spillman, bitcoin-development mailing list, 20 April 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;channels_bitcoinj&amp;quot;&amp;gt;[https://bitcointalk.org/index.php?topic=244656.0 Micro-payment channels implementation now in bitcoinj], Mike Hearn &amp;amp; Matt Corallo, BitcoinTalk.org, 27 June 2013&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip65&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki BIP65], Peter Todd, BIPs repository, retrieved 28 October 2016&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_dev_bip65&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-September/011197.html [bitcoin-dev] Let&#039;s deploy BIP65 CHECKLOCKTIMEVERIFY!], Peter Todd, bitcoin-dev mailing list, 27 September 2015&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Rusty</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Script&amp;diff=64539</id>
		<title>Script</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Script&amp;diff=64539"/>
		<updated>2017-12-06T06:26:08Z</updated>

		<summary type="html">&lt;p&gt;Rusty: OP_VERIFY removes top stack element.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Bitcoin uses a scripting system for [[transactions]]. [[Wikipedia:FORTH|Forth]]-like, &#039;&#039;&#039;Script&#039;&#039;&#039; is simple, stack-based, and processed from left to right. It is purposefully not Turing-complete, with no loops.&lt;br /&gt;
&lt;br /&gt;
A script is essentially a list of instructions recorded with each transaction that describe how the next person wanting to spend the Bitcoins being transferred can gain access to them.  The script for a typical Bitcoin transfer to destination Bitcoin address D simply encumbers future spending of the bitcoins with two things: the spender must provide&lt;br /&gt;
# a public key that, when hashed, yields destination address D embedded in the script, and&lt;br /&gt;
# a signature to show evidence of the private key corresponding to the public key just provided.&lt;br /&gt;
&lt;br /&gt;
Scripting provides the flexibility to change the parameters of what&#039;s needed to spend transferred Bitcoins.  For example, the scripting system could be used to require two private keys, or a combination of several, or even no keys at all.&lt;br /&gt;
&lt;br /&gt;
A transaction is valid if nothing in the combined script triggers failure and the top stack item is true (non-zero).  The party who originally &#039;&#039;sent&#039;&#039; the Bitcoins now being spent, dictates the script operations that will occur &#039;&#039;last&#039;&#039; in order to release them for use in another transaction.  The party wanting to spend them must provide the input(s) to the previously recorded script that results in those operations occurring last leaving behind true (non-zero).&lt;br /&gt;
&lt;br /&gt;
This document is for information purposes only. Officially Bitcoin script is defined by [https://github.com/bitcoin/bitcoin/blob/master/src/script/interpreter.cpp its reference implementation].&lt;br /&gt;
&lt;br /&gt;
The stacks hold byte vectors.&lt;br /&gt;
When used as numbers, byte vectors are interpreted as little-endian variable-length integers with the most significant bit determining the sign of the integer.&lt;br /&gt;
Thus 0x81 represents -1.&lt;br /&gt;
0x80 is another representation of zero (so called negative 0).&lt;br /&gt;
Positive 0 is represented by a null-length vector.&lt;br /&gt;
Byte vectors are interpreted as Booleans where False is represented by any representation of zero, and True is represented by any representation of non-zero.&lt;br /&gt;
&lt;br /&gt;
== Opcodes ==&lt;br /&gt;
This is a list of all Script words, also known as opcodes, commands, or functions.&lt;br /&gt;
&lt;br /&gt;
There are some words which existed in very early versions of Bitcoin but were removed out of a concern that the client might have a bug in their implementation. This fear was motivated by a bug found in OP_LSHIFT which could crash any Bitcoin node if exploited, and by other bugs in how Script worked which allowed anyone to spend anyone&#039;s bitcoins. The removed opcodes are sometimes said to be &amp;quot;disabled&amp;quot; opcodes, but this is something of a misnomer because there is &#039;&#039;absolutely no way&#039;&#039; for anyone using Bitcoin to use these opcodes (they simply &#039;&#039;do not exist anymore&#039;&#039; in the protocol), and there are also no solid plans to ever re-enable all of these opcodes. They are listed here only for historical interest.&lt;br /&gt;
&lt;br /&gt;
New opcodes can be added by means of a carefully designed and executed [[softfork]] using OP_NOP1-OP_NOP10.&lt;br /&gt;
&lt;br /&gt;
False is zero or negative zero (using any number of bytes) or an empty array, and True is anything else.&lt;br /&gt;
&lt;br /&gt;
=== Constants ===&lt;br /&gt;
When talking about scripts, these value-pushing words are usually omitted.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_0, OP_FALSE&lt;br /&gt;
|0&lt;br /&gt;
|0x00&lt;br /&gt;
|Nothing.&lt;br /&gt;
|(empty value)&lt;br /&gt;
|An empty array of bytes is pushed onto the stack. (This is not a no-op: an item is added to the stack.)&lt;br /&gt;
|-&lt;br /&gt;
|N/A&lt;br /&gt;
|1-75&lt;br /&gt;
|0x01-0x4b&lt;br /&gt;
|(special)&lt;br /&gt;
|data&lt;br /&gt;
|The next &#039;&#039;opcode&#039;&#039; bytes is data to be pushed onto the stack&lt;br /&gt;
|-&lt;br /&gt;
|OP_PUSHDATA1&lt;br /&gt;
|76&lt;br /&gt;
|0x4c&lt;br /&gt;
|(special)&lt;br /&gt;
|data&lt;br /&gt;
|The next byte contains the number of bytes to be pushed onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_PUSHDATA2&lt;br /&gt;
|77&lt;br /&gt;
|0x4d&lt;br /&gt;
|(special)&lt;br /&gt;
|data&lt;br /&gt;
|The next two bytes contain the number of bytes to be pushed onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_PUSHDATA4&lt;br /&gt;
|78&lt;br /&gt;
|0x4e&lt;br /&gt;
|(special)&lt;br /&gt;
|data&lt;br /&gt;
|The next four bytes contain the number of bytes to be pushed onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_1NEGATE&lt;br /&gt;
|79&lt;br /&gt;
|0x4f&lt;br /&gt;
|Nothing.&lt;br /&gt;
| -1&lt;br /&gt;
|The number -1 is pushed onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_1, OP_TRUE&lt;br /&gt;
|81&lt;br /&gt;
|0x51&lt;br /&gt;
|Nothing.&lt;br /&gt;
|1&lt;br /&gt;
|The number 1 is pushed onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2-OP_16&lt;br /&gt;
|82-96&lt;br /&gt;
|0x52-0x60&lt;br /&gt;
|Nothing.&lt;br /&gt;
|2-16&lt;br /&gt;
|The number in the word name (2-16) is pushed onto the stack.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Flow control ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_NOP&lt;br /&gt;
|97&lt;br /&gt;
|0x61&lt;br /&gt;
|Nothing&lt;br /&gt;
|Nothing&lt;br /&gt;
|Does nothing.&lt;br /&gt;
|-&lt;br /&gt;
|OP_IF&lt;br /&gt;
|99&lt;br /&gt;
|0x63&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|&amp;lt;expression&amp;gt; if [statements] [else [statements]]* endif&lt;br /&gt;
|If the top stack value is not False, the statements are executed. The top stack value is removed.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NOTIF&lt;br /&gt;
|100&lt;br /&gt;
|0x64&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|&amp;lt;expression&amp;gt; notif [statements] [else [statements]]* endif&lt;br /&gt;
|If the top stack value is False, the statements are executed. The top stack value is removed.&lt;br /&gt;
|-&lt;br /&gt;
|OP_ELSE&lt;br /&gt;
|103&lt;br /&gt;
|0x67&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|&amp;lt;expression&amp;gt; if [statements] [else [statements]]* endif&lt;br /&gt;
|If the preceding OP_IF or OP_NOTIF or OP_ELSE was not executed then these statements are and if the preceding OP_IF or OP_NOTIF or OP_ELSE was executed then these statements are not. &lt;br /&gt;
|-&lt;br /&gt;
|OP_ENDIF&lt;br /&gt;
|104&lt;br /&gt;
|0x68&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot;|&amp;lt;expression&amp;gt; if [statements] [else [statements]]* endif&lt;br /&gt;
|Ends an if/else block. All blocks must end, or the transaction is &#039;&#039;&#039;invalid&#039;&#039;&#039;. An OP_ENDIF without OP_IF earlier is also &#039;&#039;&#039;invalid&#039;&#039;&#039;.&lt;br /&gt;
|-&lt;br /&gt;
|OP_VERIFY&lt;br /&gt;
|105&lt;br /&gt;
|0x69&lt;br /&gt;
|True / false&lt;br /&gt;
|Nothing / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Marks transaction as invalid&#039;&#039;&#039; if top stack value is not true.  The top stack value is removed.&lt;br /&gt;
|-&lt;br /&gt;
|[[OP_RETURN]]&lt;br /&gt;
|106&lt;br /&gt;
|0x6a&lt;br /&gt;
|Nothing&lt;br /&gt;
|&#039;&#039;fail&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Marks transaction as invalid&#039;&#039;&#039;. A standard way of attaching extra data to transactions is to add a zero-value output with a scriptPubKey consisting of OP_RETURN followed by exactly one pushdata op. Such outputs are provably unspendable, reducing their cost to the network. Currently it is usually considered non-standard (though valid) for a transaction to have more than one OP_RETURN output or an OP_RETURN output with more than one pushdata op.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Stack ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_TOALTSTACK&lt;br /&gt;
|107&lt;br /&gt;
|0x6b&lt;br /&gt;
|x1&lt;br /&gt;
|(alt)x1&lt;br /&gt;
|Puts the input onto the top of the alt stack. Removes it from the main stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_FROMALTSTACK&lt;br /&gt;
|108&lt;br /&gt;
|0x6c&lt;br /&gt;
|(alt)x1&lt;br /&gt;
|x1&lt;br /&gt;
|Puts the input onto the top of the main stack. Removes it from the alt stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_IFDUP&lt;br /&gt;
|115&lt;br /&gt;
|0x73&lt;br /&gt;
|x&lt;br /&gt;
|x / x x&lt;br /&gt;
|If the top stack value is not 0, duplicate it.&lt;br /&gt;
|-&lt;br /&gt;
|OP_DEPTH&lt;br /&gt;
|116&lt;br /&gt;
|0x74&lt;br /&gt;
|Nothing&lt;br /&gt;
|&amp;lt;Stack size&amp;gt;&lt;br /&gt;
|Puts the number of stack items onto the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_DROP&lt;br /&gt;
|117&lt;br /&gt;
|0x75&lt;br /&gt;
|x&lt;br /&gt;
|Nothing&lt;br /&gt;
|Removes the top stack item.&lt;br /&gt;
|-&lt;br /&gt;
|OP_DUP&lt;br /&gt;
|118&lt;br /&gt;
|0x76&lt;br /&gt;
|x&lt;br /&gt;
|x x&lt;br /&gt;
|Duplicates the top stack item.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NIP&lt;br /&gt;
|119&lt;br /&gt;
|0x77&lt;br /&gt;
|x1 x2&lt;br /&gt;
|x2&lt;br /&gt;
|Removes the second-to-top stack item.&lt;br /&gt;
|-&lt;br /&gt;
|OP_OVER&lt;br /&gt;
|120&lt;br /&gt;
|0x78&lt;br /&gt;
|x1 x2&lt;br /&gt;
|x1 x2 x1&lt;br /&gt;
|Copies the second-to-top stack item to the top.&lt;br /&gt;
|-&lt;br /&gt;
|OP_PICK&lt;br /&gt;
|121&lt;br /&gt;
|0x79&lt;br /&gt;
|xn ... x2 x1 x0 &amp;lt;n&amp;gt;&lt;br /&gt;
|xn ... x2 x1 x0 xn&lt;br /&gt;
|The item &#039;&#039;n&#039;&#039; back in the stack is copied to the top.&lt;br /&gt;
|-&lt;br /&gt;
|OP_ROLL&lt;br /&gt;
|122&lt;br /&gt;
|0x7a&lt;br /&gt;
|xn ... x2 x1 x0 &amp;lt;n&amp;gt;&lt;br /&gt;
|... x2 x1 x0 xn&lt;br /&gt;
|The item &#039;&#039;n&#039;&#039; back in the stack is moved to the top.&lt;br /&gt;
|-&lt;br /&gt;
|OP_ROT&lt;br /&gt;
|123&lt;br /&gt;
|0x7b&lt;br /&gt;
|x1 x2 x3&lt;br /&gt;
|x2 x3 x1&lt;br /&gt;
|The top three items on the stack are rotated to the left.&lt;br /&gt;
|-&lt;br /&gt;
|OP_SWAP&lt;br /&gt;
|124&lt;br /&gt;
|0x7c&lt;br /&gt;
|x1 x2&lt;br /&gt;
|x2 x1&lt;br /&gt;
|The top two items on the stack are swapped.&lt;br /&gt;
|-&lt;br /&gt;
|OP_TUCK&lt;br /&gt;
|125&lt;br /&gt;
|0x7d&lt;br /&gt;
|x1 x2&lt;br /&gt;
|x2 x1 x2&lt;br /&gt;
|The item at the top of the stack is copied and inserted before the second-to-top item.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2DROP&lt;br /&gt;
|109&lt;br /&gt;
|0x6d&lt;br /&gt;
|x1 x2&lt;br /&gt;
|Nothing&lt;br /&gt;
|Removes the top two stack items.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2DUP&lt;br /&gt;
|110&lt;br /&gt;
|0x6e&lt;br /&gt;
|x1 x2&lt;br /&gt;
|x1 x2 x1 x2&lt;br /&gt;
|Duplicates the top two stack items.&lt;br /&gt;
|-&lt;br /&gt;
|OP_3DUP&lt;br /&gt;
|111&lt;br /&gt;
|0x6f&lt;br /&gt;
|x1 x2 x3&lt;br /&gt;
|x1 x2 x3 x1 x2 x3&lt;br /&gt;
|Duplicates the top three stack items.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2OVER&lt;br /&gt;
|112&lt;br /&gt;
|0x70&lt;br /&gt;
|x1 x2 x3 x4&lt;br /&gt;
|x1 x2 x3 x4 x1 x2&lt;br /&gt;
|Copies the pair of items two spaces back in the stack to the front.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2ROT&lt;br /&gt;
|113&lt;br /&gt;
|0x71&lt;br /&gt;
|x1 x2 x3 x4 x5 x6&lt;br /&gt;
|x3 x4 x5 x6 x1 x2&lt;br /&gt;
|The fifth and sixth items back are moved to the top of the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2SWAP&lt;br /&gt;
|114&lt;br /&gt;
|0x72&lt;br /&gt;
|x1 x2 x3 x4&lt;br /&gt;
|x3 x4 x1 x2&lt;br /&gt;
|Swaps the top two pairs of items.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Splice ===&lt;br /&gt;
&lt;br /&gt;
If any opcode marked as disabled is present in a script, it must abort and fail.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_CAT&lt;br /&gt;
|126&lt;br /&gt;
|0x7e&lt;br /&gt;
|x1 x2&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Concatenates two strings. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_SUBSTR&lt;br /&gt;
|127&lt;br /&gt;
|0x7f&lt;br /&gt;
|in begin size&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Returns a section of a string. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_LEFT&lt;br /&gt;
|128&lt;br /&gt;
|0x80&lt;br /&gt;
|in size&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Keeps only characters left of the specified point in a string. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_RIGHT&lt;br /&gt;
|129&lt;br /&gt;
|0x81&lt;br /&gt;
|in size&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Keeps only characters right of the specified point in a string. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_SIZE&lt;br /&gt;
|130&lt;br /&gt;
|0x82&lt;br /&gt;
|in&lt;br /&gt;
|in size&lt;br /&gt;
|Pushes the string length of the top element of the stack (without popping it).&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Bitwise logic ===&lt;br /&gt;
&lt;br /&gt;
If any opcode marked as disabled is present in a script, it must abort and fail.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_INVERT&lt;br /&gt;
|131&lt;br /&gt;
|0x83&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Flips all of the bits in the input. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_AND&lt;br /&gt;
|132&lt;br /&gt;
|0x84&lt;br /&gt;
|x1 x2&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Boolean &#039;&#039;and&#039;&#039; between each bit in the inputs. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_OR&lt;br /&gt;
|133&lt;br /&gt;
|0x85&lt;br /&gt;
|x1 x2&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Boolean &#039;&#039;or&#039;&#039; between each bit in the inputs. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_XOR&lt;br /&gt;
|134&lt;br /&gt;
|0x86&lt;br /&gt;
|x1 x2&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Boolean &#039;&#039;exclusive or&#039;&#039; between each bit in the inputs. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_EQUAL&lt;br /&gt;
|135&lt;br /&gt;
|0x87&lt;br /&gt;
|x1 x2&lt;br /&gt;
|True / false&lt;br /&gt;
|Returns 1 if the inputs are exactly equal, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_EQUALVERIFY&lt;br /&gt;
|136&lt;br /&gt;
|0x88&lt;br /&gt;
|x1 x2&lt;br /&gt;
|Nothing / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|Same as OP_EQUAL, but runs OP_VERIFY afterward.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Arithmetic ===&lt;br /&gt;
&lt;br /&gt;
Note: Arithmetic inputs are limited to signed 32-bit integers, but may overflow their output.&lt;br /&gt;
&lt;br /&gt;
If any input value for any of these commands is longer than 4 bytes, the script must abort and fail. &lt;br /&gt;
If any opcode marked as &#039;&#039;disabled&#039;&#039; is present in a script - it must also abort and fail.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_1ADD&lt;br /&gt;
|139&lt;br /&gt;
|0x8b&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|1 is added to the input.&lt;br /&gt;
|-&lt;br /&gt;
|OP_1SUB&lt;br /&gt;
|140&lt;br /&gt;
|0x8c&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|1 is subtracted from the input.&lt;br /&gt;
|-&lt;br /&gt;
|OP_2MUL&lt;br /&gt;
|141&lt;br /&gt;
|0x8d&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|The input is multiplied by 2. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_2DIV&lt;br /&gt;
|142&lt;br /&gt;
|0x8e&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|The input is divided by 2. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_NEGATE&lt;br /&gt;
|143&lt;br /&gt;
|0x8f&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|The sign of the input is flipped.&lt;br /&gt;
|-&lt;br /&gt;
|OP_ABS&lt;br /&gt;
|144&lt;br /&gt;
|0x90&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|The input is made positive.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NOT&lt;br /&gt;
|145&lt;br /&gt;
|0x91&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|If the input is 0 or 1, it is flipped. Otherwise the output will be 0.&lt;br /&gt;
|-&lt;br /&gt;
|OP_0NOTEQUAL&lt;br /&gt;
|146&lt;br /&gt;
|0x92&lt;br /&gt;
|in&lt;br /&gt;
|out&lt;br /&gt;
|Returns 0 if the input is 0. 1 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_ADD&lt;br /&gt;
|147&lt;br /&gt;
|0x93&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|a is added to b.&lt;br /&gt;
|-&lt;br /&gt;
|OP_SUB&lt;br /&gt;
|148&lt;br /&gt;
|0x94&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|b is subtracted from a.&lt;br /&gt;
|-&lt;br /&gt;
|OP_MUL&lt;br /&gt;
|149&lt;br /&gt;
|0x95&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|a is multiplied by b. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_DIV&lt;br /&gt;
|150&lt;br /&gt;
|0x96&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|a is divided by b. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_MOD&lt;br /&gt;
|151&lt;br /&gt;
|0x97&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Returns the remainder after dividing a by b. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_LSHIFT&lt;br /&gt;
|152&lt;br /&gt;
|0x98&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Shifts a left b bits, preserving sign. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_RSHIFT&lt;br /&gt;
|153&lt;br /&gt;
|0x99&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|style=&amp;quot;background:#D97171;&amp;quot;|Shifts a right b bits, preserving sign. &#039;&#039;disabled.&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_BOOLAND&lt;br /&gt;
|154&lt;br /&gt;
|0x9a&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|If both a and b are not 0, the output is 1. Otherwise 0.&lt;br /&gt;
|-&lt;br /&gt;
|OP_BOOLOR&lt;br /&gt;
|155&lt;br /&gt;
|0x9b&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|If a or b is not 0, the output is 1. Otherwise 0.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NUMEQUAL&lt;br /&gt;
|156&lt;br /&gt;
|0x9c&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if the numbers are equal, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NUMEQUALVERIFY&lt;br /&gt;
|157&lt;br /&gt;
|0x9d&lt;br /&gt;
|a b&lt;br /&gt;
|Nothing / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|Same as OP_NUMEQUAL, but runs OP_VERIFY afterward.&lt;br /&gt;
|-&lt;br /&gt;
|OP_NUMNOTEQUAL&lt;br /&gt;
|158&lt;br /&gt;
|0x9e&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if the numbers are not equal, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_LESSTHAN&lt;br /&gt;
|159&lt;br /&gt;
|0x9f&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if a is less than b, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_GREATERTHAN&lt;br /&gt;
|160&lt;br /&gt;
|0xa0&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if a is greater than b, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_LESSTHANOREQUAL&lt;br /&gt;
|161&lt;br /&gt;
|0xa1&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if a is less than or equal to b, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_GREATERTHANOREQUAL&lt;br /&gt;
|162&lt;br /&gt;
|0xa2&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if a is greater than or equal to b, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_MIN&lt;br /&gt;
|163&lt;br /&gt;
|0xa3&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns the smaller of a and b.&lt;br /&gt;
|-&lt;br /&gt;
|OP_MAX&lt;br /&gt;
|164&lt;br /&gt;
|0xa4&lt;br /&gt;
|a b&lt;br /&gt;
|out&lt;br /&gt;
|Returns the larger of a and b.&lt;br /&gt;
|-&lt;br /&gt;
|OP_WITHIN&lt;br /&gt;
|165&lt;br /&gt;
|0xa5&lt;br /&gt;
|x min max&lt;br /&gt;
|out&lt;br /&gt;
|Returns 1 if x is within the specified range (left-inclusive), 0 otherwise.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Crypto ===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_RIPEMD160&lt;br /&gt;
|166&lt;br /&gt;
|0xa6&lt;br /&gt;
|in&lt;br /&gt;
|hash&lt;br /&gt;
|The input is hashed using RIPEMD-160.&lt;br /&gt;
|-&lt;br /&gt;
|OP_SHA1&lt;br /&gt;
|167&lt;br /&gt;
|0xa7&lt;br /&gt;
|in&lt;br /&gt;
|hash&lt;br /&gt;
|The input is hashed using SHA-1.&lt;br /&gt;
|-&lt;br /&gt;
|OP_SHA256&lt;br /&gt;
|168&lt;br /&gt;
|0xa8&lt;br /&gt;
|in&lt;br /&gt;
|hash&lt;br /&gt;
|The input is hashed using SHA-256.&lt;br /&gt;
|-&lt;br /&gt;
|OP_HASH160&lt;br /&gt;
|169&lt;br /&gt;
|0xa9&lt;br /&gt;
|in&lt;br /&gt;
|hash&lt;br /&gt;
|The input is hashed twice: first with SHA-256 and then with RIPEMD-160.&lt;br /&gt;
|-&lt;br /&gt;
|OP_HASH256&lt;br /&gt;
|170&lt;br /&gt;
|0xaa&lt;br /&gt;
|in&lt;br /&gt;
|hash&lt;br /&gt;
|The input is hashed two times with SHA-256.&lt;br /&gt;
|-&lt;br /&gt;
|OP_CODESEPARATOR&lt;br /&gt;
|171&lt;br /&gt;
|0xab&lt;br /&gt;
|Nothing&lt;br /&gt;
|Nothing&lt;br /&gt;
|All of the signature checking words will only match signatures to the data after the most recently-executed OP_CODESEPARATOR.&lt;br /&gt;
|-&lt;br /&gt;
|[[OP_CHECKSIG]]&lt;br /&gt;
|172&lt;br /&gt;
|0xac&lt;br /&gt;
|sig pubkey&lt;br /&gt;
|True / false&lt;br /&gt;
|The entire transaction&#039;s outputs, inputs, and script (from the most recently-executed OP_CODESEPARATOR to the end) are hashed. The signature used by OP_CHECKSIG must be a valid signature for this hash and public key. If it is, 1 is returned, 0 otherwise.&lt;br /&gt;
|-&lt;br /&gt;
|OP_CHECKSIGVERIFY&lt;br /&gt;
|173&lt;br /&gt;
|0xad&lt;br /&gt;
|sig pubkey&lt;br /&gt;
|Nothing / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|Same as OP_CHECKSIG, but OP_VERIFY is executed afterward.&lt;br /&gt;
|-&lt;br /&gt;
|OP_CHECKMULTISIG&lt;br /&gt;
|174&lt;br /&gt;
|0xae&lt;br /&gt;
|x sig1 sig2 ... &amp;lt;number of signatures&amp;gt; pub1 pub2 &amp;lt;number of public keys&amp;gt;&lt;br /&gt;
|True / False&lt;br /&gt;
|Compares the first signature against each public key until it finds an ECDSA match. Starting with the subsequent public key, it compares the second signature against each remaining public key until it finds an ECDSA match. The process is repeated until all signatures have been checked or not enough public keys remain to produce a successful result.  All signatures need to match a public key. Because public keys are not checked again if they fail any signature comparison, signatures must be placed in the scriptSig using the same order as their corresponding public keys were placed in the scriptPubKey or redeemScript.  If all signatures are valid, 1 is returned, 0 otherwise. Due to a bug, one extra unused value is removed from the stack.&lt;br /&gt;
|-&lt;br /&gt;
|OP_CHECKMULTISIGVERIFY&lt;br /&gt;
|175&lt;br /&gt;
|0xaf&lt;br /&gt;
|x sig1 sig2 ... &amp;lt;number of signatures&amp;gt; pub1 pub2 ... &amp;lt;number of public keys&amp;gt;&lt;br /&gt;
|Nothing / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|Same as OP_CHECKMULTISIG, but OP_VERIFY is executed afterward.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Locktime ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Input&lt;br /&gt;
!Output&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_CHECKLOCKTIMEVERIFY (previously OP_NOP2)&lt;br /&gt;
|177&lt;br /&gt;
|0xb1&lt;br /&gt;
|x&lt;br /&gt;
|x / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Marks transaction as invalid&#039;&#039;&#039; if the top stack item is greater than the transaction&#039;s nLockTime field, otherwise script evaluation continues as though an OP_NOP was executed. Transaction is also invalid if 1. the stack is empty; or 2. the top stack item is negative; or 3. the top stack item is greater than or equal to 500000000 while the transaction&#039;s nLockTime field is less than 500000000, or vice versa; or 4. the input&#039;s nSequence field is equal to 0xffffffff. The precise semantics are described in [[BIP 0065]]&lt;br /&gt;
|-&lt;br /&gt;
|OP_CHECKSEQUENCEVERIFY (previously OP_NOP3)&lt;br /&gt;
|178&lt;br /&gt;
|0xb2&lt;br /&gt;
|x&lt;br /&gt;
|x / &#039;&#039;fail&#039;&#039;&lt;br /&gt;
|&#039;&#039;&#039;Marks transaction as invalid&#039;&#039;&#039; if the relative lock time of the input (enforced by [[BIP 0068]] with nSequence) is not equal to or longer than the value of the top stack item. The precise semantics are described in [[BIP 0112]].&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Pseudo-words===&lt;br /&gt;
These words are used internally for assisting with transaction matching. They are invalid if used in actual scripts.&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|OP_PUBKEYHASH&lt;br /&gt;
|253&lt;br /&gt;
|0xfd&lt;br /&gt;
|Represents a public key hashed with OP_HASH160.&lt;br /&gt;
|-&lt;br /&gt;
|OP_PUBKEY&lt;br /&gt;
|254&lt;br /&gt;
|0xfe&lt;br /&gt;
|Represents a public key compatible with OP_CHECKSIG.&lt;br /&gt;
|-&lt;br /&gt;
|OP_INVALIDOPCODE&lt;br /&gt;
|255&lt;br /&gt;
|0xff&lt;br /&gt;
|Matches any opcode that is not yet assigned.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Reserved words ===&lt;br /&gt;
Any opcode not assigned is also reserved. Using an unassigned opcode makes the transaction &#039;&#039;&#039;invalid&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
!Word&lt;br /&gt;
!Opcode&lt;br /&gt;
!Hex&lt;br /&gt;
!When used...&lt;br /&gt;
|-&lt;br /&gt;
|OP_RESERVED&lt;br /&gt;
|80&lt;br /&gt;
|0x50&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid&#039;&#039;&#039; unless occuring in an unexecuted OP_IF branch&lt;br /&gt;
|-&lt;br /&gt;
|OP_VER&lt;br /&gt;
|98&lt;br /&gt;
|0x62&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid&#039;&#039;&#039; unless occuring in an unexecuted OP_IF branch&lt;br /&gt;
|-&lt;br /&gt;
|OP_VERIF&lt;br /&gt;
|101&lt;br /&gt;
|0x65&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid even when occuring in an unexecuted OP_IF branch&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_VERNOTIF&lt;br /&gt;
|102&lt;br /&gt;
|0x66&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid even when occuring in an unexecuted OP_IF branch&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
|OP_RESERVED1&lt;br /&gt;
|137&lt;br /&gt;
|0x89&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid&#039;&#039;&#039; unless occuring in an unexecuted OP_IF branch&lt;br /&gt;
|-&lt;br /&gt;
|OP_RESERVED2&lt;br /&gt;
|138&lt;br /&gt;
|0x8a&lt;br /&gt;
|&#039;&#039;&#039;Transaction is invalid&#039;&#039;&#039; unless occuring in an unexecuted OP_IF branch&lt;br /&gt;
|-&lt;br /&gt;
|OP_NOP1, OP_NOP4-OP_NOP10&lt;br /&gt;
|176, 179-185&lt;br /&gt;
|0xb0, 0xb3-0xb9&lt;br /&gt;
|The word is ignored. Does not mark transaction as invalid.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Script examples ==&lt;br /&gt;
This is a list of interesting scripts. Keep in mind that all constants actually use the data-pushing commands above. Note that there is a small number of standard script forms that are relayed from node to node; non-standard scripts are accepted if they are in a block, but nodes will not relay them.&lt;br /&gt;
&lt;br /&gt;
=== Standard Transaction to Bitcoin address (pay-to-pubkey-hash) ===&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
 scriptSig: &amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To demonstrate how scripts look on the wire, here is a raw scriptPubKey:&lt;br /&gt;
&amp;lt;pre&amp;gt;  76       A9             14&lt;br /&gt;
OP_DUP OP_HASH160    Bytes to push&lt;br /&gt;
&lt;br /&gt;
89 AB CD EF AB BA AB BA AB BA AB BA AB BA AB BA AB BA AB BA   88         AC&lt;br /&gt;
                      Data to push                     OP_EQUALVERIFY OP_CHECKSIG&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: scriptSig is in the input of the spending transaction and scriptPubKey is in the output of the previously unspent i.e. &amp;quot;available&amp;quot; transaction.&lt;br /&gt;
&lt;br /&gt;
Here is how each word is processed:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Stack &lt;br /&gt;
! Script &lt;br /&gt;
! Description &lt;br /&gt;
|-&lt;br /&gt;
|Empty.&lt;br /&gt;
| &amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| scriptSig and scriptPubKey are combined.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
| OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
| OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Top stack item is duplicated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubHashA&amp;gt;&lt;br /&gt;
|&amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
| Top stack item is hashed.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubHashA&amp;gt; &amp;lt;pubKeyHash&amp;gt;&lt;br /&gt;
|OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
| Constant added.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
|OP_CHECKSIG&lt;br /&gt;
| Equality is checked between the top two stack items.&lt;br /&gt;
|-&lt;br /&gt;
|true&lt;br /&gt;
|Empty.&lt;br /&gt;
|Signature is checked for top two stack items.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Obsolete pay-to-pubkey transaction ===&lt;br /&gt;
&lt;br /&gt;
OP_CHECKSIG is used directly without first hashing the public key.&lt;br /&gt;
This was used by early versions of Bitcoin where people paid directly to IP addresses, before Bitcoin addresses were introduced.&lt;br /&gt;
scriptPubKeys of this transaction form are still recognized as payments to user by Bitcoin Core.&lt;br /&gt;
The disadvantage of this transaction form is that the whole public key needs to be known in advance, implying longer payment addresses, and that it provides less protection in the event of a break in the ECDSA signature algorithm.&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: &amp;lt;pubKey&amp;gt; OP_CHECKSIG&lt;br /&gt;
 scriptSig: &amp;lt;sig&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Checking process:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Stack &lt;br /&gt;
! Script &lt;br /&gt;
! Description &lt;br /&gt;
|-&lt;br /&gt;
|Empty.&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; OP_CHECKSIG&lt;br /&gt;
|scriptSig and scriptPubKey are combined.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
| OP_CHECKSIG&lt;br /&gt;
|Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
|true&lt;br /&gt;
|Empty.&lt;br /&gt;
|Signature is checked for top two stack items.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Provably Unspendable/Prunable Outputs ===&lt;br /&gt;
&lt;br /&gt;
The standard way to mark a transaction as provably unspendable is with a scriptPubKey of the following form:&lt;br /&gt;
&lt;br /&gt;
  scriptPubKey: OP_RETURN {zero or more ops}&lt;br /&gt;
&lt;br /&gt;
OP_RETURN immediately marks the script as invalid, guaranteeing that no scriptSig exists that could possibly spend that output. Thus the output can be immediately pruned from the UTXO set even if it has not been spent. [http://blockexplorer.com/tx/eb31ca1a4cbd97c2770983164d7560d2d03276ae1aee26f12d7c2c6424252f29 eb31ca1a4cbd97c2770983164d7560d2d03276ae1aee26f12d7c2c6424252f29] is an example: it has a single output of zero value, thus giving the full 0.125BTC fee to the miner who mined the transaction without adding an entry to the UTXO set. You can also use OP_RETURN to add data to a transaction without the data ever appearing in the UTXO set, as seen in 1a2e22a717d626fc5db363582007c46924ae6b28319f07cb1b907776bd8293fc; [[P2Pool]] does this with the share chain hash txout in the coinbase of blocks it creates.&lt;br /&gt;
&lt;br /&gt;
=== Anyone-Can-Spend Outputs ===&lt;br /&gt;
&lt;br /&gt;
Conversely a transaction can be made spendable by anyone at all:&lt;br /&gt;
&lt;br /&gt;
  scriptPubKey: (empty)&lt;br /&gt;
  scriptSig: OP_TRUE&lt;br /&gt;
&lt;br /&gt;
With some software changes such transactions can be used as a way to donate funds to miners in addition to transaction fees: any miner who mines such a transaction can also include an additional one after it sending the funds to an address they control. This mechanism may be used in the future for [[fidelity bonds]] to sacrifice funds in a provable way.&lt;br /&gt;
&lt;br /&gt;
Anyone-Can-Spend outputs are currently considered non-standard, and are not relayed on the P2P network.&lt;br /&gt;
&lt;br /&gt;
=== Freezing funds until a time in the future ===&lt;br /&gt;
&lt;br /&gt;
Using OP_CHECKLOCKTIMEVERIFY it is possible to make funds provably unspendable until a certain point in the future.&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: &amp;lt;expiry time&amp;gt; OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
 scriptSig: &amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Stack &lt;br /&gt;
! Script &lt;br /&gt;
! Description &lt;br /&gt;
|-&lt;br /&gt;
|Empty.&lt;br /&gt;
| &amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;expiry time&amp;gt; OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| scriptSig and scriptPubKey are combined.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;expiry time&amp;gt;&lt;br /&gt;
| OP_CHECKLOCKTIMEVERIFY OP_DROP OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;expiry time&amp;gt;&lt;br /&gt;
| OP_DROP OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Top stack item is checked against the current time or block height.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
| OP_DUP OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Top stack item is removed.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
| OP_HASH160 &amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG &lt;br /&gt;
| Top stack item is duplicated.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubHashA&amp;gt;&lt;br /&gt;
|&amp;lt;pubKeyHash&amp;gt; OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
| Top stack item is hashed.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt; &amp;lt;pubHashA&amp;gt; &amp;lt;pubKeyHash&amp;gt;&lt;br /&gt;
|OP_EQUALVERIFY OP_CHECKSIG&lt;br /&gt;
| Constant added.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;sig&amp;gt; &amp;lt;pubKey&amp;gt;&lt;br /&gt;
|OP_CHECKSIG&lt;br /&gt;
| Equality is checked between the top two stack items.&lt;br /&gt;
|-&lt;br /&gt;
|true&lt;br /&gt;
|Empty.&lt;br /&gt;
|Signature is checked for top two stack items.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Transaction puzzle ===&lt;br /&gt;
&lt;br /&gt;
Transaction a4bfa8ab6435ae5f25dae9d89e4eb67dfa94283ca751f393c1ddc5a837bbc31b is an interesting puzzle.&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: OP_HASH256 6fe28c0ab6f1b372c1a6a246ae63f74f931e8365e15a089c68d6190000000000 OP_EQUAL&lt;br /&gt;
 scriptSig: &amp;lt;data&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To spend the transaction you need to come up with some data such that hashing the data twice results in the given hash.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
! Stack &lt;br /&gt;
! Script &lt;br /&gt;
! Description &lt;br /&gt;
|-&lt;br /&gt;
|Empty.&lt;br /&gt;
|&amp;lt;data&amp;gt; OP_HASH256 &amp;lt;given_hash&amp;gt; OP_EQUAL&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;data&amp;gt;&lt;br /&gt;
|OP_HASH256 &amp;lt;given_hash&amp;gt; OP_EQUAL&lt;br /&gt;
|scriptSig added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;data_hash&amp;gt;&lt;br /&gt;
|&amp;lt;given_hash&amp;gt; OP_EQUAL&lt;br /&gt;
|The data is hashed.&lt;br /&gt;
|-&lt;br /&gt;
|&amp;lt;data_hash&amp;gt; &amp;lt;given_hash&amp;gt;&lt;br /&gt;
|OP_EQUAL&lt;br /&gt;
|The given hash is pushed to the stack.&lt;br /&gt;
|-&lt;br /&gt;
|true&lt;br /&gt;
|Empty.&lt;br /&gt;
|The hashes are compared, leaving true on the stack.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This transaction was successfully spent by 09f691b2263260e71f363d1db51ff3100d285956a40cc0e4f8c8c2c4a80559b1. The required data happened to be the [[Genesis block]], and the given hash was the genesis block hash. Note that while transactions like this are fun, they are not secure, because they do not contain any signatures and thus any transaction attempting to spend them can be replaced with a different transaction sending the funds somewhere else.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Transactions]]&lt;br /&gt;
* [[Contracts]]&lt;br /&gt;
&lt;br /&gt;
== External Links ==&lt;br /&gt;
*[https://github.com/siminchen/bitcoinIDE Bitcoin IDE]: Bitcoin Script for dummies&lt;br /&gt;
*[https://webbtc.com/script Bitcoin Debug Script Execution]&lt;br /&gt;
*[http://www.crmarsh.com/script-playground/ Script Playground] — convert Script to JavaScript&lt;br /&gt;
&amp;lt;sup&amp;gt;(cf. &amp;quot;[http://bitcoin.stackexchange.com/q/42576/4334 Online Bitcoin Script simulator or debugger?]&amp;quot;)&amp;lt;/sup&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
[[Category:Vocabulary]]&lt;br /&gt;
&lt;br /&gt;
{{Bitcoin Core documentation}}&lt;/div&gt;</summary>
		<author><name>Rusty</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Pay_to_script_hash&amp;diff=56620</id>
		<title>Pay to script hash</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Pay_to_script_hash&amp;diff=56620"/>
		<updated>2015-05-27T06:35:17Z</updated>

		<summary type="html">&lt;p&gt;Rusty: Save others from trying to understand that non-BIP16 spending script!&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Pay to script hash&#039;&#039;&#039; (P2SH) transactions were standardised in [[BIP 0016|BIP 16]]. They allow transactions to be sent to a script hash (addresses starting with 3) instead of a public key hash (addresses starting with 1). To spend bitcoins sent via P2SH, the recipient must provide a [[script]] matching the script hash and data which makes the script evaluate to true.&lt;br /&gt;
&lt;br /&gt;
Using P2SH, you can send bitcoins to an address that is secured in various unusual ways without knowing anything about the details of how the security is set up. You just send bitcoins to the ~34-character P2SH address. The recipient might need the signatures of several people to spend these bitcoins, or a password might be required, or the requirements could be completely unique.&lt;br /&gt;
&lt;br /&gt;
== Addresses ==&lt;br /&gt;
&lt;br /&gt;
[[BIP 0013|BIP 13]] specifies the address format. Bitcoin P2SH addresses always start with 3.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Transaction 40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8 paid to P2SH address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG.  You can see the redeem script in transaction 7edb32d4ffd7a385b763c7a8e56b6358bcd729e747290624e18acdbe6209fc45 which spends that output, using &amp;lt;code&amp;gt;OP_FALSE &amp;lt;sig&amp;gt; { OP_1 &amp;lt;pubkey&amp;gt; OP_1 OP_CHECKMULTISIG }&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
&lt;br /&gt;
342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey is a Bitcoin [[address]] notable for being the first [[P2SH]]-compatible address receiving bitcoins on the production network.&lt;br /&gt;
Its payment was mined in [[block]] 160720; note that it was spent prior to the enforcement of [[BIP 0016|BIP 16]], so it&#039;s not a good example to understand P2SH.&lt;/div&gt;</summary>
		<author><name>Rusty</name></author>
	</entry>
</feed>