<?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=Rodasmith</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=Rodasmith"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Rodasmith"/>
	<updated>2026-04-28T06:54:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Lightning_Network&amp;diff=61938</id>
		<title>Lightning Network</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Lightning_Network&amp;diff=61938"/>
		<updated>2016-12-22T02:38:52Z</updated>

		<summary type="html">&lt;p&gt;Rodasmith: /* Glossary */ typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Lightning Network&#039;&#039;&#039; is a proposed implementation of [[Hashed Timelock Contracts]] (HTLCs) with bi-directional [[payment channels]] which allows payments to be securely routed across multiple peer-to-peer payment channels.&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;  This allows the formation of a network where any peer on the network can pay any other peer even if they don&#039;t directly have a channel open between each other.&lt;br /&gt;
&lt;br /&gt;
== Key features == &lt;br /&gt;
Key features of the Lightning Network proposal include,&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Rapid payments:&#039;&#039;&#039; payments within an established channel can be made almost as fast as data can travel over the Internet between the two peers.&lt;br /&gt;
* &#039;&#039;&#039;No third-party trust:&#039;&#039;&#039; the two peers in a channel pay each other directly using regular Bitcoin transactions (of which only one is broadcast) so at no point does any third party control their funds.&lt;br /&gt;
* &#039;&#039;&#039;Reduced blockchain load:&#039;&#039;&#039; only channel open transactions, channel close transactions, and (hopefully infrequent) anti-fraud respends need to be committed to the blockchain, allowing all other payments within Lightning Network channels to remain uncommitted.  This allows Lightning Network users to make frequent payments secured by Bitcoin without placing excessive load on full nodes which must process every transaction on the blockchain.&lt;br /&gt;
* &#039;&#039;&#039;Channels can stay open indefinitely:&#039;&#039;&#039; as long as the two parties in the channel continue to cooperate with each other, the channel can stay open indefinitely -- there is no mandatory timeout period.  This can further reduce the load on the blockchain as well as allow the fees for opening and closing the channel to be amortized over a longer period of time.&lt;br /&gt;
* &#039;&#039;&#039;Rapid cooperative closes:&#039;&#039;&#039; if both parties cooperate, a channel can be closed immediately (with the parties likely wanting to wait for one or more confirmations to ensure the channel closed in the correct state). Non-cooperative closes (such as when one party disappears) are also possible but they take longer.&lt;br /&gt;
* &#039;&#039;&#039;Outsourcable enforcement:&#039;&#039;&#039; if one party closes a channel in an old state in an attempt to steal money, the other party has to act within a defined period of time to block the attempted theft.  This function can be outsourced to a third-party without giving them control over any funds, allowing wallets to safely go offline for periods longer than the defined period.&lt;br /&gt;
* &#039;&#039;&#039;Onion-style routing:&#039;&#039;&#039; payment routing information can be encrypted in a nested fashion so that intermediary nodes only know who they received a routable payment from and who to send it to next, preventing those intermediary nodes from knowing who the originator or destination is (provided the intermediaries didn&#039;t compare records).&lt;br /&gt;
* &#039;&#039;&#039;Multisignature capable:&#039;&#039;&#039; each party can require that their payments into the channel be signed by multiple keys&amp;lt;ref name=&amp;quot;poon_multisig&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/lightning-dev/2016-January/000403.html 2-of-3 Instant Escrow, or How to Do &amp;quot;2-of-3 Multisig Contract&amp;quot; Equivilant on Lightning]&amp;lt;br&amp;gt;Joseph Poon&amp;lt;br&amp;gt;&#039;&#039;Retrieved 2016-04-11&#039;&#039;&amp;lt;/ref&amp;gt;, giving them access to additional security techniques.&lt;br /&gt;
* &#039;&#039;&#039;Securely cross blockchains:&#039;&#039;&#039; payments can be routed across more than one blockchain (including altcoins and sidechains) as long as all the chains support the same hash function to use for the hash lock, as well as the ability the ability to create time locks.&lt;br /&gt;
* &#039;&#039;&#039;Sub-satoshi payments:&#039;&#039;&#039; payments can be made conditional upon the outcome of a random event, allowing probabilistic payments.&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt;  For example, Alice can pay Bob 0.1 satoshi by creating a 1-satoshi payment with 10-to-1 odds so that 90% of the time she does this she pays him 0 satoshis and 10% of the time she pays him 1 satoshi for an average payment of 0.1 satoshis.&lt;br /&gt;
* &#039;&#039;&#039;Single-funded channels:&#039;&#039;&#039; when Alice needs to send a payment to Bob and doesn&#039;t currently have a way to pay him through the Lightning Network (whether because she can&#039;t reach him or because she doesn&#039;t have enough money in an existing channel), she can make a regular on-chain payment that establishes a channel without Bob needing to add any of his funds to the channel. Alice only uses 12 bytes more than she would for a non-Lightning direct payment and Bob would only need about 25 more segwit virtual bytes to close the channel than he would had he received a non-Lightning direct payment.&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Glossary ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This section attempts to document the most frequently used terms found in Lightning Network literature that may not be familiar to a general technical audience, including both the new terms created by Lightning Network designers as well as pre-existing terms that may not be well known from Bitcoin, cryptography, network routing, and other fields.&lt;br /&gt;
&lt;br /&gt;
The list below should be in alphabetical order. Any commonly-used synonyms or analogs for a term are placed in parenthesis after the term.&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;Bi-directional payment channel:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; a payment channel where payments can flow both directions, from Alice to Bob and back to Alice. This is contrasted with Spillman-style and CLTV-style payment channels where payments can only go one direction and once Alice has paid Bob all of the bitcoins she deposited in the channel funding transaction, the channel is no longer useful and so will be closed.&lt;br /&gt;
* &#039;&#039;&#039;Breach Remedy Transaction:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; the transaction Alice creates when Mallory attempts to steal her money by having an old version of the channel state committed to the blockchain. Alice&#039;s breach remedy transaction spends all the money that Mallory received but which Mallory can&#039;t spend yet because his unilateral spend is still locked by a relative locktime using &amp;lt;code&amp;gt;OP_CSV&amp;lt;/code&amp;gt;. This is the third of the maximum of three on-chain transactions needed to maintain a Lightning channel; it only needs to be used in the case of attempted fraud (contract breach).&lt;br /&gt;
* &#039;&#039;&#039;Channel&#039;&#039;&#039; (Lightning channel&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt;, payment channel&amp;lt;ref name=&amp;quot;spillman_channel&amp;quot;&amp;gt;[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2013-April/002433.html Anti DoS for tx replacement]&amp;lt;br&amp;gt;Jeremy Spillman&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt;) a communication channel that allows two parties to make many secure payments between each other in exchange for making only a few transactions on the blockchain.&lt;br /&gt;
* &#039;&#039;&#039;Commitment Transaction:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; a transaction created collaboratively by Alice and Bob each time they update the state of the channel; it records their current balances within the channel. The &#039;&#039;&#039;Initial Commitment Transaction&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; is the first of these transactions; it records the inital balances within the channel. This is the second of the maximum of three on-chain transactions needed to maintain a Lightning channel; it can be combined with a &#039;&#039;funding transaction&#039;&#039; for a new channel under the cooperative conditions necessary to create an &#039;&#039;exercise settlement transaction&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;Contract:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;szabo_smart_contracts&amp;quot;&amp;gt;[http://szabo.best.vwh.net/smart_contracts_idea.html The Idea of Smart Contracts]&amp;lt;br&amp;gt;Nick Szabo&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; an agreement between two or more entities to use Bitcoin transactions in a certain way, usually a way that allows Bitcoin&#039;s automated consensus to enforce some or all terms in the contract. Often called a &#039;&#039;smart contract&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;CSV:&#039;&#039;&#039; (&amp;lt;code&amp;gt;OP_CheckSequenceVerify&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OP_CSV&amp;lt;/code&amp;gt;)&amp;lt;ref name=&amp;quot;bip68&amp;quot;/&amp;gt; a opcode that allows an output to conditionally specify how long it must be part of the blockchain before an input spending it may be added to the blockchain. See &#039;&#039;relative locktime.&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Delivery Transaction:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; not really a transaction but rather the name for the outputs in the &#039;&#039;commitment transaction&#039;&#039; which Alice and Bob receive if one of them closes the channel unilaterally in the correct (current) state. If the channel is closed in an old state (indicating possible fraud), a &#039;&#039;breach remedy transaction&#039;&#039; will be generated from the output that would have paid the party closing the channel. If the channel is closed cooperatively, they&#039;ll create an &#039;&#039;exercise settlement transaction&#039;&#039; instead.&lt;br /&gt;
* &#039;&#039;&#039;Dispute period:&#039;&#039;&#039; (dispute resolution period&amp;lt;ref name=&amp;quot;poon_time_bitcoin_ln&amp;quot;&amp;gt;[https://lightning.network/lightning-network-presentation-time-2015-07-06.pdf Time, Bitcoin, and the Lightning Network]&amp;lt;br&amp;gt;Joseph Poon&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt;) the period of time that Alice has to get her &#039;&#039;breach remedy transaction&#039;&#039; added to the blockchain after Mallory has an old &#039;&#039;commitment transaction&#039;&#039; added to the blockchain. If the dispute period ends without a breach remedy transaction being added to the blockchain, Mallory can spend the funds he received from the old commitment transaction.&lt;br /&gt;
* &#039;&#039;&#039;Dual-funded channel:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;&amp;gt;[https://docs.google.com/presentation/d/1G4xchDGcO37DJ2lPC_XYyZIUkJc2khnLrCaZXgvDN0U/edit?pref=2&amp;amp;pli=1#slide=id.g85f425098_0_2 LN as a Directed Graph: Single-Funded Channel Topology]&amp;lt;br&amp;gt;Thaddeus Dryja&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; a channel opened by a &#039;&#039;funding transaction&#039;&#039; containing inputs from both Alice and Bob. Compare to a &#039;&#039;single-funded channel&#039;&#039; where only Alice&#039;s inputs contribute to the balance of the channel.&lt;br /&gt;
* &#039;&#039;&#039;Encumbrance:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[http://chimera.labs.oreilly.com/books/1234000001802/ch02.html Mastering Bitcoin, Chapter 2: How Bitcoin Works]&amp;lt;br&amp;gt;Andreas Antonopoulos&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; a generic name for any conditions that must be satisfied before a bitcoin output may be spent. Early Bitcoin transactions placed all their conditions in the scriptPubKey; later the introduction of P2SH allowed conditions to be added in a redeemScript which the scriptPubKey committed to; the introduction of soft fork segwit will add a similar mechanism for detached conditions that the scriptPubKey commits to; in addition, there are even more novel ways to add conditions to outputs that are discussed but rarely used. The term &amp;amp;quot;encumbrance&amp;amp;quot; allows specifying what the conditions do without fussing over exactly where the conditions appear in a serialized transaction.&lt;br /&gt;
* &#039;&#039;&#039;Exercise Settlement Transaction:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; a form of the &#039;&#039;commitment transaction&#039;&#039; created cooperatively by Alice and Bob when they want to close their channel together. Unlike a regular commitment transaction, none of the outputs on an exercise settlement transaction are time locked, allowing them to be immediately respent.&lt;br /&gt;
* &#039;&#039;&#039;Exhausted:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; (exhausted channel) a payment channel where no additional payments can be made in one direction (such as from Alice to Bob). The person controlling the exhausted side of a Lightning channel loses nothing from fraudulently trying to commit an old channel state, so allowing a channel to become exhausted (or too near to being exhausted) is unpreferable. (Exception: channels can be securely started in an exhausted state, such as a &#039;&#039;single-funded channel.&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Full push:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; when Alice pays the full amount of the channel to Bob in the &#039;&#039;initial commitment transaction&#039;&#039;, which &#039;&#039;exhausts&#039;&#039; the channel without incentivizing fraud because Alice doesn&#039;t have a previous &#039;&#039;commitment transaction&#039;&#039; that she can broadcast. This term is used in the context of a &#039;&#039;single-funded transaction&#039;&#039; and stands in contrast to an &#039;&#039;overpayment&#039;&#039; where Alice deposits more than she pays Bob in that initial payment so that she can continue to use the channel without needing to &#039;&#039;rebalance&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;Funding Transaction:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; (deposit transaction) a transaction created collaboratively by Alice and Bob to open a Lightning channel. In a single-funded channel, Alice provides all the funding;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; in a dual-funded channel, Alice and Bob both provide some funding. This is the first of the maximum of three on-chain transactions needed to maintain a Lightning channel; it can be combined with a commitment transaction from a previous channel being closed under cooperative conditions.&lt;br /&gt;
* &#039;&#039;&#039;Half-signed:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; a transaction input which requires two signatures to be added to the blockchain but which only has one signature attached. (More generally, this could be any input that has fewer signatures attached than it needs to be added to the blockchain.)&lt;br /&gt;
* &#039;&#039;&#039;Hash lock:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[https://www.mail-archive.com/bitcoin-development@lists.sourceforge.net/msg05135.html BIP - Hash Locked Transaction]&amp;lt;br&amp;gt;Tier Nolan&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; an encumbrance to a transaction output that requires the pre-image used to generate a particular hash be provided in order to spend the output. In Lightning, this is used to allow payments to be routable without needing to trust the intermediaries.&lt;br /&gt;
* &#039;&#039;&#039;HTLC:&#039;&#039;&#039; (Hashed Timelocked Contract&amp;lt;ref name=&amp;quot;russell_deployable_lightning&amp;quot;&amp;gt;[https://github.com/ElementsProject/lightning/raw/master/doc/deployable-lightning.pdf Reaching the Ground with Lightning]&amp;lt;br&amp;gt;Rusty Russell&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt;) a contract such as that used in a Lightning Channel where both a &#039;&#039;hash lock&#039;&#039; and a &#039;&#039;time lock&#039;&#039; are used, the hash lock being used to allow Alice to route payments to Bob even through a Mallory that neither of them trust, and the time lock being used to prevent Mallory from stealing back any payments he made to Alice within the channel (provided Alice enforces the contract).&lt;br /&gt;
* &#039;&#039;&#039;Intermediary:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; When Bob has one channel open with Alice and another channel open with Charlie, Bob can serve as an intermediary for transferring payments between Alice and Charlie. With Lightning payments being secured with a &#039;&#039;hash lock,&#039;&#039; Bob can&#039;t steal the payment from Alice to Charlie when it travels through Bob&#039;s node. Lightning payments can securely travel through a theoretically unlimited number of intermediaries.&lt;br /&gt;
* &#039;&#039;&#039;Limbo channel:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; an optional special state for a Lightning channel where it cannot be immediately closed by one or both of the parties unilaterally (it can still be immediately closed cooperatively). This is used in particular for &#039;&#039;PLIPPs.&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Multisig:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;bitcoin_0_1_code&amp;quot;/&amp;gt; (multisignature, m-of-n multisig) a transaction output that requires signatures from at least one of a set of two or more different private keys. Used in Lightning to give both Alice and Bob control over their individual funds within a channel by requiring both of them sign &#039;&#039;commitment transactions&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;Node:&#039;&#039;&#039; (Lightning node&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt;) a wallet with one or more open Lightning channels. This should not be confused with a Bitcoin [[full node]] that validates Bitcoin blocks, although a full node&#039;s wallet may also be simultaneously used as a Lightning node to the advantage of the Lightning network user.&lt;br /&gt;
* &#039;&#039;&#039;Overfunding:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; in a &#039;&#039;single-funded channel,&#039;&#039; Alice deposits more bitcoins into the channel than she pays Bob in the initial payment, allowing her to make additional payments through the Lightning network. This stands in contrast to a &#039;&#039;full push&#039;&#039; where Alice only deposits enough to pay Bob in the initial payment.&lt;br /&gt;
* &#039;&#039;&#039;PILPP:&#039;&#039;&#039; (Pre-Image Length Probabilistic Payments&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt;) a specific type of &#039;&#039;probabilistic payment&#039;&#039; within a payment channel where Alice creates string with a random length and Bob guesses the length; if he guesses correctly, Alice has to pay him; if he guesses incorrectly, Alice gets to keep her money.&lt;br /&gt;
* &#039;&#039;&#039;Pre-image:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[https://en.wikipedia.org/wiki/Image_%28mathematics%29#Inverse_image Image (mathematics)]&amp;lt;br&amp;gt;English Wikipedia contributors&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; (R&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt;) data input into a hash function, which produces a hash of the pre-image. Inputting the same pre-image into the same hash function will always produce the same hash; Lightning uses this feature to create &#039;&#039;hash locks&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;Probabilistic Payment:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[[Nanopayments]]&amp;lt;br&amp;gt;Bitcoin Wiki contributors&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; a payment where Alice only pays Bob if some event outside of Alice&#039;s and Bob&#039;s control occurs in Bob&#039;s favor. Probabilistic payments are usually proposed for scenarios where payments can&#039;t conveniently be made small enough for technical reasons (such as not being able to pay less than 1 satoshi) or economic reasons (such as having to pay a transaction fee for every on-chain payment, making small payments uneconomical). See &#039;&#039;PLIPP&#039;&#039; for a specific type of probabilistic payment possible within a Lightning channel.&lt;br /&gt;
* &#039;&#039;&#039;R:&#039;&#039;&#039; the variable commonly used&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; in formulas to represent a &#039;&#039;pre-image&#039;&#039;.&lt;br /&gt;
* &#039;&#039;&#039;Rebalance:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[https://blockstream.com/2015/09/01/lightning-network/ The Lightning Network: What Is It and What&#039;s Happening?]&amp;lt;br&amp;gt;Rusty Russell&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; a cooperative process between Alice and Bob when they adjust their balances within the channel. This happens with every payment in a Lightning channel and is only noteworthy because single-directional channels (such as Spillman-style and CLTV-style channels) are unable to rebalance and so must close as soon as Alices has paid Bob all the bitcoins she deposited into the channel. See &#039;&#039;bi-directional payment channels.&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Relative locktime:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;bip68&amp;quot;/&amp;gt; the ability to specify when a transaction output may be spent relative to the block that included that transaction output. Enabled by BIP68 and made scriptable by BIP112. Lightning uses relative locktime to ensure &#039;&#039;breach remedy transactions&#039;&#039; may be broadcast within a time period starting from when an old &#039;&#039;commitment transaction&#039;&#039; is added to the blockchain; by making this a relative locktime (instead of an absolute date or block height), Lightning channels don&#039;t have a hard deadline for when they need to close and so can stay open indefinitely as long as the participants continue to cooperate.&lt;br /&gt;
* &#039;&#039;&#039;Revocable Sequence Maturity Contract (RSMC):&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; a &#039;&#039;contract&#039;&#039; used in Lightning to revoke the previous &#039;&#039;commitment transaction&#039;&#039;. This is allowed through mutual consent in Lightning by both parties signing a new commitment transaction and releasing the data necessary to create &#039;&#039;breach remedy transactions&#039;&#039; for the previous commitment transaction. This property allows Lightning to support &#039;&#039;bi-directional payment channels&#039;&#039;, recover from failed &#039;&#039;HTLC&#039;&#039; routing attempts without needing to commit to the blockchain, as well as provide advanced features such as &#039;&#039;PILPPs.&#039;&#039;&lt;br /&gt;
* &#039;&#039;&#039;Single-funded channel:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;dryja_directed_graph&amp;quot;/&amp;gt; a channel opened by a &#039;&#039;funding transaction&#039;&#039; containing only inputs from Alice. Compare to a &#039;&#039;dual-funded channel&#039;&#039; where Alice and Bob both contribute inputs to the initial balance of the channel.&lt;br /&gt;
* &#039;&#039;&#039;Timelock:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[http://rusty.ozlabs.org/?p=450 Lightning Networks Part I: Revocable Transactions]&amp;lt;br&amp;gt;Rusty Russell&amp;lt;br&amp;gt;2016-04-17&amp;lt;/ref&amp;gt; either an encumbrance to a transaction that prevents that transaction from being added to the blockchain before a particular time or block height (as is the case with [[nLockTime]], or an encumbrance that prevents a spend from a transaction output from being added to the blockchain before a particular time or block height (as is the case of OP_CLTV, consensus enforced sequence number relative locktime, and OP_CSV). In Lightning, this is used to prevent malicious intermediaries from holding other users&#039; funds hostages as well as to allow victims of attempted theft to submit breach remedy transactions before the thief can respend the funds he stole.&lt;br /&gt;
* &#039;&#039;&#039;TTL:&#039;&#039;&#039; (Time To Live&amp;lt;ref&amp;gt;[http://lists.linuxfoundation.org/pipermail/lightning-dev/2015-July/000019.html Re: Routing on the Lightning Network?]&amp;lt;br&amp;gt;Rusty Russell&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt;) when Alice pays Bob with a &#039;&#039;hash locked&#039;&#039; in-channel payment that&#039;s ultimately intended for Charlie, she specifies how long Bob has to deliver the payment (its time to live) before the payment becomes invalid. When Bob pays Charlie with his own in-channel payment that has the same hash lock, Bob specifies a slightly shorter amount of time that Charlie has to reveal the pre-image that unlocks the hash lock before Bob&#039;s payment becomes invalid. This ensures that either Bob receives the data necessary to remove the hash lock from the payment he received from Alice or the payment he made to Charlie is invalidated; Alice gets the same guarantee that either the payment she made to Bob ultimate goes through to Charlie or her payment to Bob is invalidated.&lt;br /&gt;
* &#039;&#039;&#039;Unilateral:&#039;&#039;&#039;&amp;lt;ref name=&amp;quot;ln_pdf&amp;quot;/&amp;gt; any action performed by only one of the participants in a channel without requesting or needing permission from the other participant. Lightning allows channels to be closed unilaterally (so Alice can close the channel by herself if Bob becomes unresponsive) and attempted fraud can be penalized unilaterally (so Alice can take any bitcoins Mallory tried to steal when he broadcast an old &#039;&#039;commitment transaction&#039;&#039;).&lt;br /&gt;
* &#039;&#039;&#039;UTXO:&#039;&#039;&#039;&amp;lt;ref&amp;gt;[https://bitcoin.org/en/glossary/unspent-transaction-output Unspent Transaction Output (UTXO)]&amp;lt;br&amp;gt;Bitcoin.org Developer Glossary&amp;lt;br&amp;gt;Retrieved 2016-04-17&amp;lt;/ref&amp;gt; (Unspent Transaction Output) spendable bitcoins. A transaction output lists a bitcoin amount and the conditions (called an &#039;&#039;encumbrance&#039;&#039;) that need to be fulfilled in order to spend those bitcoins. Once those bitcoins have been spent on the blockchain, no other transaction in the same blockchain can spend the same bitcoins, so an Uspent Transaction Output (UTXO) is bitcoins that can be spent.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bitcoin_0_1_code&amp;quot;&amp;gt;[http://satoshi.nakamotoinstitute.org/code/ Bitcoin 0.1 code]&amp;lt;br&amp;gt;Satoshi Nakamoto&amp;lt;br&amp;gt;Retrieved 2016-04-11&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;ref name=&amp;quot;bip68&amp;quot;&amp;gt;[https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki BIP68: Relative lock-time using consensus-enforced sequence numbers]&amp;lt;br&amp;gt;Mark Friedenbach,   BtcDrak, Nicolas Dorier, and kinoshitajona&amp;lt;br&amp;gt;Retrieved 2016-04-12&amp;lt;/ref&amp;gt;&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rodasmith</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54002</id>
		<title>Transaction</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54002"/>
		<updated>2015-01-29T17:26:47Z</updated>

		<summary type="html">&lt;p&gt;Rodasmith: directly explain the intent of a transaction in intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TxBinaryMap.png|thumb|right|Byte-map of Transaction with each type of TxIn and TxOut]]&lt;br /&gt;
