GitHub PullRequestReviewCommentEvent at 2014-07-24 05:22:51
Repository: bitcoin.org
Actor: saivann
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/harding/bitcoin.org/pulls/comments/15330392","id":15330392,"diff_hunk":"@@ -0,0 +1,1263 @@\n+---\n+layout: base\n+lang: en\n+id: developer-guide\n+title: \"Bitcoin Mining\"\n+---\n+\n+<!-- style notes:\n+\n+    * use \"bitcoins\" as the default unit of account\n+\n+    * miner == person who mines (miner != mining equipment or software)\n+\n+    * hash rate / network hash rate (instead of hash power). Also put space\n+      in \"hash rate\" (not \"hashrate\")\n+\n+    * low variance miners get paid more consistently (instead of \"reliably\")\n+\n+    * \"share chain\" instead of \"sharechain\" (P2Pool docs are\n+      inconsistent, so we match our 'block chain' style)\n+\n+    * bold actual bitcoin terms on first introduction\n+-->\n+\n+# Bitcoin Mining Guide\n+\n+<p class=\"summary\">Find detailed information about Bitcoin mining.</p>\n+\n+<div markdown=\"1\" id=\"toc\" class=\"toc\"><div markdown=\"1\">\n+\n+* Table of contents\n+{:toc}\n+\n+<ul class=\"reportissue\"><li><a href=\"https://github.com/bitcoin/bitcoin.org/issues/new\" onmouseover=\"updateIssue(event);\">Report An Issue</a></li></ul>\n+\n+</div></div>\n+\n+<div markdown=\"1\" class=\"toccontent\">\n+\n+This guide helps you find answers to the following questions:\n+\n+* [How does mining work?][section how it works]\n+\n+* [What tools and techniques do miners use?][section tools and\n+techniques]\n+\n+* [What income and expenses can miners expect?][section income and\n+expenses]\n+\n+* [Why should miners choose to be honest?][section choose to be honest]\n+\n+But, before you start reading, we urge you to review the following\n+warnings:\n+\n+![Warning icon](/img/icon_warning.svg)\n+**You Could Lose Your Money:** mining requires an investment of time and money with no\n+guarantee of return. Never invest more money into bitcoins or mining\n+equipment than you can afford to lose.\n+\n+![Warning icon](/img/icon_warning.svg)\n+**Watch Out For Scams:** many scams surround Bitcoin mining. Several common\n+scams are [described in this guide][section scams], but you should also remain on guard\n+against new or uncommon scams.\n+\n+\n+\n+\n+## Theory\n+\n+Bitcoin mining protects the Bitcoin network and releases new bitcoins\n+into circulation.\n+\n+To understand mining, it's useful to understand that you can't actually\n+give someone bitcoins. Instead, you can digitally sign a promise to give\n+someone *control* over a certain amount of bitcoins. The receiver of\n+that promise can then digitally sign another promise to give someone\n+else control over those bitcoins.\n+\n+![Users Sign Promises To Give Control Over Bitcoins To Other People](/img/mining/en-unvalidated-promises.svg)\n+\n+Nobody wants to accept promises over the Internet from people they don't\n+know or trust, so Bitcoin mining validates these promises and makes it\n+difficult for anyone to take back or change a promise they made earlier.\n+This lets people trust the mining process rather than the person who\n+made the promise.\n+\n+![Mining Validates And Protects Promises So Users Who Get Paid, Stay Paid](/img/mining/en-mining-validation.svg)\n+\n+Mining also releases new bitcoins into circulation. In this special\n+case, miners are allowed to give themselves control over a certain\n+amount of new bitcoins, which allows them to later pass on control of those\n+bitcoins to other people.\n+\n+Many people focus on mining as the distribution of new bitcoins---it is\n+called mining after all---but unless users can trust mining to validate\n+and protect promises, Bitcoin is useless and bitcoins have no value.\n+\n+\n+### Record Keeping\n+\n+Bitcoin relies on signed promises which are vulnerable to a particular\n+type of fraud, called **double spending,** where a fraudster signs two\n+contradictory promises, one saying \"I give control over my only bitcoin\n+to Alice\" and another promise saying \"I give control over my only\n+bitcoin to Bob.\"\n+\n+Only one of these promises can be accepted. It doesn't matter which one\n+as long as people know which promise won't be accepted. If Bob knows\n+the promise he received won't be accepted, he won't give anything to the\n+fraudster, so it will be attempted fraud rather than actual fraud.\n+\n+Preventing double spending is as simple as keeping a record of accepted\n+promises. We only accept a promise if the person who makes that promise\n+actually controls the bitcoins he's promising to give away and if that\n+promise is signed with his cryptographic signature. In the example\n+above, only one of the promises gets added to the record, so when Bob\n+checks the record to see whether the promise he received is accepted (and\n+discovers it's not), he knows not to give anything to the fraudster.\n+\n+### Bitcoin Lottery\n+\n+Who do we trust to keep the record of accepted promises? If the\n+fraudster controls the record, he can lie to both Alice and Bob, telling\n+them that his promises are on the record when they're not. If nobody\n+controls the record, then there can be competing records, some that have\n+the promise to Alice and some that have the promise to Bob. Instead,\n+Bitcoin holds a decentralized lottery to decide which promises to add to\n+the record.\n+\n+In the decentralized lottery, everyone creates their own tickets and\n+everyone knows in advance what the winning number is. Tickets are a\n+collection of data which includes one or more promises. When you run\n+this data through a formula, it produces a seemingly-random number,\n+called a **hash.** If that hash number is less than the winning number\n+(called a **target**), you have a winning ticket.\n+\n+### Proof Of Work\n+\n+You can create as many decentralized lottery tickets as you want, but it\n+takes a certain amount of computing work to check each ticket. If the\n+ticket is a loser, that work seems wasted---but the only way to find a\n+winning ticket is to check a lot of losing tickets. That means a winning\n+ticket in the Bitcoin lottery proves that a lot of work was done to find\n+it, called **proof of work.**\n+\n+![Checking Random Hash Numbers From Many Different Tickets Requires Work](/img/mining/en-ticket-checking.svg)\n+\n+Work uses resources that could be used elsewhere, so proof of work is\n+proof that somebody sacrificed something in return for creating a\n+winning lottery ticket. This sacrifice must be made by everyone who\n+wants to create a winning ticket---even fraudsters. This allows\n+Bitcoin to create incentives that can reward **honest miners** for their\n+sacrifice and punish fraudsters for trying to change the record of\n+promises.\n+\n+\n+\n+\n+### The Block Chain\n+\n+Because each miner creates his own tickets with whatever data he\n+chooses, it's not possible to prove when a miner found a ticket.\n+This means a the first winning ticket found doesn't necessarily win\n+the lottery.\n+\n+Having only one winning ticket is important, because the promises on\n+that ticket get added to the official record of promises. If we had two\n+winning tickets, they could add conflicting promises, which doesn't\n+work. We must also prevent someone from later changing which ticket won\n+the lottery or a replacement ticket could change the official\n+record and remove some of the promises people relied upon. Bitcoin\n+partly solves \n+this problem the same way it partly solves the official record problem\n+in the first place: another lottery.\n+\n+In order to create a valid ticket for a particular lottery, that ticket\n+must include the winning number of a ticket from the previous lottery.\n+\n+![Tickets Must Include The Winning Hash Number Of A Ticket From The Previous Lottery](/img/mining/en-sequential-chain.svg)\n+\n+The tickets form a chain with each winning ticket linking to a\n+previous winning ticket. Whenever there are two or more winning tickets\n+for a particular lottery, we find which ticket is part of the **longest\n+chain** and declare that the actual winning ticket.\n+\n+![Winning Tickets Must Be Part Of The Longest Chain To Be Actual Winners](/img/mining/en-forked-chain.svg)\n+\n+This means a miner cannot change the official record by finding\n+winning tickets for a past lottery unless he also finds winning\n+tickets for every subsequent lottery up until the present. To\n+accomplish this, the miner must do more work (on average) than every\n+other miner combined. This requirement to do more work than everyone\n+else combined is the mechanism that punishes fraudsters for trying to\n+change the official record.\n+\n+The lottery tickets we've been talking about are called **blocks,** and the\n+longest chain of lottery tickets is called the Bitcoin **block chain.**  Each\n+block on the block chain holds one or more signed promises, called\n+**outputs** (which are part of **transactions**), making the block chain the\n+official record of promises in Bitcoin.  \n+\n+Honest miners who simply add blocks to the block chain (instead of\n+trying to change anything) receive a **block reward** of bitcoins for\n+each block they find, currently valued at 25 bitcoins or more.\n+\n+\n+### Attacks\n+\n+Users can trust the block chain (official record) instead of each other,\n+making Bitcoin useful for sending wealth over the Internet. But the same\n+miners who build the block chain can also attack it, making Bitcoin less\n+useful and bitcoins less valuable.\n+\n+#### Majority Attack\n+\n+Recall from the [block chain section][section the block chain] that a miner must do more work\n+than every other miner combined in order to find enough winning tickets\n+(valid blocks) to change the official record (the block chain). This is\n+a **majority attack,** often called a **51% attack.**\n+\n+A miner who does the majority of work on the network can, given enough\n+time, change the results of any past lottery, allowing him to undo\n+previous transactions.  For example, he can:\n+\n+* **Steal For Himself:** Replace (double spend) a transaction where he paid Alice with a\n+  different transaction that pays himself, stealing back to himself\n+  the bitcoins he previously paid Alice.\n+\n+* **Steal For Others:** Offer to help other people replace (double spend) their previous\n+  transactions for a fee, letting them steal back to themselves the\n+  bitcoins they previously paid.\n+\n+* **Extort From Merchants:** Threaten to make purchases with bitcoin which he will later double\n+  spend unless merchants pay him an extortion fee today. (He can charge\n+  people this extortion fee based on the possibility of an attack even\n+  if he never actually attacks.)\n+\n+In short, a majority miner has the power to make Bitcoin completely\n+unreliable. The price of bitcoins should drop to zero when Bitcoin\n+becomes unreliable, making it hard for a majority miner to profit from\n+stealing or extorting now-worthless bitcoins. However, a majority miner\n+could find it worthwhile for other reasons to make Bitcoin unreliable,\n+so the Bitcoin community tries to discourage majority mining.\n+\n+\n+\n+#### Lucky Attack\n+\n+The majority attacker does more work than everyone else combined, so he\n+wins more lotteries than everyone else combined---which allows him to\n+create a longer block chain than everyone else combined, giving him\n+control over the official record.\n+\n+But lotteries are based on chance, and someone with **\"good luck\"** can\n+win two or more lotteries in a row even if they don't do a majority of\n+the work. This is usually pretty boring: if an honest miner adds two\n+blocks to the end of the block chain before anyone else, he simply gets\n+two block rewards---the same as if he had created any other two blocks.\n+\n+However, if a dishonest miner is willing to risk losing his block\n+reward, he can attempt to change the official record. Instead of trying\n+to add a block to the **tip** of the block chain, he tries to replace the\n+block at the current tip. To make this work, he has to also find the\n+next block so that he can choose his replacement block as the winner of\n+the previous lottery.\n+\n+![Lucky Attackers Find Multiple Blocks Before Honest Miners Find One](/img/mining/en-forked-chain-attack.svg)\n+\n+The attack fails if someone else adds one new block to the tip before\n+the attacker can find two blocks. Any work an attacker does on a failed\n+attack is sacrificed without earning back any bitcoins.\n+\n+Although luck is random, probabilities are predictable, so we can\n+estimate how many times a miner will have to try an attack before he\n+succeeds and how much income he will sacrifice in the process. To replace\n+a single block, as in the example above, a miner who does 5% of the work\n+on the network and who attempts to attack every block will succeed about\n+once every 19 hours by sacrificing about 48 bitcoins worth of income. He\n+can steal or extort back that lost income if he can:\n+\n+* **Steal For Himself:** Replace (double spend) transactions from the last block, where he paid\n+  other people more than 48 bitcoins, with new transactions that pay\n+  himself, stealing back to himself those 48-plus bitcoins.\n+\n+* **Steal For Others:** Offer to help other people replace their previous transactions from\n+  the last block for a fee totaling more than 48 bitcoins, letting them\n+  steal back to themselves the bitcoins they previously paid.\n+\n+* **Extort From Merchants:** Threaten to make purchases with bitcoin which he will later double\n+  spend unless merchants pay him an extortion fee today. (He can charge people\n+  this extortion fee based on the possibility of an attack even if he\n+  never actually attacks.)\n+\n+Bitcoin's lottery system helps users protect themselves from these\n+\"lucky attacks\" by giving each transaction a **confirmation** score\n+which increases by one for each block that protects that transaction.\n+The more blocks an attacker needs to find in a row before anyone else,\n+the more luck he needs to have. For example, the illustration below\n+shows that the 5% attacker could never practically attack a transaction\n+with six confirmations.\n+\n+![The Cost In Sacrificed Income Of An Attack On Confirmed Transactions](/img/mining/en-confirmed-double-spend-cost.svg)\n+\n+<!-- the average cost of a successful attack here is\n+\n+    r * h / p(h,b) - r * b\n+\n+Where _r_ is the block reward (25 BTC), _h_ is the percentage of network\n+hash rate, _p()_ is Satoshi's probability calculator from bitcoin.pdf\n+page 7, and _b_ is the number of blocks to create (confirmations plus\n+one). r * h is the average value of work used per attempt; p(h,b) is the\n+probability of success per attempt; r * b is the block reward from a\n+successful attack.\n+\n+The time (number of blocks elapsed) an attack takes is simply\n+\n+    1 / p(h,c)\n+-->\n+\n+However, an attacker who does 24.4% of the work on the network (called\n+**network hash rate**) could attack a transaction with six confirmations\n+for that cost of 48 bitcoins. As seen in the illustration above, the amount\n+of luck required to make a successful attack drops exponentially as an\n+attacker gets closer to becoming a majority miner.\n+\n+Just as the Bitcoin community discourages majority mining, it also to a\n+lesser extent discourages anyone from mining with a significant\n+fraction of the network hash rate because these miners can also make\n+Bitcoin unreliable. It would be preferable if nobody controlled the\n+roughly 15% network hash rate required to practically attack\n+transactions confirmed six times, and ideal if nobody controlled the\n+roughly 1% network hash rate required to practically attack transactions\n+confirmed just once.\n+\n+\n+\n+\n+\n+## Tools And Techniques\n+\n+Outside of Bitcoin itself, miners have created tools and techniques to\n+solve problems they've encountered trying to win the lottery:\n+\n+* **[Hardware And Software][section hardware and software]:** How can\n+  miners use specialized mining hardware that Bitcoin Core does not\n+  support? Miners develop and use specialized mining software which\n+  manages communication between mining equipment and Bitcoin software.\n+\n+* **[Pooling][section pooling]:** In the Bitcoin lottery, bad luck can delay a big miner's next payment\n+  by hours or days---but it can delay a small miner's payment by weeks\n+  or months---so how do we prevent bad luck from driving small miners\n+  out of business? Small miners become big miners when they work\n+  together, combining work and splitting rewards.\n+\n+* **[Shares][section shares]:** How can tiny miners combine work with small miners and ensure each\n+  miner gets paid fairly? Miners hold a miniature version of the lottery\n+  Bitcoin itself holds.\n+\n+* **[Decentralized Mining][section decentralized mining]:** How do small miners combine work without giving up control over\n+  their hardware to someone who can use it in an attack? Miners can\n+  choose from two different protocols that let them keep control over\n+  what they mine.\n+\n+\n+### Hardware And Software\n+\n+As Bitcoin has matured, people have begun splitting off parts of the\n+system so that they can focus on the needs of that particular part.\n+One part that was split off is the code for doing the work in\n+Bitcoin's proof of work, called **hashing.**\n+\n+This specialization ultimately moved the hashing to dedicated hardware,\n+called Application-Specific Integrated Circuits (**ASICs**), which vastly\n+outperform Bitcoin Core software running on a general computer.\n+\n+Bitcoin Core does not use ASICs directly. Instead, mining\n+software was developed which takes the information that needs to be\n+hashed, gives it to the ASIC, and returns the results to Bitcoin\n+Core or another specialized program.\n+\n+If the information that needs to be hashed comes primarily from your\n+own full node (such as Bitcoin Core), it's **decentralized mining.**\n+If the information comes from someone else's server, it's **centralized\n+mining.**\n+\n+**Resources:** The Bitcoin Wiki has lists of [mining hardware][wiki\n+mining hardware] and [mining software][wiki mining software]. On\n+BitcoinTalk there is a [mining hardware sub-forum][] and [mining software\n+sub-forum][].\n+\n+[wiki mining hardware]: https://en.bitcoin.it/wiki/Mining_hardware_comparison\n+[wiki mining software]: https://en.bitcoin.it/wiki/Mining_software\n+[mining software sub-forum]: https://bitcointalk.org/index.php?board=42.0\n+[mining hardware sub-forum]: https://bitcointalk.org/index.php?board=76.0\n+\n+\n+\n+### Pooling\n+\n+Bitcoin is designed so that about one block is created on average every\n+600 seconds (10 minutes). If there are 10,000 Bitcoin miners, that means\n+the average miner is only creating a block (on average) once every 70\n+days.\n+\n+Even worse, mining is a chance-based lottery, so sometimes a miner will\n+get paid earlier than expected (called \"lucky\" or \"good luck\") and\n+sometimes the miner will get paid later than expected (called \"unlucky\"\n+or \"bad luck\"). The chance of getting paid follows an exponential\n+distribution; for example, here is the distribution for a miner who\n+should get paid on average every 70 days:\n+\n+![The Variance Of An Average (1/10,000) Miner](/img/mining/en-variance.svg)\n+\n+As you can see, this imaginary \"average\" miner with\n+1/10,000<sup>th</sup> of the network hash rate will find a valid block\n+about 50% of the time in less than 50 days---faster than his average\n+rate (mean). But about 25% of the time, it will take him over 100 days and one\n+time in a hundred (1%), he will have to mine without reward for over 300\n+days before finding a valid block---most of that time wondering whether\n+his equipment is broken.\n+\n+This spread of probable lengths of time between finding blocks is\n+called **variance.** As hash rate increases linearly, variance decreases\n+exponentially, so a miner with twice as much hash rate has four times\n+less variance. This means a miner with twice as much hash rate gets\n+paid (on average) twice as often---as you'd expect---but also four times\n+more consistently.\n+\n+![The Variance Of An Average (1/10,000) Miner Miners 2x, 4x, And 8x Faster](/img/mining/en-variance-comparison.svg)\n+\n+(Don't confuse the distribution graph above with progress. There is\n+no such thing as being a certain percent of the way towards finding\n+a block. Even a miner who waits a million days might not find a\n+valid block---because finding blocks is random. The distribution\n+just tells us how likely it is a miner will find a block within a\n+certain amount of time.)\n+\n+Small miners who want more consistent payments (less variance) often\n+pool their hashing with other small miners to solve blocks together\n+and split the reward, creating **mining pools** with much hash rate and\n+little variance.\n+\n+\n+\n+\n+\n+### Shares\n+\n+In a pool, not all miners have the same hash rate, so they use Bitcoin's\n+proof-of-work mechanism to allow each miner to prove how much work they did.\n+\n+In Bitcoin, a proof of work is a block with a hash (random number) below\n+a certain target. For example, imagine choosing random numbers between 0\n+and 99. Ten percent of the time (on average), a random number will be\n+below a target of 10, and one percent of the time (on average), a\n+random number will be below a target of 1.\n+\n+More usefully, ten percent of the random numbers below 10 will also be\n+below 1 (on average). Pools use this math to allow miners to prove they\n+did a share of the work even when they don't find valid blocks. In this\n+example, the pool target is 10 and the network target is 1, so we\n+can say there are (on average) 10 **\"shares\"** for every valid block and\n+each share is worth 1/10<sup>th</sup> of a block.\n+\n+![The Simulated Distribution Of 100 Random Numbers Showing Blocks, Shares, And Invalid Blocks](/img/mining/en-shares.svg)\n+\n+Every time a miner finds a share with a hash number below the pool\n+target, he submits it to the pool. Most of these shares will be invalid\n+blocks because they're above the network target, but the pool gives the\n+miner credit for the proof of work they demonstrate. When the miner\n+submits a share which is a valid block, the pool gives the miner credit\n+for it as a share and then forwards the block to the network so it gets\n+added to the block chain. The reward that block earns is then split\n+among the pool members in proportion to the number of shares (proofs of\n+work) they submitted.\n+\n+Recall from the Pooling section above that variance decreases\n+exponentially as frequency increases linearly, so miners who receive 10\n+shares for every block they create have 100 times less payment variance.\n+However, pools cannot profitably pay for shares until a proportionate\n+number of blocks have been created, so most pools don't pay every share\n+for the full value of work it demonstrates---instead they use some sort\n+of payment adjustment formula that reduces or delays some payments.\n+\n+**Resources:** although somewhat dated, Meni Rosenfeld's [Analysis of\n+Bitcoin Pooled Mining Reward Systems][] remains an excellent detailed\n+description of pool payment formulas.  The Bitcoin Wiki has a [simple\n+overview of the formulas][], and the [Mining Pools Subform][] on\n+BitcoinTalk has posts describing all popular pools in detail.\n+\n+[Analysis of Bitcoin Pooled Mining Reward Systems]: https://bitcointalk.org/index.php?topic=32814.0\n+[simple overview of the formulas]: https://en.bitcoin.it/wiki/Comparison_of_mining_pools\n+[Mining Pools Subform]: https://bitcointalk.org/index.php?board=41.0\n+\n+\n+### Decentralized Mining\n+\n+There are different ways of participating in a pool. Some miners\n+don't run a full node such as Bitcoin core but instead\n+slave their mining equipment to a pool server, trusting that their\n+equipment will be used honestly to generate new blocks. This trust is\n+sometimes misplaced, leading to the equipment being used to perform\n+double spend fraud.  \n+\n+![Mining Only What The Pool Server Requests (Centralized Mining)](/img/mining/en-centralized-mining.svg)\n+\n+Other miners also want to join a pool for the reduced variance, but\n+they're not willing to risk participating in an [attack][section attacks] that can\n+reduce user trust in the Bitcoin mining process and lower bitcoin\n+prices. Instead, these miners start up a full node so that they can\n+perform one of the decentralized mining methods described below:\n+\n+* **[Solo mining][section solo mining]:** The opposite of pool mining, solo mining is the\n+  simplest form of decentralized mining but also has the highest\n+  variance of any type of mining, so it is rarely a good option for\n+  small-scale miners.\n+\n+* **[P2Pool][section p2pool]:** requires one additional software\n+  installation over solo mining and greatly reduces variance, so it is\n+  an excellent option for all miners. In addition, some people donate\n+  bitcoins to P2Pool miners as a thanks for helping prevent double spend\n+  attacks, increasing miner income.\n+\n+* **[GetBlockTemplate][section getblocktemplate]:** can allow you to join certain\n+  pools and still build your own blocks in a decentralized mode,\n+  reducing variance without letting someone else make choices for you.\n+  However, instructions describing how to use that mode with standard\n+  mining software are not available as of this writing.\n+\n+\n+\n+#### Solo Mining\n+\n+Although rarely done today, **solo mining** is done by miners who\n+attempt to find blocks on their own using just decentralized full node\n+software such as Bitcoin Core.\n+\n+![Creating Your Own Blocks With Solo Mining (Decentralized Mining)](/img/mining/en-solo-mining.svg)\n+\n+Unless you control hundreds or thousands of bitcoins worth of mining\n+equipment, solo mining has very high variance, so you might have to wait\n+months or years before finding a block.  P2Pool, described below, is\n+almost certainly a better option for most miners.\n+\n+\n+\n+#### P2Pool\n+\n+P2Pool is a decentralized mining\n+pool that reduces variance but still lets miners build their own blocks\n+using data from their own full nodes.\n+\n+P2Pool keeps track of pool shares in a decentralized way by building an\n+alternative block chain called the share chain. New shares are added to\n+the share chain on average every 30 seconds instead of Bitcoin's every\n+10 minutes. Occasionally one of these shares is also a valid\n+block for the Bitcoin block chain.\n+\n+![Comparison Of The Bitcoin Block Chain And P2Pool Share Chain](/img/mining/en-share-chain-block-chain.svg)\n+\n+To use P2Pool, you run the P2Pool open source software along with a full\n+node such as Bitcoin Core. The P2Pool program can then create block\n+templates using data from your full node, send the template to your\n+mining software, and return the shares and blocks you find to the P2Pool\n+and Bitcoin decentralized networks.\n+\n+![Peer-To-Peer Creating Your Own Blocks (P2Pool Decentralized Mining)](/img/mining/en-p2pool-decentralized-mining.svg)\n+\n+Variance for P2Pool miners is reduced significantly, not only because\n+shares are created 20 times as often as blocks but also because P2Pool\n+miners are only competing against other P2Pool miners to create shares.\n+\n+For example, recall our imaginary \"average\" miner from the [Pooling][section pooling]\n+section who does 1/10,000<sup>th</sup> of the work on the Bitcoin network and so\n+has to wait about 70 days on average to create a block. If there are 400\n+of these average miners on P2Pool, they'll each individually create a\n+share about every 3.4 hours and collectively create a valid block about every\n+4.2 hours---which is much preferable to waiting 70 days on average.\n+\n+<!-- Math for shares: 400 equal miners divided by 2 shares per minute\n+divided by 60 minutes per hour. Math for blocks: 1/6 hours per block\n+divided by 400/10,000ths (4%) of network hash rate. -->\n+\n+However, very small miners might still encounter high variance in share\n+creation. Large P2Pool miners can optionally increase their variance\n+slightly to significantly decrease variance for smaller P2Pool miners\n+without changing how much each miner earns on average. It has been\n+proposed that if P2Pool grows too big for small miners, it can split\n+into several different decentralized networks so that all miners can\n+obtain low variance.\n+\n+A number of people in the Bitcoin community support P2Pool's\n+decentralized mining by contributing bitcoins to P2Pool miners based on\n+the amount of work each miner has recently done. This has lead many\n+P2Pool miners to report that they made more money mining on P2Pool than\n+if they had mined in any other way.\n+\n+**Resources:** The [P2Pool home page][] has instructions for getting\n+started and the Bitcoin Wiki has a more [detailed description of\n+P2Pool][] along with [instructions for donating to P2Pool miners][]\n+(requires running a P2Pool node, which you can do without mining).\n+\n+[P2Pool home page]: http://p2pool.in/\n+[detailed description of P2Pool]: https://en.bitcoin.it/wiki/P2Pool\n+[instructions for donating to P2Pool miners]: https://en.bitcoin.it/wiki/P2Pool#Donating_to_P2Pool_miners\n+\n+\n+\n+#### GetBlockTemplate\n+\n+The GetBlockTemplate (GBT) mining data protocol supported by some mining\n+pools allows for both centralized and decentralized mining.\n+\n+Pool servers using GetBlockTemplate send to each miner all of the\n+data required to create a valid block for that pool, allowing the\n+miner to inspect the data for double spend attempts. Miners can also\n+perform decentralized mining by getting transactions from their own full\n+node, such as Bitcoin Core, and using those transactions instead of the\n+optional transactions in the template.\n+\n+![Evaluating Pool Requests And Creating Your Own Blocks (Decentralized Mining)](/img/mining/en-decentralized-mining.svg)\n+\n+Unfortunately, as of this writing, no mining software takes full\n+advantage of what GetBlockTemplate offers for decentralized mining.\n+\n+\n+\n+\n+\n+\n+## Income And Expenses\n+\n+The income source most people associate with mining is the new block\n+reward, currently valued at 25 bitcoins for each new block mined. This\n+reward halves approximately every four years (210,000 blocks); it is\n+expected to reduce to 12.5 bitcoins around the middle of 2016.\n+\n+Closely related are the transaction fees a miner collects from\n+transactions included in a block.  These vary over time and by miner\n+policy, but they have so far generally been less than one bitcoin for\n+each block mined.\n+\n+In addition, there are several non-financial rewards:\n+\n+* **Help/Hurt Bitcoin:** People who want to see Bitcoin succeed can [choose to mine honestly][section choose to be honest] to\n+  improve transaction security. On the other hand, people who want to\n+  see Bitcoin fail can also mine, deliberately using their hashes to try\n+  to make transactions less reliable.\n+\n+* **Voting Rights:** Miners can use their hash rate to easily vote on whether to allow or\n+  discourage changes to some parts of the Bitcoin network. For example,\n+  miners voted in 2012 to allow a new transaction type. Although\n+  non-miners can also influence Bitcoin decision making, they generally\n+  must take time to establish a reputation in the community and then\n+  advocate for the decision they want.\n+\n+* **Anonymous Income:** Mining can be as anonymous as it is possible to be when using the\n+  Internet. If a miner uses privacy technology correctly, and if that\n+  technology works as expected, a miner may be able to earn bitcoins\n+  which cannot be traced back to the miner.  (The miner must also use\n+  privacy protection when spending the coins.)\n+\n+People who desire the non-financial rewards may be willing to mine at\n+smaller profit margins or even at a loss, making it more difficult for\n+profit-seeking miners to compete with them.\n+\n+![Warning icon](/img/icon_warning.svg)\n+**Rough Guesses Only:** the formulas in the following subsections are not always\n+the most precise formulas available. We selected less precise formulas\n+when they were simpler, so you can use them more easily. That doesn't\n+mean more precise formulas will give you better results---with bitcoin\n+prices and other key factors changing often, no mining revenue formula\n+can provide you with anything better than rough guesses. *Use these\n+formulas (or any others) at your own risk.*\n+\n+### Base Income\n+\n+As of this writing, miners tend to spend most of their money on\n+equipment whose performance is measured in how many hashes per second\n+(H/s) it produces. For convenience, hash rates are usually reported in\n+gigahashes (GH/s), terahashes (TH/s), or petahashes (PH/s):\n+\n+GH/s | 1 billion H/s   | 10<sup>9</sup> H/s\n+TH/s | 1 thousand GH/s | 10<sup>12</sup> H/s\n+PH/s | 1 thousand TH/s | 10<sup>15</sup> H/s\n+\n+Mining is a lottery, so your equipment competes against everyone elses'\n+equipment. That means, for new equipment, you need to know how many\n+hashes per second everyone elses' equipment will produce at the time you\n+start using your equipment. \n+\n+There's no way to predict the future network hash rate, but you can make\n+a guess. As of this writing, network hash rate typically increases by\n+about 0.5% to 3.0% a day---meaning a piece of equipment is about 0.5% to\n+3.0% less competitive each day.\n+\n+Using the calculator below, we can see that 10.0 TH/s of mining\n+equipment which will be delivered in thirty days is equivalent to having\n+7.4 TH/s of mining equipment today if hash rate increases by 1% a day:\n+\n+<form class=\"mining-calculator\" id=\"calc-diff\" action=\"javascript:void(null);\" method=\"post\" onSubmit=\"calculate_todays_terms();\">\n+<table>\n+<tr>\n+    <th width=\"30%\">Hash Rate Of Equipment To Buy</th>\n+    <th>Estimated Difficulty Increase Per Day</th>\n+    <th>Days Until Equipment Is Operational</th>\n+    <th>Result:<br/>Hash Rate In Today's Terms</th></tr>\n+<tr>\n+    <td><input id=\"diff_rate\" type=\"number\" value=\"10.0\" step=\"0.1\" onchange=\"calculate_todays_terms()\" style=\"width: 70px;\" /><select id=\"diff_multiplier\" onchange=\"calculate_todays_terms()\">\n+        <option value=\"GH/s\">GH/s</option>\n+        <option value=\"TH/s\" selected=\"true\" >TH/s</option>\n+        <option value=\"PH/s\">PH/s</option>\n+    </select></td>\n+    <td><label><input id=\"diff_diff_increase\" onchange=\"calculate_todays_terms()\" step=\"0.5\" type=\"number\" value=\"1.0\" style=\"width: 50px;\"/>%</label></td>\n+    <td><label><input id=\"diff_days\" onchange=\"calculate_todays_terms()\" type=\"number\" step=\"1\" value=\"30\" style=\"width:70px;\" /></label></td>\n+    <td><label><input id=\"diff_result\" type=\"text\" style=\"width:200px;\" /></label></td>","path":"en/mining.md","position":716,"original_position":716,"commit_id":"2630025518e9b9952c3ac44cdd8d742b70eec3e4","original_commit_id":"2630025518e9b9952c3ac44cdd8d742b70eec3e4","user":{"login":"saivann","id":3578089,"avatar_url":"https://avatars.githubusercontent.com/u/3578089?","gravatar_id":"4f83828df8b42aa574d4669b9ceba5e8","url":"https://api.github.com/users/saivann","html_url":"https://github.com/saivann","followers_url":"https://api.github.com/users/saivann/followers","following_url":"https://api.github.com/users/saivann/following{/other_user}","gists_url":"https://api.github.com/users/saivann/gists{/gist_id}","starred_url":"https://api.github.com/users/saivann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saivann/subscriptions","organizations_url":"https://api.github.com/users/saivann/orgs","repos_url":"https://api.github.com/users/saivann/repos","events_url":"https://api.github.com/users/saivann/events{/privacy}","received_events_url":"https://api.github.com/users/saivann/received_events","type":"User","site_admin":false},"body":"Maybe you could add the `disabled` attribute here to prevent the user from typing text in this input box:\r\n\r\n    <input id=\"diff_result\" type=\"text\" style=\"width:200px;\" disabled />","created_at":"2014-07-24T05:22:51Z","updated_at":"2014-07-24T05:22:51Z","html_url":"https://github.com/harding/bitcoin.org/pull/8#discussion_r15330392","pull_request_url":"https://api.github.com/repos/harding/bitcoin.org/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/comments/15330392"},"html":{"href":"https://github.com/harding/bitcoin.org/pull/8#discussion_r15330392"},"pull_request":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/harding/bitcoin.org/pulls/8","id":18344222,"html_url":"https://github.com/harding/bitcoin.org/pull/8","diff_url":"https://github.com/harding/bitcoin.org/pull/8.diff","patch_url":"https://github.com/harding/bitcoin.org/pull/8.patch","issue_url":"https://api.github.com/repos/harding/bitcoin.org/issues/8","number":8,"state":"open","title":"Preview Pull For Mining Guide","user":{"login":"harding","id":61096,"avatar_url":"https://avatars.githubusercontent.com/u/61096?","gravatar_id":"85ef1c19ed24912607f512e1b1dc3bd0","url":"https://api.github.com/users/harding","html_url":"https://github.com/harding","followers_url":"https://api.github.com/users/harding/followers","following_url":"https://api.github.com/users/harding/following{/other_user}","gists_url":"https://api.github.com/users/harding/gists{/gist_id}","starred_url":"https://api.github.com/users/harding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harding/subscriptions","organizations_url":"https://api.github.com/users/harding/orgs","repos_url":"https://api.github.com/users/harding/repos","events_url":"https://api.github.com/users/harding/events{/privacy}","received_events_url":"https://api.github.com/users/harding/received_events","type":"User","site_admin":false},"body":"Created this to help keep track of work being done before the pull request against the main bitcoin.org repository.  Feedback both here and on the mailing list is welcome.\r\n\r\n**Warning:** the commits shown on this pull will be squashed down to one commit per author for the real pull.","created_at":"2014-07-14T11:55:02Z","updated_at":"2014-07-24T05:22:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d23f4d06ee7f04542798bef0421c192ffcc5111","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/harding/bitcoin.org/pulls/8/commits","review_comments_url":"https://api.github.com/repos/harding/bitcoin.org/pulls/8/comments","review_comment_url":"https://api.github.com/repos/harding/bitcoin.org/pulls/comments/{number}","comments_url":"https://api.github.com/repos/harding/bitcoin.org/issues/8/comments","statuses_url":"https://api.github.com/repos/harding/bitcoin.org/statuses/2630025518e9b9952c3ac44cdd8d742b70eec3e4","head":{"label":"harding:mining","ref":"mining","sha":"2630025518e9b9952c3ac44cdd8d742b70eec3e4","user":{"login":"harding","id":61096,"avatar_url":"https://avatars.githubusercontent.com/u/61096?","gravatar_id":"85ef1c19ed24912607f512e1b1dc3bd0","url":"https://api.github.com/users/harding","html_url":"https://github.com/harding","followers_url":"https://api.github.com/users/harding/followers","following_url":"https://api.github.com/users/harding/following{/other_user}","gists_url":"https://api.github.com/users/harding/gists{/gist_id}","starred_url":"https://api.github.com/users/harding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harding/subscriptions","organizations_url":"https://api.github.com/users/harding/orgs","repos_url":"https://api.github.com/users/harding/repos","events_url":"https://api.github.com/users/harding/events{/privacy}","received_events_url":"https://api.github.com/users/harding/received_events","type":"User","site_admin":false},"repo":{"id":19798699,"name":"bitcoin.org","full_name":"harding/bitcoin.org","owner":{"login":"harding","id":61096,"avatar_url":"https://avatars.githubusercontent.com/u/61096?","gravatar_id":"85ef1c19ed24912607f512e1b1dc3bd0","url":"https://api.github.com/users/harding","html_url":"https://github.com/harding","followers_url":"https://api.github.com/users/harding/followers","following_url":"https://api.github.com/users/harding/following{/other_user}","gists_url":"https://api.github.com/users/harding/gists{/gist_id}","starred_url":"https://api.github.com/users/harding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harding/subscriptions","organizations_url":"https://api.github.com/users/harding/orgs","repos_url":"https://api.github.com/users/harding/repos","events_url":"https://api.github.com/users/harding/events{/privacy}","received_events_url":"https://api.github.com/users/harding/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harding/bitcoin.org","description":"Bitcoin.org website","fork":true,"url":"https://api.github.com/repos/harding/bitcoin.org","forks_url":"https://api.github.com/repos/harding/bitcoin.org/forks","keys_url":"https://api.github.com/repos/harding/bitcoin.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harding/bitcoin.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harding/bitcoin.org/teams","hooks_url":"https://api.github.com/repos/harding/bitcoin.org/hooks","issue_events_url":"https://api.github.com/repos/harding/bitcoin.org/issues/events{/number}","events_url":"https://api.github.com/repos/harding/bitcoin.org/events","assignees_url":"https://api.github.com/repos/harding/bitcoin.org/assignees{/user}","branches_url":"https://api.github.com/repos/harding/bitcoin.org/branches{/branch}","tags_url":"https://api.github.com/repos/harding/bitcoin.org/tags","blobs_url":"https://api.github.com/repos/harding/bitcoin.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harding/bitcoin.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harding/bitcoin.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/harding/bitcoin.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harding/bitcoin.org/statuses/{sha}","languages_url":"https://api.github.com/repos/harding/bitcoin.org/languages","stargazers_url":"https://api.github.com/repos/harding/bitcoin.org/stargazers","contributors_url":"https://api.github.com/repos/harding/bitcoin.org/contributors","subscribers_url":"https://api.github.com/repos/harding/bitcoin.org/subscribers","subscription_url":"https://api.github.com/repos/harding/bitcoin.org/subscription","commits_url":"https://api.github.com/repos/harding/bitcoin.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/harding/bitcoin.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/harding/bitcoin.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/harding/bitcoin.org/issues/comments/{number}","contents_url":"https://api.github.com/repos/harding/bitcoin.org/contents/{+path}","compare_url":"https://api.github.com/repos/harding/bitcoin.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harding/bitcoin.org/merges","archive_url":"https://api.github.com/repos/harding/bitcoin.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harding/bitcoin.org/downloads","issues_url":"https://api.github.com/repos/harding/bitcoin.org/issues{/number}","pulls_url":"https://api.github.com/repos/harding/bitcoin.org/pulls{/number}","milestones_url":"https://api.github.com/repos/harding/bitcoin.org/milestones{/number}","notifications_url":"https://api.github.com/repos/harding/bitcoin.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harding/bitcoin.org/labels{/name}","releases_url":"https://api.github.com/repos/harding/bitcoin.org/releases{/id}","created_at":"2014-05-14T22:43:19Z","updated_at":"2014-07-14T11:52:09Z","pushed_at":"2014-07-23T12:53:03Z","git_url":"git://github.com/harding/bitcoin.org.git","ssh_url":"git@github.com:harding/bitcoin.org.git","clone_url":"https://github.com/harding/bitcoin.org.git","svn_url":"https://github.com/harding/bitcoin.org","homepage":"http://www.bitcoin.org/","size":10062,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"harding:master","ref":"master","sha":"a977ad4097011e50ef2d0fd7125832fb062da324","user":{"login":"harding","id":61096,"avatar_url":"https://avatars.githubusercontent.com/u/61096?","gravatar_id":"85ef1c19ed24912607f512e1b1dc3bd0","url":"https://api.github.com/users/harding","html_url":"https://github.com/harding","followers_url":"https://api.github.com/users/harding/followers","following_url":"https://api.github.com/users/harding/following{/other_user}","gists_url":"https://api.github.com/users/harding/gists{/gist_id}","starred_url":"https://api.github.com/users/harding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harding/subscriptions","organizations_url":"https://api.github.com/users/harding/orgs","repos_url":"https://api.github.com/users/harding/repos","events_url":"https://api.github.com/users/harding/events{/privacy}","received_events_url":"https://api.github.com/users/harding/received_events","type":"User","site_admin":false},"repo":{"id":19798699,"name":"bitcoin.org","full_name":"harding/bitcoin.org","owner":{"login":"harding","id":61096,"avatar_url":"https://avatars.githubusercontent.com/u/61096?","gravatar_id":"85ef1c19ed24912607f512e1b1dc3bd0","url":"https://api.github.com/users/harding","html_url":"https://github.com/harding","followers_url":"https://api.github.com/users/harding/followers","following_url":"https://api.github.com/users/harding/following{/other_user}","gists_url":"https://api.github.com/users/harding/gists{/gist_id}","starred_url":"https://api.github.com/users/harding/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harding/subscriptions","organizations_url":"https://api.github.com/users/harding/orgs","repos_url":"https://api.github.com/users/harding/repos","events_url":"https://api.github.com/users/harding/events{/privacy}","received_events_url":"https://api.github.com/users/harding/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/harding/bitcoin.org","description":"Bitcoin.org website","fork":true,"url":"https://api.github.com/repos/harding/bitcoin.org","forks_url":"https://api.github.com/repos/harding/bitcoin.org/forks","keys_url":"https://api.github.com/repos/harding/bitcoin.org/keys{/key_id}","collaborators_url":"https://api.github.com/repos/harding/bitcoin.org/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/harding/bitcoin.org/teams","hooks_url":"https://api.github.com/repos/harding/bitcoin.org/hooks","issue_events_url":"https://api.github.com/repos/harding/bitcoin.org/issues/events{/number}","events_url":"https://api.github.com/repos/harding/bitcoin.org/events","assignees_url":"https://api.github.com/repos/harding/bitcoin.org/assignees{/user}","branches_url":"https://api.github.com/repos/harding/bitcoin.org/branches{/branch}","tags_url":"https://api.github.com/repos/harding/bitcoin.org/tags","blobs_url":"https://api.github.com/repos/harding/bitcoin.org/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/harding/bitcoin.org/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/harding/bitcoin.org/git/refs{/sha}","trees_url":"https://api.github.com/repos/harding/bitcoin.org/git/trees{/sha}","statuses_url":"https://api.github.com/repos/harding/bitcoin.org/statuses/{sha}","languages_url":"https://api.github.com/repos/harding/bitcoin.org/languages","stargazers_url":"https://api.github.com/repos/harding/bitcoin.org/stargazers","contributors_url":"https://api.github.com/repos/harding/bitcoin.org/contributors","subscribers_url":"https://api.github.com/repos/harding/bitcoin.org/subscribers","subscription_url":"https://api.github.com/repos/harding/bitcoin.org/subscription","commits_url":"https://api.github.com/repos/harding/bitcoin.org/commits{/sha}","git_commits_url":"https://api.github.com/repos/harding/bitcoin.org/git/commits{/sha}","comments_url":"https://api.github.com/repos/harding/bitcoin.org/comments{/number}","issue_comment_url":"https://api.github.com/repos/harding/bitcoin.org/issues/comments/{number}","contents_url":"https://api.github.com/repos/harding/bitcoin.org/contents/{+path}","compare_url":"https://api.github.com/repos/harding/bitcoin.org/compare/{base}...{head}","merges_url":"https://api.github.com/repos/harding/bitcoin.org/merges","archive_url":"https://api.github.com/repos/harding/bitcoin.org/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/harding/bitcoin.org/downloads","issues_url":"https://api.github.com/repos/harding/bitcoin.org/issues{/number}","pulls_url":"https://api.github.com/repos/harding/bitcoin.org/pulls{/number}","milestones_url":"https://api.github.com/repos/harding/bitcoin.org/milestones{/number}","notifications_url":"https://api.github.com/repos/harding/bitcoin.org/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/harding/bitcoin.org/labels{/name}","releases_url":"https://api.github.com/repos/harding/bitcoin.org/releases{/id}","created_at":"2014-05-14T22:43:19Z","updated_at":"2014-07-14T11:52:09Z","pushed_at":"2014-07-23T12:53:03Z","git_url":"git://github.com/harding/bitcoin.org.git","ssh_url":"git@github.com:harding/bitcoin.org.git","clone_url":"https://github.com/harding/bitcoin.org.git","svn_url":"https://github.com/harding/bitcoin.org","homepage":"http://www.bitcoin.org/","size":10062,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/8"},"html":{"href":"https://github.com/harding/bitcoin.org/pull/8"},"issue":{"href":"https://api.github.com/repos/harding/bitcoin.org/issues/8"},"comments":{"href":"https://api.github.com/repos/harding/bitcoin.org/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/harding/bitcoin.org/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/harding/bitcoin.org/statuses/2630025518e9b9952c3ac44cdd8d742b70eec3e4"}}}}