<?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=Aakselrod</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=Aakselrod"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Aakselrod"/>
	<updated>2026-05-22T02:45:29Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Off-Chain_Betting&amp;diff=44636</id>
		<title>Off-Chain Betting</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Off-Chain_Betting&amp;diff=44636"/>
		<updated>2014-02-25T21:19:27Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: Created page with &amp;quot;This work builds on the scheme for off-chain payments with two-phase commit.  == Example ==  Alice and Bob would like to make a bet about whether a bi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This work builds on the scheme for [[User:Aakselrod/Draft|off-chain payments with two-phase commit]].&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
&lt;br /&gt;
Alice and Bob would like to make a bet about whether a bitcoin is worth more or less than $500 in two weeks.  Carole commits to announcing the result of the event:  she signs and publishes a statement that if a bitcoin is worth at least $500 in two weeks, she&#039;ll reveal the preimage to Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt; and if it&#039;s worth less than $500 in two weeks, she&#039;ll reveal the preimage to Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alice and Bob create a &amp;quot;bet channel&amp;quot; output together:  let&#039;s say each contributes .5 BTC to the output, which must be signed by both Alice and Bob to be spent.  The refund transaction, signed by both of them, has an nLockTime of one year in the future.&lt;br /&gt;
&lt;br /&gt;
Alice would like to bet .1 BTC that a bitcoin will be worth at least $500, and Bob would like to bet .1 BTC that a bitcoin will be worth less than $500 in 2 weeks.  Alice and Bob sign two versions of a transaction with nLockTime earlier (say, by a day) than the most recent bet (or the refund transaction, if there&#039;s no bets on this channel) with outputs as follows:&lt;br /&gt;
&lt;br /&gt;
Version I.&lt;br /&gt;
 1. .6 BTC to SHA256 Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIG&lt;br /&gt;
 2. .4 BTC to SHA256 Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIG&lt;br /&gt;
&lt;br /&gt;
Version II.&lt;br /&gt;
 1. .4 BTC to SHA256 Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIG&lt;br /&gt;
 2. .6 BTC to SHA256 Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIG&lt;br /&gt;
&lt;br /&gt;
If a bitcoin is worth at least $500 in two weeks, Carole reveals the preimage to Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt;.  The only transaction version from which it&#039;s possible for Alice and Bob to get their money back is I.  If a bitcoin is worth less than $500, the opposite is true.&lt;br /&gt;
&lt;br /&gt;
If Alice wins the bet, Bob&#039;s only choice is to concede.  If Bob were to try to publish transaction version II, he won&#039;t be able to redeem his output as he doesn&#039;t know the preimage to Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;.  Cheating by Carole is easily proven publicly by publishing the preimages of both Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt; and Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
After the winning preimage is published, the channel can be reused for another bet.&lt;br /&gt;
&lt;br /&gt;
There are multiple variations on this theme:  for example, you can make do with only one transaction, you can have bets with more than two outcomes, etc.  You can also adjust the amount of the bet as time goes on, as long as you&#039;re betting on the same event and in the same direction, in the same way as you can adjust payment channel allocations back and forth.&lt;br /&gt;
&lt;br /&gt;
This construct can be used for bets on any subject providing there&#039;s an oracle or arbitrator willing to perform Carole&#039;s job.  The oracle would need to publish all events it&#039;s willing to adjudicate, and upon the event&#039;s conclusion, to reveal the preimage corresponding with the event&#039;s outcome.&lt;br /&gt;
&lt;br /&gt;
In a friend-to-friend network, it becomes possible to hedge exchange risk (or any other risk).  As an example, Overstock.com would like to hedge the risk that Bitcoin prices will go down before they can pay their suppliers for merchandise.  Overstock would offer several counterparties similar bets based on Coindesk&#039;s price index.&lt;br /&gt;
&lt;br /&gt;
Coindesk could publish on their website or via an API, daily, signed sets of preimages for future announcements.  For example, they publish a set of preimages for two weeks in advance:&lt;br /&gt;
&lt;br /&gt;
* If a bitcoin is worth between $0 and $100, reveal the preimage to Hash&amp;lt;sub&amp;gt;A&amp;lt;/sub&amp;gt;&lt;br /&gt;
* If a bitcoin is worth between $100 and $200, reveal the preimage to Hash&amp;lt;sub&amp;gt;B&amp;lt;/sub&amp;gt;&lt;br /&gt;
* If a bitcoin is worth between $200 and $300, reveal the preimage to Hash&amp;lt;sub&amp;gt;C&amp;lt;/sub&amp;gt;&lt;br /&gt;
* And so on&lt;br /&gt;
&lt;br /&gt;
Overstock would make bets with its counterparties similar to above that the price will be lower (like being long a binary put option or short a binary call option).  Its counterparties, each with its own internal order book, could then hedge that risk with other counterparties, which maybe would like to get money if bitcoin prices go up (like being short a binary put option or long a binary call option).  The end result is a distributed derivatives market based on Coindesk&#039;s price index.  Competing price indexes such as the Winkdex could also be used.&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=36093</id>
		<title>User:Aakselrod/Draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=36093"/>
		<updated>2013-03-12T17:18:30Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal Background and Summary ==&lt;br /&gt;
&lt;br /&gt;
The basic concept of a peer-to-peer payment network which allows nodes to transact off the blockchain has been proposed before.  Proponents see multiple advantages such as instant payments which require no additional confirmations, higher scalability due to individual payments taking place off the blockchain, and feasibility of widespread micropayments.  The proposals use [[Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|micropayment channels]]&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=91732.0&amp;lt;/ref&amp;gt; or other multi-signature transaction-based shared property&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=94674.0&amp;lt;/ref&amp;gt; schemes between payers, payees, and intermediaries in order to allow such transactions.&lt;br /&gt;
&lt;br /&gt;
For example, if Alice is a customer and Bob is a merchant, Alice may have a micropayment channel open to Carol, her payment processor, who may have a channel open to Dan, Bob&#039;s payment processor, which also has a channel open to Bob.  Alice would increment the allocation going to Carol through her channel by the amount she wants to pay Bob, and Carol and Dan would do the same down the line.  Bob would then be paid instantly, and none of this would hit the blockchain except as part of aggregate settlement transactions closing the micropayment channels.&lt;br /&gt;
&lt;br /&gt;
This proposal aims to bring closer the realization of such a network by discussing the following solutions:&lt;br /&gt;
&lt;br /&gt;
* Additional scalability of micropayment channel setup transactions by having intermediaries combine them.&lt;br /&gt;
* Two-phase commit through multiple chained micropayment channels, reducing the risk that an intermediary will accept a payment but not forward it on and enabling two-party escrowed payments through the payment network.&lt;br /&gt;
* Extraction of routing and reputation information from the blockchain and memory pool as a side effect of the way micropayment channels are opened and closed.&lt;br /&gt;
&lt;br /&gt;
The proposal will also discuss possible side effects of its adoption, both positive and negative.&lt;br /&gt;
&lt;br /&gt;
Other potential off-chain payment solutions have also been proposed&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=146307.0&amp;lt;/ref&amp;gt; using different mechanisms.  These potential solutions are out of scope for this proposal, which focuses on chained micropayment channels between payers, payees and intermediaries.  Other types of solutions may have the potential to be combined with the solution detailed in this proposal.&lt;br /&gt;
&lt;br /&gt;
== Micropayment Channels ==&lt;br /&gt;
&lt;br /&gt;
The original concept of the micropayment channel is explained well on the [[Contracts]] page in example 7, referenced above.  Unlike the concept of shared property, these micropayment channels are unidirectional and must be created in pairs for bidirectional payment flow.&lt;br /&gt;
&lt;br /&gt;
Transaction replacement is used in this scheme to prevent denial of service (locking up money, potentially permanently depending on whether it&#039;s for ransom or not) by the receiving side of a micropayment channel.  Nodes running 0.8 and above treat non-final transactions as non-standard.  This allows the recipient a high degree of confidence that a non-final timelocked transaction won&#039;t be stuck in the memory pool of most nodes and a final transaction meant to replace it will be mined first.  While this is not the original design for transaction replacement, it should work similarly for many use cases.&lt;br /&gt;
&lt;br /&gt;
To work with the current state of the network, the format of the T2 transaction defined in the scheme above must be changed slightly.  The initial version of T2 would still be created the same way (potentially with a longer lifetime than just one day); however, subsequent versions of T2 would not have nLockTime set and would have a sequence number of UINT_MAX.  The micropayment channel recipient does not sign or broadcast any intermediate versions of T2 until the channel is ready to be closed.&lt;br /&gt;
&lt;br /&gt;
Two other types of proposals have been suggested to discourage and/or make expensive such denial of service attacks by either side of a micropayment channel:  risk deposits&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=118418.msg1271858#msg1271858&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=75481.0&amp;lt;/ref&amp;gt; and reputation systems&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=134827.0&amp;lt;/ref&amp;gt;.  This proposal can use both techniques to help reduce the risk.&lt;br /&gt;
&lt;br /&gt;
== Two-Phase Commit ==&lt;br /&gt;
&lt;br /&gt;
In order to allow two-phase commit for chained micropayment channels, the original scheme for is modified slightly again with a construct similar to the [[Contracts#Example_5:_Trading_across_chains|trading across chains]] scheme.  Specifically, the two T2 outputs would be in a format similar to the following:&lt;br /&gt;
&lt;br /&gt;
 1. SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;sender&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;recipient&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
and the input scripts redeeming those outputs would be in a format similar to the following:&lt;br /&gt;
&lt;br /&gt;
 1. SIG&amp;lt;sub&amp;gt;sender&amp;lt;/sub&amp;gt; m&lt;br /&gt;
 2. SIG&amp;lt;sub&amp;gt;recipient&amp;lt;/sub&amp;gt; m&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; is a number of at least 256 bits agreed to by a payer and payee in a payment which is chained through multiple micropayment channels.  &amp;lt;code&amp;gt;Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;&amp;lt;/code&amp;gt; is then called the commit hash for the off-chain payment which goes through this chain of micropayment channels.  An example follows:&lt;br /&gt;
&lt;br /&gt;
Alice would like to pay Bob 10 mBTC.  Alice does not have a micropayment channel to Bob.  However, Alice has a micropayment channel to Carol, and Carol has a micropayment channel to Bob.&lt;br /&gt;
&lt;br /&gt;
Bob generates a 256-bit number &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; and gives its SHA256 hash, the commit hash for the payment, to Alice.  Alice has previously signed and sent to Carol a transaction T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; which contains an input from her and Carol&#039;s T1&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; and two outputs:&lt;br /&gt;
&lt;br /&gt;
 1. 90 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 10 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; is a hash from a previous payment which has gone through a similar process.  Similarly, Carol has previously signed and sent to Bob a transaction T2&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; which contains an input from her and Bob&#039;s T1&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; and two outputs:&lt;br /&gt;
&lt;br /&gt;
 1. 900 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 100 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
where, again, &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; is a hash from a previous payment, which could be different than the &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; in T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alice requests for Carol to send 10 mBTC to Bob on her behalf.  When she requests this, she also signs and sends to Carol a new version of T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
 1. 89.99 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 10.01 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
Carol will then notify Bob of an incoming payment and signs/sends to Bob a new version of T2&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
 1. 899.99 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 100.01 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
When Bob sees that a payment has come through, he broadcasts &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;, the preimage of the payment&#039;s commit hash, to Alice and Carol, committing the payment.  Bob can&#039;t redeem his output without revealing &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;, so he has incentive not to keep it from the other parties.  Risk deposits can be structured in such a way that the incentive to broadcast &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; in a successful transaction should outweigh the incentive not to broadcast.&lt;br /&gt;
&lt;br /&gt;
Additional applications can be considered as well.  For an escrow transaction, as an example, Bob can generate a signed invoice for Alice to pay and its hash is &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt;.  Alice would generate a cryptographically strong random number &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;.  Alice would then concatenate the two, &amp;lt;code&amp;gt;m = h . r&amp;lt;/code&amp;gt;, and hash &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;.  Then &amp;lt;code&amp;gt;Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt;&amp;lt;/code&amp;gt; is the commit hash for the transaction which Alice would give to Bob so he knows what payment to expect for the invoice.  Alice can send the payment&#039;s first phase, which would lock in funds through a chain of micropayment channels, wait for Bob to deliver the goods, and give Bob &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;.  In this way, the payment is linked to the invoice.&lt;br /&gt;
&lt;br /&gt;
For a gambling transaction similar to SatoshiDice, where Bob is a SatoshiDice-like gambling site, Alice can create a cryptographically strong random &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;, which is the preimage to the commit hash.  Alice would send a payment to Bob and immediately commits it by broadcasting &amp;lt;code&amp;gt;r&amp;lt;/code&amp;gt;.  Bob would then concatenate &amp;lt;code&amp;gt;w . r&amp;lt;/code&amp;gt;, where &amp;lt;code&amp;gt;w&amp;lt;/code&amp;gt; is the hash/string/etc. for the time period during which the transaction occurs, and hash it to get the number used to determine whether the play wins or not.&lt;br /&gt;
&lt;br /&gt;
The preimage to the commit hash can be used to carry all sorts of varied information; however, in the event of large amounts of data, the preimage should itself be a hash of that data, potentially concatenated with a random number as above.  This reduces the amount of data to transmit across the payment channel and the amount of data potentially committed to the block chain should one of the recipients in the chain of micropayment channels decide to settle the channel with that commit hash.&lt;br /&gt;
&lt;br /&gt;
Alice, Bob and Carol are nodes in a directional graph, while the micropayment channels between them are edges.  It&#039;s easy to see how to extend such a chain to more than two micropayment channels by adding more intermediaries.  Regardless of the number of intermediaries between the payer and payee, the payment can be proposed and committed almost instantly with no impact on the block chain and no possibility of double spend.&lt;br /&gt;
&lt;br /&gt;
Fees could be charged for two separate actions:  establishment of a micropayment channel, in order to offset the transaction fees for getting the contract in the block chain, and each payment, in order to offset operating costs and cost of capital to lock up money in a payment flow until it&#039;s committed or rolled back.&lt;br /&gt;
&lt;br /&gt;
One can also imagine a long chain in which, for some reason (possibly malice), a payment is committed and an intermediary node X doesn&#039;t receive the broadcast of the preimage of that payment&#039;s commitment hash.  If that occurs and another node Y broadcasts a T2&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt; transaction with that payment&#039;s commitment hash in an output to the Bitcoin network, node X can immediately broadcast its T2&amp;lt;sub&amp;gt;X&amp;lt;/sub&amp;gt; transaction with the same commitment hash.  Then, when node Y or the peer node for its micropayment channel redeems their output from the T2&amp;lt;sub&amp;gt;Y&amp;lt;/sub&amp;gt; transaction, or X&#039;s peer node redeems its output from the T2&amp;lt;sub&amp;gt;X&amp;lt;/sub&amp;gt; transaction, X can redeem its output.&lt;br /&gt;
&lt;br /&gt;
== Routing and Reputation in the Block Chain ==&lt;br /&gt;
&lt;br /&gt;
In the micropayment channel scheme, T1 is broadcast and committed to the block chain to create the channel.  In this proposal&#039;s modified scheme, T2, which redeems T1&#039;s only output, is not broadcast until the channel is to be closed and settled.  Thus, routing and reputation information exists on the block chain.  It is prunable as all transaction outputs are redeemable and should be redeemed; however, intermediate nodes which need to route payments through the network should keep the entire block chain in order to be able to extract routing and especially reputation information from it.&lt;br /&gt;
&lt;br /&gt;
There would exist a set of participant public keys which have participated in micropayment channels before.  Any transactions in the format of T1 that are not yet redeemed by a transaction of format T2 may be considered open channels.  In most cases, the directionality of the micropayment channel should be identifiable by the amounts contributed by each key:  the key which contributes more is likely to be the sender, and the key which contributes less is likely to be the recipient.  This should be the case even when risk deposits are used between sender and recipient.&lt;br /&gt;
&lt;br /&gt;
In addition, T1 transactions whose outputs haven&#039;t been redeemed for too long, or T2 transactions committed to the block chain whose outputs haven&#039;t been redeemed could be considered negative reputation information.  Successful transactions can be considered positive reputation information.  A PageRank-style iterative convergence algorithm can establish both a web of trust and a routing graph showing trust/channel relationships between various intermediaries.&lt;br /&gt;
&lt;br /&gt;
When deciding to find a new peer with which to maintain open micropayment channels, various strategies can be considered based on both the reputation and routing information presented in the block chain.  A node could choose to peer with more central intermediaries to make it cheap to send funds through that node; a node could also choose to peer with underserved parts of the graph (detectable by frequency of establishment/closure of channels to that part of the graph) in order to make money by making transmission to that part more efficient.&lt;br /&gt;
&lt;br /&gt;
Using the block chain for extracting routing and reputation information does not preclude using external sources of routing and reputation information or using other methods of storing/extracting such information from the block chain.&lt;br /&gt;
&lt;br /&gt;
== Potential Optimizations and Side Effects ==&lt;br /&gt;
&lt;br /&gt;
It is possible to make most users&#039; nodes on such a peer-to-peer network function similarly to SPV nodes on the main Bitcoin network.  The end user nodes would manually decide to establish a channel with a small set of intermediaries.  There would be no or minimal trust involved due to the structure of the micropayment channel and the ability to withhold commitment of a payment until the payer is sure it has been routed correctly to the payee.  Such users would benefit from having an SPV-style connection to the peer-to-peer network in order to open and close micropayment channels with the manually chosen set of intermediary nodes.&lt;br /&gt;
&lt;br /&gt;
Intermediary nodes could be run by hobbyists/enthusiasts who want to make money by supporting the network, as well as businesses which desire reduced transaction costs on their own inbound and outbound payments and profit from processing others&#039; payment flow.  Such intermediaries would be well-served by running full nodes on the Bitcoin network in order to keep up-to-date track of routing information, as well as to have access to all historical information for optimization and reputation purposes.&lt;br /&gt;
&lt;br /&gt;
Intermediaries on the receiving side can combine T1 transactions from multiple micropayment channels&#039; senders in order to reduce transaction fees.  For example, if Alice and multiple parties like her would each like to establish a micropayment channel to Carol, each would use one of her unspent transaction outputs to sign an output using &amp;lt;code&amp;gt;SIGHASH_SINGLE | SIGHASH_ANYONECANPAY&amp;lt;/code&amp;gt;.  Alice&#039;s output would be the value of Alice&#039;s input PLUS the value of whatever risk deposit Carol is willing to put in.  Carol would then combine all of the inputs and outputs, add her own inputs to make up the value of the risk deposits plus fees to get the transaction included in a block, and broadcast it.  Once the transaction has enough confirmations, Carol can begin allowing payments to flow through the newly established channels.&lt;br /&gt;
&lt;br /&gt;
A functioning network would serve to balance costs, efficiency and decentralization.  The longer a chain of micropayment channels a payment must go through, the more funds it locks up on its way temporarily and the more fees it would need to pay.  For escrow transactions where the funds are locked up for a longer time, it may be more cost-effective to perform the transaction on the block chain, depending on the transaction fees.  However, longer micropayment channel chains mean more decentralization.  One can imagine a network graph with well-capitalized, well-connected nodes run by large corporations providing cheaper, more centralized payment flow while niche and local nodes provide less centralized payment flow which trades cost or distant node reachability for decentralization and privacy.&lt;br /&gt;
&lt;br /&gt;
A network such as this may encourage intermediaries and businesses to run full nodes on the Bitcoin network, and allows them to collect fees for processing payments without having to mine.  This may help fund full nodes on the Bitcoin network by allowing them to charge off-chain clearing fees, whereas miners charge settlement fees for committing transactions to the block chain.&lt;br /&gt;
&lt;br /&gt;
A network such as this may increase the exchange rate of bitcoins against other currencies as it would lock up bitcoins in micropayment channels in order to provide payment flow, thus reducing the number of available bitcoins to sell for other currencies.  Early adopters can additionally profit by using their bitcoin capital to provide payment flow.  Merchants using existing transaction processors would be able to benefit from the network without needing to make any changes, as long as the transaction processors establish a connection to the network.&lt;br /&gt;
&lt;br /&gt;
As proposed by cjp&amp;lt;ref&amp;gt;http://www.ultimatestunts.nl/bitcoin/ripple_bitcoin_draft_2.pdf&amp;lt;/ref&amp;gt;, path splitting is a viable option to make more efficient use of micropayment channels that are too narrow to allow large payments through them.  However, this may increase Bitcoin transaction fees for intermediary micropayment channel re-establishment, making large payments more economical to send using Bitcoin directly.  The decision should be made by the payer and payee based on cost and whether instant payment is required or waiting for confirmations is acceptable.&lt;br /&gt;
&lt;br /&gt;
Widespread use of a network such as this would reduce, but not eliminate, the need to increase the Bitcoin block size.  For example, assume a billion users of such a network, being paid directly on the block chain bi-weekly, each of whom immediately commits the entire payment to a micropayment channel to their preferred, centralized intermediate node.  Each year, there would be 26 billion outputs added to the block chain for payroll, 26 billion T1 outputs and 52 billion T2 outputs for the micropayment channels.  That&#039;s 104 billion outputs per year, or on average 1,978,691 outputs per block, or 3,298 transactions per second, not counting setup and teardown of intermediary micropayment channels and the uneven time distribution of payroll transactions.&lt;br /&gt;
&lt;br /&gt;
== Privacy and Centralized Control ==&lt;br /&gt;
&lt;br /&gt;
One can imagine a future in which Bitcoin is widely adopted and a network based on this proposal to be widely used for clearing instant payments.  It&#039;s possible that a governmental entity could regulate part of a network by mandating the following whitelist conditions:&lt;br /&gt;
&lt;br /&gt;
# Merchants, end users and intermediaries within the jurisdiction MUST use a key signed by the government&#039;s CA, providing identifying information for such a signature&lt;br /&gt;
# Merchants, end users and intermediaries within the jurisdiction MUST establish micropayment channels with ONLY other nodes using keys signed by the government&#039;s CA&lt;br /&gt;
# Merchants and intermediaries within the jurisdiction MUST track the initial source, final destination and possibly entire path of payment flow&lt;br /&gt;
&lt;br /&gt;
One can also imagine a somewhat separate but similar network, where:&lt;br /&gt;
&lt;br /&gt;
# Most nodes live on Tor or in jurisdictions friendly to financial freedom and privacy.&lt;br /&gt;
# Many end users and local/niche businesses run intermediary nodes for the benefit of their friends, family and community with a commitment not to log information.&lt;br /&gt;
# All or some keys on the network are ephemeral, and each time a micropayment channel closes and settles on the block chain, the output of the settlement transaction is sent at least once through a network providing 3-party mixing transactions&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=54266.0&amp;lt;/ref&amp;gt;.  This may necessitate additional routing information outside the block chain as well as additional anti-DoS risk management solutions.  This also provides for the potential of intermediaries having multiple keys at the same time, allowing them to create &amp;quot;hidden&amp;quot; links in micropayment channel chains and further improving privacy.&lt;br /&gt;
&lt;br /&gt;
It would be difficult to move bitcoins directly between the two networks without being tracked; however, one can imagine that a market would develop in helping to facilitate and hide such movement.  The fact that such a market would develop and be difficult if not impossible to stop would hopefully prevent most governments from attempting to establish rules such as above.  In a worst-case scenario, &amp;quot;free&amp;quot; bitcoins will be worth more than &amp;quot;government-controlled&amp;quot; bitcoins and the market would be mostly one-way, laundering &amp;quot;government-controlled&amp;quot; bitcoins into the free network until the values equalize.&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
This proposal details the synthesis of several ideas described by hashcoin, Meni Rosenfeld, Mike Hearn, cjp, retep, and additional individuals into a mechanism for two-phase commits across chains of micropayment channels, allowing for instant clearing and settlement on the block chain.   A decentralized peer-to-peer micropayment network utilizing the side effect of routing and reputation information stored in the block chain is also described.  Its scaling properties in the real world may make it viable for micropayments currently, and with increased block size, may make it viable for wide-scale everyday use in retail commerce.  Potential points of control and monitoring, as well as countermeasures thereto, are briefly explored.  Potential side effects on the Bitcoin network are also explored.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=36078</id>
		<title>User:Aakselrod/Draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=36078"/>
		<updated>2013-03-11T21:03:08Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal Background and Summary ==&lt;br /&gt;
&lt;br /&gt;
The basic concept of a peer-to-peer payment network which allows nodes to transact off the blockchain has been proposed before.  Proponents see multiple advantages such as instant transactions which require no additional confirmations, higher scalability due to individual transactions taking place off the blockchain, and feasibility of widespread micropayments.  The proposals use [[Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|micropayment channels]]&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=91732.0&amp;lt;/ref&amp;gt; or other multi-signature transaction-based shared property&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=94674.0&amp;lt;/ref&amp;gt; schemes between payers, payees, and intermediaries in order to allow such transactions.&lt;br /&gt;
&lt;br /&gt;
For example, if Alice is a customer and Bob is a merchant, Alice may have a micropayment channel open to Carol, her payment processor, who may have a channel open to Dan, Bob&#039;s payment processor, which also has a channel open to Bob.  Alice would increment the allocation going to Carol through her channel by the amount she wants to pay Bob, and Carol and Dan would do the same down the line.  Bob would then be paid, and none of this would hit the blockchain except as part of aggregate settlement transactions closing the micropayment channels.&lt;br /&gt;
&lt;br /&gt;
This proposal aims to bring closer the realization of such a network by discussing the following solutions:&lt;br /&gt;
&lt;br /&gt;
* Additional scalability of micropayment channel setup transactions by having intermediaries combine them&lt;br /&gt;
* Two-phase commit through multiple chained micropayment channels, reducing the risk that an intermediary will accept a payment but not forward it on and enabling two-party escrow transactions through the payment network&lt;br /&gt;
* Extraction of routing and reputation information from the blockchain and memory pool as a side effect of the way micropayment channels are opened and closed&lt;br /&gt;
&lt;br /&gt;
The proposal will also discuss possible side effects of its adoption, both positive and negative.&lt;br /&gt;
&lt;br /&gt;
Other potential off-chain transaction solutions have also been proposed&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=146307.0&amp;lt;/ref&amp;gt; using different mechanisms.  These potential solutions are out of scope for this proposal, which focuses on chained microtransaction channels between payers, payees and intermediaries.  Other types of solutions may have the potential to be combined with the solution detailed in this proposal.&lt;br /&gt;
&lt;br /&gt;
== Micropayment Channels ==&lt;br /&gt;
&lt;br /&gt;
The original concept of the micropayment channel is explained well on the [[Contracts]] page in example 7, referenced above.  Unlike the concept of shared property, these micropayment channels are unidirectional and must be created in pairs for bidirectional payment flow.&lt;br /&gt;
&lt;br /&gt;
Transaction replacement is used in this scheme to prevent denial of service (locking up money, potentially permanently depending on whether it&#039;s for ransom or not) by the receiving side of a micropayment channel.  Nodes running 0.8 and above treat non-final transactions as non-standard.  This allows the recipient a high degree of confidence that a non-final timelocked transaction won&#039;t be stuck in the memory pool of most nodes and a final transaction meant to replace it will be mined first.  While this is not the original design for transaction replacement, it should work similarly for many use cases.&lt;br /&gt;
&lt;br /&gt;
To work with the current state of the network, the format of the T2 transaction defined in the scheme above must be changed slightly.  The initial version of T2 would still be created the same way (potentially with a longer lifetime than just one day); however, subsequent versions of T2 would not have nLockTime set and would have a sequence number of UINT_MAX.  The micropayment channel recipient does not sign or broadcast any intermediate versions of T2 until the channel is ready to be closed.&lt;br /&gt;
&lt;br /&gt;
Two other types of proposals have been suggested to discourage and/or make expensive such denial of service attacks by either side of a micropayment channel:  risk deposits&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=118418.msg1271858#msg1271858&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=75481.0&amp;lt;/ref&amp;gt; and reputation systems&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=134827.0&amp;lt;/ref&amp;gt;.  This proposal can use both techniques to help reduce the risk.&lt;br /&gt;
&lt;br /&gt;
== Two-Phase Commit ==&lt;br /&gt;
&lt;br /&gt;
In order to allow two-phase commit for chained transaction, the original scheme for micropayment channels is modified slightly again with a construct similar to the [[Contracts#Example_5:_Trading_across_chains|trading across chains]] scheme.  Specifically, the two T2 outputs would be in a format similar to the following:&lt;br /&gt;
&lt;br /&gt;
 1. SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;sender&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;recipient&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
and the input scripts redeeming those outputs would be in a format similar to the following:&lt;br /&gt;
&lt;br /&gt;
 1. SIG&amp;lt;sub&amp;gt;sender&amp;lt;/sub&amp;gt; m&lt;br /&gt;
 2. SIG&amp;lt;sub&amp;gt;recipient&amp;lt;/sub&amp;gt; m&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; is a number of at least 256 bits agreed to by a payer and payee in a transaction which is chained through multiple micropayment channels.  An example follows:&lt;br /&gt;
&lt;br /&gt;
Alice would like to pay Bob 10 mBTC.  Alice does not have a micropayment channel to Bob.  However, Alice has a micropayment channel to Carol, and Carol has a micropayment channel to Bob.&lt;br /&gt;
&lt;br /&gt;
Bob generates a 256-bit number &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; and gives its SHA256 hash to Alice.  Alice has previously signed and sent to Carol a transaction T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; which contains an input from her and Carol&#039;s T1&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; and two outputs:&lt;br /&gt;
&lt;br /&gt;
 1. 90 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 10 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; is a hash from a previous transaction which has gone through a similar process.  Similarly, Carol has previously signed and sent to Bob a transaction T2&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; which contains an input from her and Bob&#039;s T1&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; and two outputs:&lt;br /&gt;
&lt;br /&gt;
 1. 900 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 100 BTC to: SHA256 h EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
where, again, &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; is a hash from a previous transaction, which could be different than the &amp;lt;code&amp;gt;h&amp;lt;/code&amp;gt; in T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Alice requests for Carol to send 10 mBTC to Bob on her behalf.  When she requests this, she also signs and sends to Carol a new version of T2&amp;lt;sub&amp;gt;AC&amp;lt;/sub&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
 1. 89.99 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Alice&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 10.01 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
Carol will then notify Bob of an incoming payment and signs/sends to Bob a new version of T2&amp;lt;sub&amp;gt;CB&amp;lt;/sub&amp;gt; as follows:&lt;br /&gt;
&lt;br /&gt;
 1. 899.99 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Carol&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
 2. 100.01 BTC to: SHA256 Hash&amp;lt;sub&amp;gt;m&amp;lt;/sub&amp;gt; EQUALVERIFY Pubkey&amp;lt;sub&amp;gt;Bob&amp;lt;/sub&amp;gt; CHECKSIGVERIFY&lt;br /&gt;
&lt;br /&gt;
When Bob sees that a payment has come through, he broadcasts &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; to Alice and Carol, committing the transaction.  Bob can&#039;t redeem his output without revealing &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;, so he has no incentive to keep it from the other parties.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=35525</id>
		<title>User:Aakselrod/Draft</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Aakselrod/Draft&amp;diff=35525"/>
		<updated>2013-02-02T05:22:01Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: Draft proposal of a decentralized, peer-to-peer payment clearing network which uses Bitcoin for settlement and bitcoins as a unit of account&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Proposal Background and Summary ==&lt;br /&gt;
&lt;br /&gt;
The basic concept of a peer-to-peer payment network which allows nodes to transact off the blockchain has been proposed before&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=91732.0&amp;lt;/ref&amp;gt;.  Proponents see multiple advantages such as instant transactions which require no additional confirmations, higher scalability due to individual transactions taking place off the blockchain, and feasibility of widespread micropayments.  The proposals use [[Contracts#Example_7:_Rapidly-adjusted_.28micro.29payments_to_a_pre-determined_party|micropayment channels]] between payers, payees, and intermediaries in order to allow such transactions.&lt;br /&gt;
&lt;br /&gt;
For example, if Alice is a customer and Bob is a merchant, Alice may have a micropayment channel open to Carol, her payment processor, who may have a channel open to Dan, Bob&#039;s payment processor, which also has a channel open to Bob.  Alice would increment the allocation going to Carol through her channel by the amount she wants to pay Bob, and Carol and Dan would do the same down the line.  Bob would then be paid, and none of this would hit the blockchain except as part of aggregate settlement transactions closing the micropayment channels.&lt;br /&gt;
&lt;br /&gt;
This proposal aims to bring closer the realization of such a network by discussing the following solutions:&lt;br /&gt;
&lt;br /&gt;
* Additional scalability of micropayment channel setup transactions by having intermediaries combine them&lt;br /&gt;
* Two-step commit through multiple chained micropayment channels, reducing the risk that an intermediary will accept a payment but not forward it on and enabling two-party escrow transactions through the payment network&lt;br /&gt;
* Extraction of routing and reputation information from the blockchain and memory pool as a side effect of the way micropayment channels are open and closed&lt;br /&gt;
&lt;br /&gt;
The proposal will also discuss possible side effects of its adoption, both positive and negative.&lt;br /&gt;
&lt;br /&gt;
== Micropayment Channels ==&lt;br /&gt;
&lt;br /&gt;
The original concept of the micropayment channel is explained well on the [[Contracts]] page.  One issue for current attempts at implementation of these proposal is that transaction replacement is not currently enabled on the Bitcoin network.  This makes it more difficult to prevent denial of service (locking up money, potentially permanently depending on whether it&#039;s for ransom or not) by an intermediary or a party to a 2-of-2 escrow transaction.&lt;br /&gt;
&lt;br /&gt;
This proposal is designed to work around the current lack of transaction replacement on the network.  It can likely be made simpler and more effective against such DoS attacks when transaction replacement is enabled.  A future version of this proposal may include the changes that would be necessary to improve the design by the use of transaction replacement.&lt;br /&gt;
&lt;br /&gt;
Two types of proposals have been suggested to discourage and/or make expensive denial of service attacks:  risk deposits&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=118418.msg1271858#msg1271858&amp;lt;/ref&amp;gt; and reputation systems&amp;lt;ref&amp;gt;https://bitcointalk.org/index.php?topic=134827.0&amp;lt;/ref&amp;gt;.  This proposal uses both techniques to help reduce the risk.&lt;br /&gt;
&lt;br /&gt;
Risk deposits are designed to make it unprofitable to blackmail or ransom a micropayment channel peer to pay &lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Contract&amp;diff=24531</id>
		<title>Contract</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Contract&amp;diff=24531"/>
		<updated>2012-03-08T15:23:33Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: Add Mike Hearn&amp;#039;s examples of places where ACs/DACs with Bitcoin would be useful, and link to DAC scheme (formerly exercise for the reader).&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A &#039;&#039;&#039;distributed contract&#039;&#039;&#039; is a method of using Bitcoin to form agreements with people via the block chain. Contracts don&#039;t make anything possible that was previously impossible, but rather, they allow you to solve common problems in a way that minimizes trust. Minimal trust often makes things more convenient by allowing human judgements to be taken out of the loop, thus allowing complete automation.&lt;br /&gt;
&lt;br /&gt;
Many of the ideas underlying Bitcoin contracts were first described by Nick Szabó in his seminal paper, &lt;br /&gt;
[http://szabo.best.vwh.net/formalize.html Formalizing and Securing Relationships on Public Networks].&lt;br /&gt;
&lt;br /&gt;
This page was written by [mailto:mike@plan99.net Mike Hearn]. Contact him if you have an idea for a new type of contract.&lt;br /&gt;
&lt;br /&gt;
==Theory==&lt;br /&gt;
&lt;br /&gt;
Every [[transaction]] in Bitcoin has one or more inputs and outputs. Each input/output has a small, pure function associated with it called a [[script]]. Scripts can contain signatures over simplified forms of the transaction itself.&lt;br /&gt;
&lt;br /&gt;
Every transaction can have a lock time associated with it. This allows the transaction to be pending and replaceable until an agreed-upon future time, specified either as a block index or as a timestamp (the same field is used for both, but values less than 500 million are interpreted as a block index). If a transaction&#039;s lock time has been reached, we say it is final.&lt;br /&gt;
&lt;br /&gt;
Each transaction input has a sequence number. In a normal transaction that just moves value around, the sequence numbers are all UINT_MAX and the lock time is zero. If the lock time has not yet been reached, but all the sequence numbers are UINT_MAX, the transaction is also considered final. Sequence numbers can be used to issue new versions of a transaction without invalidating other inputs signatures, e.g., in the case where each input on a transaction comes from a different party, each input may start with a sequence number of zero, and those numbers can be incremented independently.&lt;br /&gt;
&lt;br /&gt;
Signature checking is flexible because the form of transaction that is signed can be controlled through the use of SIGHASH flags, which are stuck on the end of a signature. In this way, contracts can be constructed in which each party signs only a part of it, allowing other parts to be changed without their involvement.  The SIGHASH flags have two parts, a mode and the ANYONECANPAY modifier:&lt;br /&gt;
&lt;br /&gt;
# SIGHASH_ALL: This is the default. It indicates that everything about the transaction is signed, except for the input scripts. Signing the input scripts as well would obviously make it impossible to construct a transaction, so they are always blanked out. Note, though, that other properties of the input, like the connected output and sequence numbers, &#039;&#039;are&#039;&#039; signed; it&#039;s only the scripts that are not. Intuitively, it means &amp;quot;I agree to put my money in, if everyone puts their money in and the outputs are this&amp;quot;.&lt;br /&gt;
# SIGHASH_NONE: The outputs are not signed and can be anything. Use this to indicate &amp;quot;I agree to put my money in, as long as everyone puts their money in, but I don&#039;t care what&#039;s done with the output&amp;quot;. This mode allows others to update the transaction by changing their inputs sequence numbers.&lt;br /&gt;
# SIGHASH_SINGLE: Like SIGHASH_NONE, the inputs are signed, but the sequence numbers are blanked, so others can create new versions of the transaction. However, the only output that is signed is the one at the same position as the input. Use this to indicate &amp;quot;I agree, as long as my output is what I want; I don&#039;t care about the others&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The SIGHASH_ANYONECANPAY modifier can be combined with the above three modes. When set, only that input is signed and the other inputs can be anything.&lt;br /&gt;
&lt;br /&gt;
Scripts can contain the CHECKMULTISIG opcode. This opcode provides n-of-m checking: you provide multiple public keys, and specify the number of valid signatures that must be present. The number of signatures can be less than the number of public keys. An output can require two signatures to be spent by setting it to something like this:&lt;br /&gt;
&lt;br /&gt;
 2 &amp;lt;pubkey1&amp;gt; &amp;lt;pubkey2&amp;gt; 2 CHECKMULTISIGVERIFY&lt;br /&gt;
&lt;br /&gt;
There are two general patterns for safely creating contracts:&lt;br /&gt;
&lt;br /&gt;
# Transactions are passed around outside of the P2P network, in partially-complete or invalid forms.&lt;br /&gt;
# Two transactions are used: one (the contract) is created and signed but not broadcast right away. Instead, the other transaction (the payment) is broadcast after the contract is agreed to lock in the money, and then the contract is broadcast.&lt;br /&gt;
&lt;br /&gt;
This is to ensure that people always know what they are agreeing to.&lt;br /&gt;
&lt;br /&gt;
Together, these features let us build interesting new financial tools on top of the block chain.&lt;br /&gt;
&lt;br /&gt;
==Example 1: Providing a deposit==&lt;br /&gt;
&lt;br /&gt;
Imagine that you open an account on a website (eg, a forum or wiki) and wish to establish your trustworthiness with the operators, but you don&#039;t have any pre-existing reputation to leverage. One solution is to buy trust by paying the website some money. But if at some point you close your account, you&#039;d probably like that money back. You may not trust the site enough to give them a deposit that they are tempted to spend. Another risk is that the site might just disappear one day. &lt;br /&gt;
&lt;br /&gt;
The goal is to prove that you made a sacrifice of some kind so the site knows you&#039;re not a spambot, but you don&#039;t want them to be able to spend the money. And if the operators disappear, you&#039;d eventually like the coins back without needing anything from them.&lt;br /&gt;
&lt;br /&gt;
We can solve this problem with a contract:&lt;br /&gt;
&lt;br /&gt;
# The user and website send each other a newly-generated public key.&lt;br /&gt;
# The user creates transaction Tx1 (the payment) putting 10 BTC into an output that requires both user and website to sign, but does not broadcast it. They use the key from the previous step for the site.&lt;br /&gt;
# User sends Tx1 to the website.&lt;br /&gt;
# The website creates a transaction Tx2 (the contract).  Tx2 spends Tx1 and pays it back to the user via the address he provided in the first step. Note that Tx1 requires two signatures, so this transaction can&#039;t be complete. nLockTime is set to some date in the future (eg, six months). The sequence number on the input is set to zero.&lt;br /&gt;
# Finally, the incomplete (half-signed) transaction is sent back to the user. The user checks that the contract is as expected - that the coins will eventually come back to him - but, unless things are changed, only after six months. Because the sequence number is zero, the contract can be amended in future if both parties agree. The script in the input isn&#039;t finished though; there are only zeros where the user&#039;s signature should be. He fixes that by signing the contract and putting the new signature in the appropriate spot.&lt;br /&gt;
# The user broadcasts Tx1, then broadcasts Tx2.&lt;br /&gt;
&lt;br /&gt;
At this stage, the 10 BTC are in a state where neither the user nor the website can spend them independently. After six months, the contract will complete and the user will get the coins back, even if the website disappears.&lt;br /&gt;
&lt;br /&gt;
What if the user wishes to close his account early? The website creates a new version of Tx2 with nLockTime set to zero and the input sequence number set to UINT_MAX, then he re-signs it. The site hands the tx back to the user, who signs it as well. The user then broadcasts the transaction, terminating the contract early and releasing the coins.&lt;br /&gt;
&lt;br /&gt;
What if the six months is nearly up and the user wishes to keep his account? The same thing applies: the contract can be resigned with a newer nLockTime, a sequence number 1 higher than the previous and rebroadcast 2^32 times. No matter what happens, both parties must agree for the contract to change.&lt;br /&gt;
&lt;br /&gt;
Obviously, if the user turns out to be abusive (i.e., a spammer), the website will not allow an early close of the contract. If too much abuse is getting through, the size of the deposit can be raised or the length of the contract can be increased.&lt;br /&gt;
&lt;br /&gt;
==Example 2: Escrow and dispute mediation==&lt;br /&gt;
&lt;br /&gt;
A buyer wants to trade with somebody he doesn&#039;t know or trust. In the common case where the transaction goes well, the client doesn&#039;t want any third parties involved. If something goes wrong though, he&#039;d like a third party to decide who gets the money - perhaps a professional dispute mediation service. Note that this concept can apply to either buyer or seller. The mediator might request proof of postage from the merchant, for example.&lt;br /&gt;
&lt;br /&gt;
In other words, one wants to lock up some coins so a third party has to agree in order for them to be spent:&lt;br /&gt;
&lt;br /&gt;
# Agree with the merchant on a dispute mediator (e.g., ClearCoin).&lt;br /&gt;
# Ask the merchant for a public key (K1). Ask the mediator for a public key (K2). Create a new key for yourself (K3).&lt;br /&gt;
# Send the merchant K2. The merchant challenges the mediator with a random nonce. The mediator signs the nonce with the private form of K2, thus proving it really belongs to merchant.&lt;br /&gt;
# Create a transaction (Tx1) with an output script as follows and broadcast it:&lt;br /&gt;
&lt;br /&gt;
 2 &amp;lt;K1&amp;gt; &amp;lt;K2&amp;gt; &amp;lt;K3&amp;gt; 3 CHECKMULTISIGVERIFY&lt;br /&gt;
&lt;br /&gt;
Now the coins are locked in such a way that they can only be spent by the following methods:&lt;br /&gt;
&lt;br /&gt;
# Client and the merchant agree (either a successful trade, or merchant agrees to reimburse client without mediation)&lt;br /&gt;
# Client and the mediator agree (failed trade, mediator sides with client, like a charge-back)&lt;br /&gt;
# The mediator and the merchant agree (goods delivered, merchant gets client&#039;s coins despite the dispute)&lt;br /&gt;
&lt;br /&gt;
When signing an input, the contents are set to the connected output. Thus, to redeem this transaction, the client creates a scriptSig containing zeros where the other signature should be, signs it, and then sets one of the slots to his new signature. The partially-complete transaction can then be sent to the merchant or mediator for the second signature.&lt;br /&gt;
&lt;br /&gt;
==Example 3: Assurance contracts==&lt;br /&gt;
&lt;br /&gt;
An [http://en.wikipedia.org/wiki/Assurance_contract assurance contract] is a way of funding the creation of a [http://www.auburn.edu/~johnspm/gloss/public_goods public good], that is, a good that, once created, anyone can benefit from for free. The standard example is a lighthouse: whilst everyone may agree that one should be built, it’s too expensive for an individual sailor to justify building one, given that it will also benefit all his competitors. &lt;br /&gt;
&lt;br /&gt;
Examples where Bitcoin is superior to traditional payment methods for assurance contract fundraising include Internet radio station funding and [https://bitcointalk.org/index.php?topic=67255.msg788110#msg788110 web page translation]. &amp;quot;For example, consider a browser extension that you send a bit of money to. It detects the current language of the page and broadcasts a pledge for a translation into your language to be prepared. If enough users with the extension land on the same page at the same time (eg, it was linked to from somewhere high traffic), then enough pledges are broadcast to trigger a payment to a company who prepares a high quality translation. When complete it automatically loads in your browser.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
One solution is for everyone to pledge money towards the creation of the public good, such that the pledges are only committed if the total value of all pledges is above the cost of creation. If not enough people contribute, nobody has to pay anything.&lt;br /&gt;
&lt;br /&gt;
We can model this in Bitcoin as follows:&lt;br /&gt;
&lt;br /&gt;
# An entrepreneur creates a new address and announces that the good will be created if at least 1000 BTC is raised. Anyone can contribute.&lt;br /&gt;
# Each party wishing to pledge creates a new transaction spending some of their coins to the announced address, but they do not broadcast it. The transaction is similar to a regular transaction except for three differences: Firstly, there cannot be any change. If you don’t have any outputs of the right size, you must create one first by spending to one of your own addresses. Secondly, the input script signature is signed with SIGHASH_ALL | SIGHASH_ANYONECANPAY. Finally, the output value is set to 1000 BTC. Note that this is not a valid transaction because the output value is larger than the input value.&lt;br /&gt;
# The transaction is uploaded to the entrepreneur&#039;s server, which saves it to disk and updates its count of how many coins have been pledged.&lt;br /&gt;
# Once the server has enough coins, it merges the separate transactions together into a new transaction. The new transaction has a single output that simply spends to the announced address - it is the same as the outputs on each contributed transaction. The inputs to the transaction are collected from the contributed pledges.&lt;br /&gt;
# The finished transaction is broadcast, sending the pledged coins to the announced address.&lt;br /&gt;
&lt;br /&gt;
This scheme relies on several aspects of the protocol. The first is the SIGHASH flags used. SIGHASH_ALL is the default and means the entire contents of the transaction are signed, except for the input scripts. SIGHASH_ANYONECANPAY is an additional modifier that means the signature only covers the input it’s found in - the other inputs are not signed and thus can be anything.&lt;br /&gt;
&lt;br /&gt;
By combining these flags together, we are able to create a signature that is valid even when other inputs are added, but breaks if the outputs or other properties of the transaction are changed.&lt;br /&gt;
&lt;br /&gt;
The second aspect we exploit is the fact that a transaction in which the output values are larger than the input values is invalid (for obvious reasons). This means it’s safe to send the entrepreneur a transaction that spends such coins - it’s impossible for him to claim the coins unless he has other inputs that sum to the output value or more.&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to create assurance contracts without using SIGHASH_ANYONECANPAY. Instead, a two step process is used in which pledges are collected without transactions, and once the total value is reached, a transaction with an input for each pledger is created and passed around until all signatures are collected. However, using SIGHASH_ANYONECANPAY and then merging is probably more convenient.&lt;br /&gt;
&lt;br /&gt;
An assurance contract can be prepared that funds network security. Instead of a single announced address for everyone to contribute to, the entrepreneur provides a set of outputs that are signed by each party in their pledge. The entrepreneur also prepares a number of transactions equivalent to the number of outputs, each one spending a single contract output to a null output of zero value and an OP_FALSE script, i.e., the entire value is consumed as fees. The lock time of each transaction is set to N+M, where N is a pre-agreed time at which the contract becomes valid (measured in block numbers) and M is the index of a contract output. In this way, an array of transactions is prepared that do nothing other than incentivize mining in a series of blocks. &lt;br /&gt;
&lt;br /&gt;
An elaboration of this concept is described by Tabarrok in his paper, [http://mason.gmu.edu/~atabarro/PrivateProvision.pdf “The private provision of public goods via dominant assurance contracts”]. In a dominant assurance contract, if a contract fails (not enough pledges within a set time window) the entrepreneur pays a fee to those who pledged so far. This type of contract attempts to arrange incentives such that taking part is always the right strategy. [[Dominant Assurance Contracts|A scheme for dominant assurance contracts]] in Bitcoin has been proposed.&lt;br /&gt;
&lt;br /&gt;
==Example 4: Using external state==&lt;br /&gt;
&lt;br /&gt;
Scripts are, by design, pure functions. They cannot poll external servers or import any state that may change as it would allow an attacker to outrun the block chain. But we can make transactions connected to the world in other ways.&lt;br /&gt;
&lt;br /&gt;
Consider the example of an old man who wishes to give an inheritance to his grandson, either on the grandson&#039;s 18th birthday or when the man dies, whichever comes first. &lt;br /&gt;
&lt;br /&gt;
To solve this, the man first sends the amount of the inheritance to himself so there is a single output of the right amount. Then he creates a transaction with a lock time of the grandson&#039;s 18th birthday that pays the coins to another key owned by the grandson, signs it, and gives it to him - but does not broadcast it. This takes care of the 18th birthday condition. If the date passes, the grandson broadcasts the transaction and claims the coins. He could do it before then, but it doesn&#039;t let him get the coins any earlier, and some nodes may choose to drop transactions in the memory pool with lock times far in the future.&lt;br /&gt;
&lt;br /&gt;
The death condition is harder. As Bitcoin nodes cannot measure arbitrary conditions, we must rely on an &#039;&#039;oracle&#039;&#039;. An oracle is a server that has a keypair, and signs transactions on request when a user-provided expression evaluates to true.&lt;br /&gt;
&lt;br /&gt;
Here is an example. The man creates a transaction spending his output, and sets the output to:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;sons pubkey&amp;gt; CHECKSIGVERIFY &amp;lt;oracle pubkey&amp;gt; CHECKSIGVERIFY &amp;lt;hash&amp;gt; OP_TRUE&lt;br /&gt;
&lt;br /&gt;
This is the oracle script. It has an unusual form - after signature checking it pushes data to the stack then does not use it. The pubkey is published on the oracle&#039;s website and is well-known. The hash is set to be the hash of the user-provided expression stating that he has died, written in a form the oracle knows how to evaluate. For example, it could be the hash of the string:&lt;br /&gt;
&lt;br /&gt;
 if (has_died(&#039;john smith&#039;, born_on=1950/01/02)) return 1JxgRXEHBi86zYzHN2U4KMyRCg4LvwNUrp;&lt;br /&gt;
&lt;br /&gt;
This little language is hypothetical, it&#039;d be defined by the oracle and could be anything. The return value is an address owned by the grandson.&lt;br /&gt;
&lt;br /&gt;
Once more, the man creates this transaction but gives it directly to his grandson instead of broadcasting it. He also provides the expression that is hashed into the transaction and the name of the oracle that can unlock it.&lt;br /&gt;
&lt;br /&gt;
It is used in the following algorithm:&lt;br /&gt;
&lt;br /&gt;
# The oracle accepts a measurement request. The request contains the user-provided expression, a copy of the output script, and a partially complete transaction provided by the user. Everything in this transaction is finished except for the scriptSig, which contains just one signature (the grandson&#039;s) - not enough to unlock the output.&lt;br /&gt;
# The oracle checks the user-provided expression hashes to the value in the provided output script. If it doesn&#039;t, it returns an error.&lt;br /&gt;
# The oracle evaluates the expression. If the result is not the destination address of the output, it returns an error.&lt;br /&gt;
# Otherwise the oracle signs the transaction and inserts the signature into the scriptSig. Note that when signing a Bitcoin transaction, the input script is set to the connected output script. The reason is that when OP_CHECKSIG runs, the script containing the opcode is put in the input being evaluated, _not_ the script containing the signature itself. The oracle has never seen the full output it is being asked to sign, but it doesn&#039;t have to. It knows the output script, its own public key, and the hash of the user-provided expression, which is everything it needs to check the output script and finish the transaction.&lt;br /&gt;
# The oracle returns the newly signed, unbroadcast transaction to the user.&lt;br /&gt;
&lt;br /&gt;
If, and only if, the oracle agrees that the man is dead, the grandson can broadcast the two transactions (the contract and the claim) and take the coins.&lt;br /&gt;
&lt;br /&gt;
The oracle does not need to be highly trusted. It has not seen the transaction the grandson is trying to unlock, as it was never broadcast, thus, the oracle cannot hold the grandson to ransom because it does not know whether the transaction it&#039;s signing for even exists. People can, and should, regularly challenge the oracle in an automated fashion to ensure it always outputs what is expected. The challenges can be done without spending any coins because the tx to be signed can be invalid (ie, connected to transactions that don&#039;t exist). The oracle has no way to know whether a request to be signed is random or real. CHECKSIGVERIFY can be replaced with CHECKMULTISIGVERIFY to allow for n-of-m oracles if need be.&lt;br /&gt;
&lt;br /&gt;
Oracles can potentially evaluate anything, yet the output script form in the block chain can always be the same. Consider the following possibilities:&lt;br /&gt;
&lt;br /&gt;
 today() == 2011/09/25 &amp;amp;&amp;amp; exchange_rate(mtgoxUSD) &amp;gt;= 12.5 &amp;amp;&amp;amp; exchange_rate(mtgoxUSD) &amp;lt;= 13.5&lt;br /&gt;
 Require exchange rate to be between two values on a given date&lt;br /&gt;
 &lt;br /&gt;
 google_results_count(site:www.google.com/hostednews &#039;Mike Hearn&#039; olympic gold medal) &amp;gt; 0&lt;br /&gt;
 A bet on me doing something that I will never actually do&lt;br /&gt;
 &lt;br /&gt;
 // Choose between one of two winners of a bet on the outcome of the Eurovision song contest.&lt;br /&gt;
 if (eurovision_winner() == &#039;Azerbaijan&#039;) &lt;br /&gt;
   return 1Lj9udBVDwptFffGSJSC2sohCfudQgSTPD; &lt;br /&gt;
 else &lt;br /&gt;
   return 1JxgRXEHBi86zYzHN2U4KMyRCg4LvwNUrp;&lt;br /&gt;
&lt;br /&gt;
The conditions that control whether the oracle signs can be arbitrarily complex, but the block chain never needs to contain more than a single hash.&lt;br /&gt;
&lt;br /&gt;
==Example 5: Trading across chains==&lt;br /&gt;
&lt;br /&gt;
The Bitcoin technology can be adapted to create [[Alternative Chains|multiple, independent currencies]]. NameCoin is an example of one such currency that operates under a slightly different set of rules, and can also be used to rent names in a namespace. Currencies that implement the same ideas as Bitcoin can be traded freely against each other without trust. For example, imagine a consortium of companies that issue EURcoins, a crypto-currency that is backed 1:1 by deposits in the consortium&#039;s bank accounts. Such a currency would have a different set of tradeoffs to Bitcoin: more centralized, but without FX risk. People might wish to trade Bitcoins for EURcoins back and forth, with the companies only getting involved when cashing in/out of the regular banking system.&lt;br /&gt;
&lt;br /&gt;
To implement this, a protocol proposed by luxgladius can be used:&lt;br /&gt;
&lt;br /&gt;
# Both parties generate a new key and some random data (the secret).&lt;br /&gt;
# Party &#039;B&#039; sends a hash of his secret to &#039;A&#039; along with his public key.&lt;br /&gt;
# Party &#039;A&#039; generates Tx1 (the payment) containing an output with the chain-trade script in it. See below for this script and a discussion of it. It allows coin release either by signing with the two keys (key &#039;A&#039; and key &#039;B&#039;) or with (secret &#039;A&#039;, secret &#039;B&#039;, key &#039;B&#039;). This transaction is not broadcast. The chain release script contains hashes, not the actual secrets themselves.&lt;br /&gt;
# Party &#039;A&#039; generates Tx2 (the contract), which spends Tx1 and has an output going back to key &#039;A&#039;. It has a lock time in the future and the input has a sequence number of zero, so it can be replaced. &#039;A&#039; signs Tx2 and sends it to &#039;B&#039;, who also signs it and sends it back. Alternatively, they can simply agree on what form the contract takes, e.g., by using the same software, and then &#039;A&#039; can simply send &#039;B&#039; the hash of Tx1 and receive back a signature.&lt;br /&gt;
# &#039;A&#039; broadcasts Tx1 and Tx2. Party &#039;B&#039; can now see the coins but cannot spend them because it does not have an output going to him, and the tx is not finalized anyway.&lt;br /&gt;
# &#039;B&#039; performs the same scheme in reverse on the alternative chain. Both sides of the trade are now pending but incomplete.&lt;br /&gt;
# &#039;A&#039; sends his secret (random data) to &#039;B&#039;, who then uses it to re-issue the now-finalized contract using (secret &#039;A&#039;, secret &#039;B&#039;, key &#039;B&#039;) and an output of his choice. &#039;B&#039; now owns the coins, but in the process of claiming them, revealed his secret, allowing &#039;A&#039; to claim the other side of the trade.&lt;br /&gt;
&lt;br /&gt;
Because the protocol is trust-free, it would be feasible to do trades automatically in an entirely peer-to-peer manner, which should ensure good liquidity.&lt;br /&gt;
&lt;br /&gt;
The chain-trade script could look like this:&lt;br /&gt;
&lt;br /&gt;
 IF &lt;br /&gt;
   2 &amp;lt;key A&amp;gt; &amp;lt;key B&amp;gt; 2 CHECKMULTISIGVERIFY&lt;br /&gt;
 ELSE&lt;br /&gt;
   &amp;lt;key B&amp;gt; CHECKSIGVERIFY SHA256 &amp;lt;hash of secret A&amp;gt; EQUALVERIFY &amp;lt;hash of secret B&amp;gt; EQUALVERIFY&lt;br /&gt;
 ENDIF&lt;br /&gt;
&lt;br /&gt;
The contract input script looks like either:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;sig A&amp;gt; &amp;lt;sig B&amp;gt; 1&lt;br /&gt;
&lt;br /&gt;
or&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;secret B&amp;gt; &amp;lt;secret A&amp;gt; &amp;lt;sig B&amp;gt; 0&lt;br /&gt;
&lt;br /&gt;
i.e., the first data element selects which phase is being used.&lt;br /&gt;
&lt;br /&gt;
==Example 6: Smart property==&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to make physical property, like houses, cars or phones, be atomically tradeable and lendable via the block chain. This topic has its own article: learn more about [[Smart Property|smart property]].&lt;br /&gt;
&lt;br /&gt;
==Example 7: Rapidly-adjusted (micro)payments to a pre-determined party==&lt;br /&gt;
&lt;br /&gt;
Bitcoin transactions are very cheap relative to traditional payment systems, but still have a cost due to the need for it to be mined and stored. There are some cases in which you want to rapidly and cheaply adjust the amount of money sent to a particular recipient without incurring the cost of a broadcast transaction.&lt;br /&gt;
&lt;br /&gt;
For example, consider an untrusted internet access point, like a WiFi hotspot in a cafe you never visited before. You&#039;d like to pay 0.001 BTC per 10 kilobytes of usage, without opening an account with the cafe. A zero-trust solution means it could be fully automatic, so you could just pre-allocate a budget on your phone&#039;s mobile wallet at the start of the month, and then your device automatically negotiates and pays for internet access on demand. The cafe also wants to allow anyone to pay them without the fear of being ripped off.&lt;br /&gt;
&lt;br /&gt;
To do this, a protocol similar to one proposed by hashcoin can be used:&lt;br /&gt;
&lt;br /&gt;
# Request a public key from the access point.&lt;br /&gt;
# Create, but do not sign, a transaction (T1) that sets up a payment of (for example) 10 BTC to an output requiring both the access point&#039;s public key and one of your own to be used. The value to be used is chosen as an efficiency tradeoff.&lt;br /&gt;
# Create, but do not sign, another transaction (T2) that has two outputs, one to the access point&#039;s key and another that goes back to you. The initial value is 0.001 BTC to the access point and the rest back to you. Use a sequence number of zero on the input and a lock time in the future (e.g., 1 day).&lt;br /&gt;
# Send both unsigned transactions to the access point. It sees that T1 and T2 are of the expected form and signs T2. It hands T2 back to you.&lt;br /&gt;
# Check that T2 is signed correctly, sign T1 and T2. Send them to the access point, which broadcasts them, thus locking in the agreement. Note that T2 won&#039;t get included into a block for at least one day, unless it&#039;s replaced by a newer transaction, as determined by the sequence numbers.&lt;br /&gt;
# Each time you want 10kb of data quota, sign a new version of T2 with a higher sequence number, the same lock time, and adjust the outputs so more value is allocated to the access point, and send it. The AP sees that the output sizes are correct, signs it, and keeps it (does not broadcast).&lt;br /&gt;
&lt;br /&gt;
This continues until the session ends, or the 1-day period is getting close to expiry. The AP broadcasts the last transaction it saw, replacing the original that was pending. Once the lock time passes, the value transfer is committed. Alternatively, if the session end is negotiated cleanly, the user can sign a transaction that&#039;s final (sequence number of UINT_MAX), which signals that no more data quota will be purchased, allowing instant commitment of the transaction.&lt;br /&gt;
&lt;br /&gt;
The lock time and sequence numbers avoid an attack in which the AP provides connectivity, and then the user double-spends the output back to themselves using the first version of TX2, thus preventing the cafe from claiming the bill. If the user does try this, the TX won&#039;t be included right away, giving the access point a window of time in which it can observe the TX broadcast, and then broadcast the last version it saw, overriding the user&#039;s attempted double-spend.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Script]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Aakselrod&amp;diff=24515</id>
		<title>User:Aakselrod</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Aakselrod&amp;diff=24515"/>
		<updated>2012-03-07T15:01:56Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Alex Akselrod.  [http://bitcoin-otc.com/viewgpg.php?nick=aakselrod Here] is my OTC identity.  [https://bitcointalk.org/index.php?action=profile;u=38311 Here] is my BitcoinTalk forum profile.  I&#039;m particularly interested in using Bitcoin as a transaction/contract vehicle in other peer-to-peer networks for allocation of resources.  This makes me interested in various forms of contract schemes possible in Bitcoin.&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Dominant_Assurance_Contracts&amp;diff=24502</id>
		<title>Dominant Assurance Contracts</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Dominant_Assurance_Contracts&amp;diff=24502"/>
		<updated>2012-03-06T18:32:07Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: Created page with &amp;quot;This scheme is an attempt at Mike Hearn&amp;#039;s exercise for the reader:  an implementation of dominant assurance contract...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This scheme is an attempt at [[User:Mike|Mike Hearn]]&#039;s [[Contracts#Example_3:_Assurance_contracts|exercise for the reader]]:  an implementation of dominant assurance contracts.  The scheme requires the use of multisignature transactions, nLockTime and transaction replacement which means it won&#039;t work until these features are available on the Bitcoin network.&lt;br /&gt;
&lt;br /&gt;
# A vendor agrees to produce a good if X BTC are raised by date D and to pay Y BTC to each of n contributors if X BTC are not raised by date D, or to pay nY BTC if X BTC are raised and the vendor fails to produce the good to the satisfaction of 2 of 3 independent arbitrators picked through a fair process&lt;br /&gt;
# The arbitrators specify a 2-of-3 multisignature script to use as an output for the fundraiser with a public key from each arbitrator, which will allow them to judge the performance on actually producing the good&lt;br /&gt;
# For each contributor:&lt;br /&gt;
## The vendor and the contributor exchange public keys&lt;br /&gt;
## They create a 2-of-2 multisignature output from those public keys&lt;br /&gt;
## With no change, they create but do not sign a transaction with an input of X/n BTC from the contributor and an input of Y BTC from the vendor, with X/n+Y going to the output created in 3.2&lt;br /&gt;
## The contributor creates a transaction where the output is X+nY to the address created in step 2 and the input is the output of the transaction in 3.3, signs it using SIGHASH_ALL | SIGHASH_ANYONECANPAY, with version = UINT_MAX and gives it to the vendor&lt;br /&gt;
## The vendor creates a transaction of the entire balance of the transaction in 3.3 to the contributor with nLockTime of D and version &amp;lt; UINT_MAX, signs it and gives it to the contributor&lt;br /&gt;
## The vendor and contributor then both sign the transaction in 3.3 and broadcast it to the network, making the transaction in 3.4 valid when enough contributors participate and the transaction in 3.5 valid when nLockTime expires&lt;br /&gt;
# As date D nears, nLockTime comes close to expiration.&lt;br /&gt;
## If enough (n) people contribute, all of the inputs from 3.4 can combine to make the output valid when signed by the vendor, creating a valid transaction sending that money to the arbitrators, which only agree to release the funds when the vendor produces a satisfactory output&lt;br /&gt;
## If not enough people (&amp;lt;n) contribute, nLockTime expires on the transaction in 3.5, meaning each contributor can sign and redeem her transaction containing X/n + Y BTC from 3c&lt;br /&gt;
## Note that there is a limit at which it can be more profitable for the vendor to make the remaining contributions when D approaches&lt;br /&gt;
# Now the arbitrators have control of X (the payment from the contributors) + nY (the performance bond from the vendor) BTC and pay the vendor only when the vendor performs satisfactorily&lt;br /&gt;
&lt;br /&gt;
Such contracts can be used for crowdfunding.  Notable examples from Mike Hearn include:&lt;br /&gt;
&lt;br /&gt;
* Funding Internet radio stations which don&#039;t want to play ads: donations are the only viable revenue source as pay-for-streaming models allow undercutting by subscribers who relay the stream to their own subscribers&lt;br /&gt;
* Automatically contributing to the human translation of web pages&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=User:Aakselrod&amp;diff=24491</id>
		<title>User:Aakselrod</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=User:Aakselrod&amp;diff=24491"/>
		<updated>2012-03-06T17:17:52Z</updated>

		<summary type="html">&lt;p&gt;Aakselrod: Created page with &amp;quot;My name is Alex Akselrod and I don&amp;#039;t know what to write here.&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My name is Alex Akselrod and I don&#039;t know what to write here.&lt;/div&gt;</summary>
		<author><name>Aakselrod</name></author>
	</entry>
</feed>