A &#039;&#039;&#039;transaction&#039;&#039;&#039; is signed transfer of Bitcoin value to output [[address|Bitcoin addresses]] that is broadcast to the [[network]] and collected into [[block|blocks]]. A transaction typically references previous transaction outputs as new transaction inputs and dedicates all input Bitcoin values to output addresses. Transactions but not encrypted, so it is possible to browse and view any Bitcoin transaction ever collected into a block.&lt;br /&gt;
&lt;br /&gt;
A [[block chain browser]] is a site where every transaction included within the block chain can be viewed.  This is useful for seeing the technical details of transaction in action, and for verifying payments.&lt;br /&gt;
&lt;br /&gt;
=== general format of a Bitcoin transaction (inside a block) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Version no&lt;br /&gt;
|currently 1&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|In-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes &lt;br /&gt;
|-&lt;br /&gt;
|list of inputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_input_of_a_transaction_-_Txin|the first input of the first transaction is also called &amp;quot;coinbase&amp;quot; (its content was ignored in earlier versions)]]&lt;br /&gt;
|&amp;lt;in-counter&amp;gt;-many inputs&lt;br /&gt;
|-&lt;br /&gt;
|Out-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|list of outputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout|the outputs of the first transaction spend the mined bitcoins for the block]]&lt;br /&gt;
|&amp;lt;out-counter&amp;gt;-many outputs&lt;br /&gt;
|-&lt;br /&gt;
|lock_time&lt;br /&gt;
|if non-zero and sequence numbers are &amp;lt; 0xFFFFFFFF: block height or timestamp when transaction is final&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Principle example of a Bitcoin transaction with 1 input and 1 output only ===&lt;br /&gt;
&lt;br /&gt;
==== Data ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Input:&lt;br /&gt;
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6&lt;br /&gt;
Index: 0&lt;br /&gt;
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10&lt;br /&gt;
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
Value: 5000000000&lt;br /&gt;
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d&lt;br /&gt;
OP_EQUALVERIFY OP_CHECKSIG&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
&lt;br /&gt;
The input in this transaction imports 50 BTC from output #0 in transaction f5d8... Then the output sends 50 BTC to a Bitcoin address (expressed here in hexadecimal 4043... instead of the normal base58). When the recipient wants to spend this money, he will reference output #0 of this transaction in an input of his own transaction.&lt;br /&gt;
&lt;br /&gt;
===== Input =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;input&#039;&#039;&#039; is a reference to an output from a previous transaction. Multiple inputs are often listed in a transaction. All of the new transaction&#039;s input values (that is, the total coin value of the previous outputs referenced by the new transaction&#039;s inputs) are added up, and the total (less any transaction fee) is completely used by the outputs of the new transaction. &#039;&#039;&#039;Previous tx&#039;&#039;&#039; is a [[hash]] of a previous transaction. &#039;&#039;&#039;Index&#039;&#039;&#039; is the specific output in the referenced transaction. &#039;&#039;&#039;ScriptSig&#039;&#039;&#039; is the first half of a [[script]] (discussed in more detail later).&lt;br /&gt;
&lt;br /&gt;
The script contains two components, a signature and a public key. The public key must match the hash given in the script of the redeemed output. The public key is used to verify the redeemers signature, which is the second component. More precisely, the second component is an ECDSA signature over a hash of a simplified version of the transaction. It, combined with the public key, proves the transaction was created by the real owner of the address in question. Various flags define how the transaction is simplified and can be used to create different types of payment.&lt;br /&gt;
&lt;br /&gt;
===== Output =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;output&#039;&#039;&#039; contains instructions for sending bitcoins. &#039;&#039;&#039;Value&#039;&#039;&#039; is the number of Satoshi (1 BTC = 100,000,000 Satoshi) that this output will be worth when claimed. &#039;&#039;&#039;ScriptPubKey&#039;&#039;&#039; is the second half of a script (discussed later). There can be more than one output, and they share the combined value of the inputs. Because each output from one transaction can only ever be referenced once by an input of a subsequent transaction, the entire combined input value needs to be sent in an output if you don&#039;t want to lose it. If the input is worth 50 BTC but you only want to send 25 BTC, Bitcoin will create two outputs worth 25 BTC: one to the destination, and one back to you (known as &amp;quot;[[change]]&amp;quot;, though you send it to yourself). Any input bitcoins not redeemed in an output is considered a [[transaction fee]]; whoever generates the block will get it.&lt;br /&gt;
[[File:transaction.png|thumb|A sends 100 BTC to C and C generates 50 BTC. C sends 101 BTC to D, and he needs to send himself some change. D sends the 101 BTC to someone else, but they haven&#039;t redeemed it yet. Only D&#039;s output and C&#039;s change are capable of being spent in the current state.]]&lt;br /&gt;
&lt;br /&gt;
===== Verification =====&lt;br /&gt;
&lt;br /&gt;
To verify that inputs are authorized to collect the values of referenced outputs, Bitcoin uses a custom Forth-like [[script|scripting]] system. The input&#039;s scriptSig and the &#039;&#039;referenced&#039;&#039; output&#039;s scriptPubKey are evaluated (in that order), with scriptPubKey using the values left on the stack by scriptSig. The input is authorized if scriptPubKey returns true. Through the scripting system, the sender can create very complex conditions that people have to meet in order to claim the output&#039;s value. For example, it&#039;s possible to create an output that can be claimed by anyone without any authorization. It&#039;s also possible to require that an input be signed by ten different keys, or be redeemable with a password instead of a key.&lt;br /&gt;
&lt;br /&gt;
=== Types of Transaction ===&lt;br /&gt;
Bitcoin currently creates two different scriptSig/scriptPubKey pairs. These are described below.&lt;br /&gt;
&lt;br /&gt;
It is possible to design more complex types of transactions, and link them together into cryptographically enforced agreements. These are known as [[Contracts]].&lt;br /&gt;
&lt;br /&gt;
==== Pay-to-PubkeyHash ====&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;
A Bitcoin [[address]] is only a hash, so the sender can&#039;t provide a full public key in scriptPubKey. When redeeming coins that have been sent to a Bitcoin address, the recipient provides both the signature and the public key. The script verifies that the provided public key does hash to the hash in scriptPubKey, and then it also checks the signature against the public key.&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_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;
==== Pay-to-Script-Hash ====&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: OP_HASH160 &amp;lt;scriptHash&amp;gt; OP_EQUAL &lt;br /&gt;
 scriptSig: ..signatures... &amp;lt;serialized script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 m-of-n multi-signature transaction:&lt;br /&gt;
 scriptSig: 0 &amp;lt;sig1&amp;gt; ... &amp;lt;script&amp;gt;&lt;br /&gt;
 script: OP_m &amp;lt;pubKey1&amp;gt; ... OP_n OP_CHECKMULTISIG&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P2SH addresses were created with the motivation of moving &amp;quot;the responsibility for supplying the conditions to redeem a transaction from the sender of the funds to the redeemer. They allow the sender to fund an arbitrary transaction, no matter how complicated, using a 20-byte hash&amp;quot;[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#motivation 1]. Pay-to-Pubkey-hash addresses are similarly a 20-byte hash of the public key. &lt;br /&gt;
&lt;br /&gt;
Pay-to-script-hash provides a means for complicated transactions, unlike the Pay-to-pubkey-hash, which has a specific definition for scriptPubKey, and scriptSig. The specification places no limitations on the script, and hence absolutely any contract can be funded using these addresses. &lt;br /&gt;
&lt;br /&gt;
The scriptPubKey in the funding transaction is script which ensures that the script supplied in the redeeming transaction hashes to the script used to create the address. &lt;br /&gt;
&lt;br /&gt;
In the scriptSig above, &#039;signatures&#039; refers to any script which is sufficient to satisfy the following serialized script. &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;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 OP_CHECKMULTISIG &lt;br /&gt;
| Only the scriptSig is used.&lt;br /&gt;
|-&lt;br /&gt;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 &lt;br /&gt;
| OP_CHECKMULTISIG &lt;br /&gt;
| Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
| true&lt;br /&gt;
| Empty&lt;br /&gt;
| Signatures validated in the order of the keys in the script.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[BIP 0016]]&lt;br /&gt;
&lt;br /&gt;
==== Generation ====&lt;br /&gt;
&lt;br /&gt;
Generations have a single input, and this input has a &amp;quot;coinbase&amp;quot; parameter instead of a scriptSig. The data in &amp;quot;coinbase&amp;quot; can be anything; it isn&#039;t used. Bitcoin puts the current compact-format [[target]] and the arbitrary-precision &amp;quot;extraNonce&amp;quot; number there, which increments every time the Nonce field in the [[block_hashing_algorithm|block header]] overflows. Outputs can be anything, but Bitcoin creates one exactly like an IP address transaction.&lt;br /&gt;
The extranonce contributes to enlarge the domain for the proof of work function. Miners can easily modify nonce (4byte), timestamp and extranonce (2 to 100bytes).&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each input of a transaction - Txin ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Previous Transaction hash &lt;br /&gt;
| doubled [[Wikipedia:SHA-256|SHA256]]-[[hash|hashed]] of a (previous) to-be-used transaction&lt;br /&gt;
|32 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Previous Txout-index&lt;br /&gt;
| non negative integer indexing an output of the to-be-used transaction&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script length&lt;br /&gt;
|non negative integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script / scriptSig&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;in-script length&amp;gt;-many bytes&lt;br /&gt;
|-&lt;br /&gt;
|sequence_no&lt;br /&gt;
|normally 0xFFFFFFFF; irrelevant unless transaction&#039;s lock_time is &amp;gt; 0&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The input sufficiently describes where and how to get the bitcoin amout to be redeemed.&lt;br /&gt;
If it is the (only) input of the first transaction of a block, it is called the generation transaction input and its content completely ignored. (Historically the Previous Transaction hash is 0 and the Previous Txout-index is -1.)&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each output of a transaction - Txout ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|non negative integer giving the number of [[FAQ#What_do_I_call_the_various_denominations_of_bitcoins.3F|Satoshis(BTC/10^8)]] to be transfered&lt;br /&gt;
|8 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script length&lt;br /&gt;
|non negative integer&lt;br /&gt;
|1 - 9 bytes [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script / scriptPubKey&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;out-script length&amp;gt;-many bytes&lt;br /&gt;
|}&lt;br /&gt;
The output sets the conditions to release this bitcoin amount later. The sum of the output values of the first transaction is the value of the mined bitcoins for the block plus possible transactions fees of the other transactions in the block.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Script]]&lt;br /&gt;
* [[BTC Sender]] Transmit raw, hand-crafted transactions&lt;br /&gt;
* [[Raw Transactions]]&lt;br /&gt;
* [[Transaction Malleability]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
[[Category:Vocabulary]]&lt;br /&gt;
[[de:Transaktion]]&lt;br /&gt;
[[es:Transacción]]&lt;br /&gt;
[[pl:Transakcje]]&lt;/div&gt;</summary>
		<author><name>Rodasmith</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54001</id>
		<title>Transaction</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54001"/>
		<updated>2015-01-29T17:03:01Z</updated>

		<summary type="html">&lt;p&gt;Rodasmith: /* Input */ clarify that inputs are not just usable, they are completely used&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TxBinaryMap.png|thumb|right|Byte-map of Transaction with each type of TxIn and TxOut]]&lt;br /&gt;
A &#039;&#039;&#039;transaction&#039;&#039;&#039; is a signed section of data that is broadcast to the [[network]] and collected into [[block|blocks]]. It typically references previous transactions and dedicates a certain number of bitcoins from them to one or more new [[address|bitcoin addresses]]. It is not encrypted, so it is possible to browse and view any transaction to ever be collected into a block.&lt;br /&gt;
&lt;br /&gt;
A [[block chain browser]] is a site where every transaction included within the block chain can be viewed.  This is useful for seeing the technical details of transaction in action, and for verifying payments.&lt;br /&gt;
&lt;br /&gt;
=== general format of a Bitcoin transaction (inside a block) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Version no&lt;br /&gt;
|currently 1&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|In-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes &lt;br /&gt;
|-&lt;br /&gt;
|list of inputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_input_of_a_transaction_-_Txin|the first input of the first transaction is also called &amp;quot;coinbase&amp;quot; (its content was ignored in earlier versions)]]&lt;br /&gt;
|&amp;lt;in-counter&amp;gt;-many inputs&lt;br /&gt;
|-&lt;br /&gt;
|Out-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|list of outputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout|the outputs of the first transaction spend the mined bitcoins for the block]]&lt;br /&gt;
|&amp;lt;out-counter&amp;gt;-many outputs&lt;br /&gt;
|-&lt;br /&gt;
|lock_time&lt;br /&gt;
|if non-zero and sequence numbers are &amp;lt; 0xFFFFFFFF: block height or timestamp when transaction is final&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Principle example of a Bitcoin transaction with 1 input and 1 output only ===&lt;br /&gt;
&lt;br /&gt;
==== Data ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Input:&lt;br /&gt;
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6&lt;br /&gt;
Index: 0&lt;br /&gt;
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10&lt;br /&gt;
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
Value: 5000000000&lt;br /&gt;
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d&lt;br /&gt;
OP_EQUALVERIFY OP_CHECKSIG&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
&lt;br /&gt;
The input in this transaction imports 50 BTC from output #0 in transaction f5d8... Then the output sends 50 BTC to a Bitcoin address (expressed here in hexadecimal 4043... instead of the normal base58). When the recipient wants to spend this money, he will reference output #0 of this transaction in an input of his own transaction.&lt;br /&gt;
&lt;br /&gt;
===== Input =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;input&#039;&#039;&#039; is a reference to an output from a previous transaction. Multiple inputs are often listed in a transaction. All of the new transaction&#039;s input values (that is, the total coin value of the previous outputs referenced by the new transaction&#039;s inputs) are added up, and the total (less any transaction fee) is completely used by the outputs of the new transaction. &#039;&#039;&#039;Previous tx&#039;&#039;&#039; is a [[hash]] of a previous transaction. &#039;&#039;&#039;Index&#039;&#039;&#039; is the specific output in the referenced transaction. &#039;&#039;&#039;ScriptSig&#039;&#039;&#039; is the first half of a [[script]] (discussed in more detail later).&lt;br /&gt;
&lt;br /&gt;
The script contains two components, a signature and a public key. The public key must match the hash given in the script of the redeemed output. The public key is used to verify the redeemers signature, which is the second component. More precisely, the second component is an ECDSA signature over a hash of a simplified version of the transaction. It, combined with the public key, proves the transaction was created by the real owner of the address in question. Various flags define how the transaction is simplified and can be used to create different types of payment.&lt;br /&gt;
&lt;br /&gt;
===== Output =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;output&#039;&#039;&#039; contains instructions for sending bitcoins. &#039;&#039;&#039;Value&#039;&#039;&#039; is the number of Satoshi (1 BTC = 100,000,000 Satoshi) that this output will be worth when claimed. &#039;&#039;&#039;ScriptPubKey&#039;&#039;&#039; is the second half of a script (discussed later). There can be more than one output, and they share the combined value of the inputs. Because each output from one transaction can only ever be referenced once by an input of a subsequent transaction, the entire combined input value needs to be sent in an output if you don&#039;t want to lose it. If the input is worth 50 BTC but you only want to send 25 BTC, Bitcoin will create two outputs worth 25 BTC: one to the destination, and one back to you (known as &amp;quot;[[change]]&amp;quot;, though you send it to yourself). Any input bitcoins not redeemed in an output is considered a [[transaction fee]]; whoever generates the block will get it.&lt;br /&gt;
[[File:transaction.png|thumb|A sends 100 BTC to C and C generates 50 BTC. C sends 101 BTC to D, and he needs to send himself some change. D sends the 101 BTC to someone else, but they haven&#039;t redeemed it yet. Only D&#039;s output and C&#039;s change are capable of being spent in the current state.]]&lt;br /&gt;
&lt;br /&gt;
===== Verification =====&lt;br /&gt;
&lt;br /&gt;
To verify that inputs are authorized to collect the values of referenced outputs, Bitcoin uses a custom Forth-like [[script|scripting]] system. The input&#039;s scriptSig and the &#039;&#039;referenced&#039;&#039; output&#039;s scriptPubKey are evaluated (in that order), with scriptPubKey using the values left on the stack by scriptSig. The input is authorized if scriptPubKey returns true. Through the scripting system, the sender can create very complex conditions that people have to meet in order to claim the output&#039;s value. For example, it&#039;s possible to create an output that can be claimed by anyone without any authorization. It&#039;s also possible to require that an input be signed by ten different keys, or be redeemable with a password instead of a key.&lt;br /&gt;
&lt;br /&gt;
=== Types of Transaction ===&lt;br /&gt;
Bitcoin currently creates two different scriptSig/scriptPubKey pairs. These are described below.&lt;br /&gt;
&lt;br /&gt;
It is possible to design more complex types of transactions, and link them together into cryptographically enforced agreements. These are known as [[Contracts]].&lt;br /&gt;
&lt;br /&gt;
==== Pay-to-PubkeyHash ====&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;
A Bitcoin [[address]] is only a hash, so the sender can&#039;t provide a full public key in scriptPubKey. When redeeming coins that have been sent to a Bitcoin address, the recipient provides both the signature and the public key. The script verifies that the provided public key does hash to the hash in scriptPubKey, and then it also checks the signature against the public key.&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_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;
==== Pay-to-Script-Hash ====&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: OP_HASH160 &amp;lt;scriptHash&amp;gt; OP_EQUAL &lt;br /&gt;
 scriptSig: ..signatures... &amp;lt;serialized script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 m-of-n multi-signature transaction:&lt;br /&gt;
 scriptSig: 0 &amp;lt;sig1&amp;gt; ... &amp;lt;script&amp;gt;&lt;br /&gt;
 script: OP_m &amp;lt;pubKey1&amp;gt; ... OP_n OP_CHECKMULTISIG&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P2SH addresses were created with the motivation of moving &amp;quot;the responsibility for supplying the conditions to redeem a transaction from the sender of the funds to the redeemer. They allow the sender to fund an arbitrary transaction, no matter how complicated, using a 20-byte hash&amp;quot;[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#motivation 1]. Pay-to-Pubkey-hash addresses are similarly a 20-byte hash of the public key. &lt;br /&gt;
&lt;br /&gt;
Pay-to-script-hash provides a means for complicated transactions, unlike the Pay-to-pubkey-hash, which has a specific definition for scriptPubKey, and scriptSig. The specification places no limitations on the script, and hence absolutely any contract can be funded using these addresses. &lt;br /&gt;
&lt;br /&gt;
The scriptPubKey in the funding transaction is script which ensures that the script supplied in the redeeming transaction hashes to the script used to create the address. &lt;br /&gt;
&lt;br /&gt;
In the scriptSig above, &#039;signatures&#039; refers to any script which is sufficient to satisfy the following serialized script. &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;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 OP_CHECKMULTISIG &lt;br /&gt;
| Only the scriptSig is used.&lt;br /&gt;
|-&lt;br /&gt;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 &lt;br /&gt;
| OP_CHECKMULTISIG &lt;br /&gt;
| Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
| true&lt;br /&gt;
| Empty&lt;br /&gt;
| Signatures validated in the order of the keys in the script.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[BIP 0016]]&lt;br /&gt;
&lt;br /&gt;
==== Generation ====&lt;br /&gt;
&lt;br /&gt;
Generations have a single input, and this input has a &amp;quot;coinbase&amp;quot; parameter instead of a scriptSig. The data in &amp;quot;coinbase&amp;quot; can be anything; it isn&#039;t used. Bitcoin puts the current compact-format [[target]] and the arbitrary-precision &amp;quot;extraNonce&amp;quot; number there, which increments every time the Nonce field in the [[block_hashing_algorithm|block header]] overflows. Outputs can be anything, but Bitcoin creates one exactly like an IP address transaction.&lt;br /&gt;
The extranonce contributes to enlarge the domain for the proof of work function. Miners can easily modify nonce (4byte), timestamp and extranonce (2 to 100bytes).&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each input of a transaction - Txin ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Previous Transaction hash &lt;br /&gt;
| doubled [[Wikipedia:SHA-256|SHA256]]-[[hash|hashed]] of a (previous) to-be-used transaction&lt;br /&gt;
|32 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Previous Txout-index&lt;br /&gt;
| non negative integer indexing an output of the to-be-used transaction&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script length&lt;br /&gt;
|non negative integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script / scriptSig&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;in-script length&amp;gt;-many bytes&lt;br /&gt;
|-&lt;br /&gt;
|sequence_no&lt;br /&gt;
|normally 0xFFFFFFFF; irrelevant unless transaction&#039;s lock_time is &amp;gt; 0&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The input sufficiently describes where and how to get the bitcoin amout to be redeemed.&lt;br /&gt;
If it is the (only) input of the first transaction of a block, it is called the generation transaction input and its content completely ignored. (Historically the Previous Transaction hash is 0 and the Previous Txout-index is -1.)&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each output of a transaction - Txout ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|non negative integer giving the number of [[FAQ#What_do_I_call_the_various_denominations_of_bitcoins.3F|Satoshis(BTC/10^8)]] to be transfered&lt;br /&gt;
|8 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script length&lt;br /&gt;
|non negative integer&lt;br /&gt;
|1 - 9 bytes [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script / scriptPubKey&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;out-script length&amp;gt;-many bytes&lt;br /&gt;
|}&lt;br /&gt;
The output sets the conditions to release this bitcoin amount later. The sum of the output values of the first transaction is the value of the mined bitcoins for the block plus possible transactions fees of the other transactions in the block.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Script]]&lt;br /&gt;
* [[BTC Sender]] Transmit raw, hand-crafted transactions&lt;br /&gt;
* [[Raw Transactions]]&lt;br /&gt;
* [[Transaction Malleability]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
[[Category:Vocabulary]]&lt;br /&gt;
[[de:Transaktion]]&lt;br /&gt;
[[es:Transacción]]&lt;br /&gt;
[[pl:Transakcje]]&lt;/div&gt;</summary>
		<author><name>Rodasmith</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54000</id>
		<title>Transaction</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Transaction&amp;diff=54000"/>
		<updated>2015-01-29T16:58:54Z</updated>

		<summary type="html">&lt;p&gt;Rodasmith: /* Input */ clarify that the usable value is the total of inputs, i.e. prior outputs rather than total of new outputs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:TxBinaryMap.png|thumb|right|Byte-map of Transaction with each type of TxIn and TxOut]]&lt;br /&gt;
A &#039;&#039;&#039;transaction&#039;&#039;&#039; is a signed section of data that is broadcast to the [[network]] and collected into [[block|blocks]]. It typically references previous transactions and dedicates a certain number of bitcoins from them to one or more new [[address|bitcoin addresses]]. It is not encrypted, so it is possible to browse and view any transaction to ever be collected into a block.&lt;br /&gt;
&lt;br /&gt;
A [[block chain browser]] is a site where every transaction included within the block chain can be viewed.  This is useful for seeing the technical details of transaction in action, and for verifying payments.&lt;br /&gt;
&lt;br /&gt;
=== general format of a Bitcoin transaction (inside a block) ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Version no&lt;br /&gt;
|currently 1&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|In-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes &lt;br /&gt;
|-&lt;br /&gt;
|list of inputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_input_of_a_transaction_-_Txin|the first input of the first transaction is also called &amp;quot;coinbase&amp;quot; (its content was ignored in earlier versions)]]&lt;br /&gt;
|&amp;lt;in-counter&amp;gt;-many inputs&lt;br /&gt;
|-&lt;br /&gt;
|Out-counter&lt;br /&gt;
| positive integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
| 1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|list of outputs&lt;br /&gt;
|[[Transaction#general_format_.28inside_a_block.29_of_each_output_of_a_transaction_-_Txout|the outputs of the first transaction spend the mined bitcoins for the block]]&lt;br /&gt;
|&amp;lt;out-counter&amp;gt;-many outputs&lt;br /&gt;
|-&lt;br /&gt;
|lock_time&lt;br /&gt;
|if non-zero and sequence numbers are &amp;lt; 0xFFFFFFFF: block height or timestamp when transaction is final&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Principle example of a Bitcoin transaction with 1 input and 1 output only ===&lt;br /&gt;
&lt;br /&gt;
==== Data ====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;Input:&lt;br /&gt;
Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6&lt;br /&gt;
Index: 0&lt;br /&gt;
scriptSig: 304502206e21798a42fae0e854281abd38bacd1aeed3ee3738d9e1446618c4571d10&lt;br /&gt;
90db022100e2ac980643b0b82c0e88ffdfec6b64e3e6ba35e7ba5fdd7d5d6cc8d25c6b241501&lt;br /&gt;
&lt;br /&gt;
Output:&lt;br /&gt;
Value: 5000000000&lt;br /&gt;
scriptPubKey: OP_DUP OP_HASH160 404371705fa9bd789a2fcd52d2c580b65d35549d&lt;br /&gt;
OP_EQUALVERIFY OP_CHECKSIG&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Explanation ====&lt;br /&gt;
&lt;br /&gt;
The input in this transaction imports 50 BTC from output #0 in transaction f5d8... Then the output sends 50 BTC to a Bitcoin address (expressed here in hexadecimal 4043... instead of the normal base58). When the recipient wants to spend this money, he will reference output #0 of this transaction in an input of his own transaction.&lt;br /&gt;
&lt;br /&gt;
===== Input =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;input&#039;&#039;&#039; is a reference to an output from a previous transaction. Multiple inputs are often listed in a transaction. All of the new transaction&#039;s input values (that is, the total coin value of the previous outputs referenced by the new transaction&#039;s inputs) are added up, and the total is usable in the outputs of the new transaction. &#039;&#039;&#039;Previous tx&#039;&#039;&#039; is a [[hash]] of a previous transaction. &#039;&#039;&#039;Index&#039;&#039;&#039; is the specific output in the referenced transaction. &#039;&#039;&#039;ScriptSig&#039;&#039;&#039; is the first half of a [[script]] (discussed in more detail later).&lt;br /&gt;
&lt;br /&gt;
The script contains two components, a signature and a public key. The public key must match the hash given in the script of the redeemed output. The public key is used to verify the redeemers signature, which is the second component. More precisely, the second component is an ECDSA signature over a hash of a simplified version of the transaction. It, combined with the public key, proves the transaction was created by the real owner of the address in question. Various flags define how the transaction is simplified and can be used to create different types of payment.&lt;br /&gt;
&lt;br /&gt;
===== Output =====&lt;br /&gt;
&lt;br /&gt;
An &#039;&#039;&#039;output&#039;&#039;&#039; contains instructions for sending bitcoins. &#039;&#039;&#039;Value&#039;&#039;&#039; is the number of Satoshi (1 BTC = 100,000,000 Satoshi) that this output will be worth when claimed. &#039;&#039;&#039;ScriptPubKey&#039;&#039;&#039; is the second half of a script (discussed later). There can be more than one output, and they share the combined value of the inputs. Because each output from one transaction can only ever be referenced once by an input of a subsequent transaction, the entire combined input value needs to be sent in an output if you don&#039;t want to lose it. If the input is worth 50 BTC but you only want to send 25 BTC, Bitcoin will create two outputs worth 25 BTC: one to the destination, and one back to you (known as &amp;quot;[[change]]&amp;quot;, though you send it to yourself). Any input bitcoins not redeemed in an output is considered a [[transaction fee]]; whoever generates the block will get it.&lt;br /&gt;
[[File:transaction.png|thumb|A sends 100 BTC to C and C generates 50 BTC. C sends 101 BTC to D, and he needs to send himself some change. D sends the 101 BTC to someone else, but they haven&#039;t redeemed it yet. Only D&#039;s output and C&#039;s change are capable of being spent in the current state.]]&lt;br /&gt;
&lt;br /&gt;
===== Verification =====&lt;br /&gt;
&lt;br /&gt;
To verify that inputs are authorized to collect the values of referenced outputs, Bitcoin uses a custom Forth-like [[script|scripting]] system. The input&#039;s scriptSig and the &#039;&#039;referenced&#039;&#039; output&#039;s scriptPubKey are evaluated (in that order), with scriptPubKey using the values left on the stack by scriptSig. The input is authorized if scriptPubKey returns true. Through the scripting system, the sender can create very complex conditions that people have to meet in order to claim the output&#039;s value. For example, it&#039;s possible to create an output that can be claimed by anyone without any authorization. It&#039;s also possible to require that an input be signed by ten different keys, or be redeemable with a password instead of a key.&lt;br /&gt;
&lt;br /&gt;
=== Types of Transaction ===&lt;br /&gt;
Bitcoin currently creates two different scriptSig/scriptPubKey pairs. These are described below.&lt;br /&gt;
&lt;br /&gt;
It is possible to design more complex types of transactions, and link them together into cryptographically enforced agreements. These are known as [[Contracts]].&lt;br /&gt;
&lt;br /&gt;
==== Pay-to-PubkeyHash ====&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;
A Bitcoin [[address]] is only a hash, so the sender can&#039;t provide a full public key in scriptPubKey. When redeeming coins that have been sent to a Bitcoin address, the recipient provides both the signature and the public key. The script verifies that the provided public key does hash to the hash in scriptPubKey, and then it also checks the signature against the public key.&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_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;
==== Pay-to-Script-Hash ====&lt;br /&gt;
&lt;br /&gt;
 scriptPubKey: OP_HASH160 &amp;lt;scriptHash&amp;gt; OP_EQUAL &lt;br /&gt;
 scriptSig: ..signatures... &amp;lt;serialized script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 m-of-n multi-signature transaction:&lt;br /&gt;
 scriptSig: 0 &amp;lt;sig1&amp;gt; ... &amp;lt;script&amp;gt;&lt;br /&gt;
 script: OP_m &amp;lt;pubKey1&amp;gt; ... OP_n OP_CHECKMULTISIG&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
P2SH addresses were created with the motivation of moving &amp;quot;the responsibility for supplying the conditions to redeem a transaction from the sender of the funds to the redeemer. They allow the sender to fund an arbitrary transaction, no matter how complicated, using a 20-byte hash&amp;quot;[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki#motivation 1]. Pay-to-Pubkey-hash addresses are similarly a 20-byte hash of the public key. &lt;br /&gt;
&lt;br /&gt;
Pay-to-script-hash provides a means for complicated transactions, unlike the Pay-to-pubkey-hash, which has a specific definition for scriptPubKey, and scriptSig. The specification places no limitations on the script, and hence absolutely any contract can be funded using these addresses. &lt;br /&gt;
&lt;br /&gt;
The scriptPubKey in the funding transaction is script which ensures that the script supplied in the redeeming transaction hashes to the script used to create the address. &lt;br /&gt;
&lt;br /&gt;
In the scriptSig above, &#039;signatures&#039; refers to any script which is sufficient to satisfy the following serialized script. &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;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 OP_CHECKMULTISIG &lt;br /&gt;
| Only the scriptSig is used.&lt;br /&gt;
|-&lt;br /&gt;
| 0 &amp;lt;sig1&amp;gt; &amp;lt;sig2&amp;gt; OP_2 &amp;lt;pubKey1&amp;gt; &amp;lt;pubKey2&amp;gt; &amp;lt;pubKey3&amp;gt; OP_3 &lt;br /&gt;
| OP_CHECKMULTISIG &lt;br /&gt;
| Constants are added to the stack.&lt;br /&gt;
|-&lt;br /&gt;
| true&lt;br /&gt;
| Empty&lt;br /&gt;
| Signatures validated in the order of the keys in the script.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
See also [[BIP 0016]]&lt;br /&gt;
&lt;br /&gt;
==== Generation ====&lt;br /&gt;
&lt;br /&gt;
Generations have a single input, and this input has a &amp;quot;coinbase&amp;quot; parameter instead of a scriptSig. The data in &amp;quot;coinbase&amp;quot; can be anything; it isn&#039;t used. Bitcoin puts the current compact-format [[target]] and the arbitrary-precision &amp;quot;extraNonce&amp;quot; number there, which increments every time the Nonce field in the [[block_hashing_algorithm|block header]] overflows. Outputs can be anything, but Bitcoin creates one exactly like an IP address transaction.&lt;br /&gt;
The extranonce contributes to enlarge the domain for the proof of work function. Miners can easily modify nonce (4byte), timestamp and extranonce (2 to 100bytes).&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each input of a transaction - Txin ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|Previous Transaction hash &lt;br /&gt;
| doubled [[Wikipedia:SHA-256|SHA256]]-[[hash|hashed]] of a (previous) to-be-used transaction&lt;br /&gt;
|32 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Previous Txout-index&lt;br /&gt;
| non negative integer indexing an output of the to-be-used transaction&lt;br /&gt;
|4 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script length&lt;br /&gt;
|non negative integer [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|1 - 9 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txin-script / scriptSig&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;in-script length&amp;gt;-many bytes&lt;br /&gt;
|-&lt;br /&gt;
|sequence_no&lt;br /&gt;
|normally 0xFFFFFFFF; irrelevant unless transaction&#039;s lock_time is &amp;gt; 0&lt;br /&gt;
|4 bytes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
The input sufficiently describes where and how to get the bitcoin amout to be redeemed.&lt;br /&gt;
If it is the (only) input of the first transaction of a block, it is called the generation transaction input and its content completely ignored. (Historically the Previous Transaction hash is 0 and the Previous Txout-index is -1.)&lt;br /&gt;
&lt;br /&gt;
=== general format (inside a block) of each output of a transaction - Txout ===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Field&lt;br /&gt;
! Description&lt;br /&gt;
! Size&lt;br /&gt;
|-&lt;br /&gt;
|value&lt;br /&gt;
|non negative integer giving the number of [[FAQ#What_do_I_call_the_various_denominations_of_bitcoins.3F|Satoshis(BTC/10^8)]] to be transfered&lt;br /&gt;
|8 bytes&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script length&lt;br /&gt;
|non negative integer&lt;br /&gt;
|1 - 9 bytes [[ Protocol_specification#Variable_length_integer|VI = VarInt]]&lt;br /&gt;
|-&lt;br /&gt;
|Txout-script / scriptPubKey&lt;br /&gt;
|[[Script]]&lt;br /&gt;
|&amp;lt;out-script length&amp;gt;-many bytes&lt;br /&gt;
|}&lt;br /&gt;
The output sets the conditions to release this bitcoin amount later. The sum of the output values of the first transaction is the value of the mined bitcoins for the block plus possible transactions fees of the other transactions in the block.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Script]]&lt;br /&gt;
* [[BTC Sender]] Transmit raw, hand-crafted transactions&lt;br /&gt;
* [[Raw Transactions]]&lt;br /&gt;
* [[Transaction Malleability]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;br /&gt;
[[Category:Vocabulary]]&lt;br /&gt;
[[de:Transaktion]]&lt;br /&gt;
[[es:Transacción]]&lt;br /&gt;
[[pl:Transakcje]]&lt;/div&gt;</summary>
		<author><name>Rodasmith</name></author>
	</entry>
</feed>