<?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=Forrestv</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=Forrestv"/>
	<link rel="alternate" type="text/html" href="https://en.bitcoin.it/wiki/Special:Contributions/Forrestv"/>
	<updated>2026-05-17T09:53:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=56933</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=56933"/>
		<updated>2015-06-12T13:17:28Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Infobox company&lt;br /&gt;
|name=P2Pool&lt;br /&gt;
|trading_name=P2Pool&lt;br /&gt;
|industry=[[Mining pool]]&lt;br /&gt;
|foundation=July 17, 2011&lt;br /&gt;
|hashrate=1.6 Phash/s&lt;br /&gt;
|website= http://p2pool.in&lt;br /&gt;
}}&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;P2Pool&#039;&#039;&#039; is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 30 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every thirty seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last 3 day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 20 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.8.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stale&lt;br /&gt;
* Subscribe to the [https://groups.google.com/forum/#!forum/p2pool-notifications P2Pool notifications] mailing list for urgent pool status updates&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~30 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net bitcoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interoperability table ==&lt;br /&gt;
P2pool works fine with most hardware. This lists some of the hardware confirmed to work and any special configuration required.&lt;br /&gt;
&lt;br /&gt;
* ASICminer blade 10GH/s (Requires adding +1 to username or proxy)&lt;br /&gt;
* Avalon 110nm 60-110 GH/s (All batches)&lt;br /&gt;
* Avalon based 55nm 200 GH/s (specific makers?)&lt;br /&gt;
* Avalon prototype 55nm 120GH/s (~ 20 exist)&lt;br /&gt;
* Icarus FPGA&lt;br /&gt;
* Bitfury strikes back H-card and M-card ([https://bitcointalk.org/index.php?topic=18313.msg4424081#msg4424081 instructions])&lt;br /&gt;
* Bitmain Antminer S1 180GH/s ([https://github.com/AntMiner/AntGen1/tree/master/firmware Requires 20131226 firmware.])&lt;br /&gt;
* Bitmain Antminer S3 440GH/s&lt;br /&gt;
* BFL SC Jalapeno, SC Single 30, 50, &amp;amp; 60 GH/s&lt;br /&gt;
* Spondoolies Tech SP 10&lt;br /&gt;
* Spondoolies Tech SP 30&lt;br /&gt;
&lt;br /&gt;
(Various GPU and most FPGAs other than BFL single FPGAs work fine too)&lt;br /&gt;
&lt;br /&gt;
This is a list of hardware with known issues that should not be used on p2pool.&lt;br /&gt;
&lt;br /&gt;
* Cointerra Terraminer IV (10-20% hash rate loss when mining on p2pool)&lt;br /&gt;
* Btimain Antminer S2 (10-20% hash rate loss when mining on p2pool, the S1 &amp;amp; S3 both work well on p2pool)&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you need to replace 127.0.0.1 with the address of your P2Pool node if you&#039;re not running one locally.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==Sponsors==&lt;br /&gt;
&lt;br /&gt;
Thanks to:&lt;br /&gt;
&lt;br /&gt;
* The [https://bitcoinfoundation.org/ Bitcoin Foundation] for its generous support of P2Pool&lt;br /&gt;
* The [https://litecoin.org/ Litecoin Project] for its generous donations to P2Pool&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* Up-to-date P2Pool mining stats: [http://minefast.coincadence.com/p2pool-stats.php Minefast.CoinCadence.com P2Pool stats]&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
* [http://p2pool-nodes.info/ p2pool-nodes.info] Another public list of P2Pool (BTC) nodes.&lt;br /&gt;
* [http://whatisp2pool.com whatisp2pool.com] An easy introduction to mining and P2Pool.&lt;br /&gt;
* [https://bitcointalk.org/index.php?topic=18313 Bitcointalk thread]&lt;br /&gt;
* [http://organofcorti.blogspot.com/2012/11/52-p2pool-achieving-expectations.html?m=1 Statistical analysis of P2Pool from Neighborhood Pool Watch]&lt;br /&gt;
* [http://chimera.labs.oreilly.com/books/1234000001802/ch08.html#mining_pools P2Pool section] of &amp;lt;i&amp;gt;[[Mastering Bitcoin]]&amp;lt;/i&amp;gt; by [[Wikipedia:Andreas Antonopoulos|Andreas M. Antonopoulos]]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;br /&gt;
{{Pools}}&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=50455</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=50455"/>
		<updated>2014-08-23T01:40:19Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: p2pool.info has been fixed for a while now&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{infobox company|name=P2Pool&lt;br /&gt;
|trading_name=P2Pool&lt;br /&gt;
|industry=[[Mining pool]]&lt;br /&gt;
|foundation=July 17, 2011&lt;br /&gt;
|hashrate=1.6 Phash/s&lt;br /&gt;
}}&lt;br /&gt;
Links: http://p2pool.in/ - https://github.com/forrestv/p2pool - https://en.bitcoin.it/wiki/P2Pool - https://bitcointalk.org/index.php?topic=18313&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 30 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every thirty seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last 3 day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 20 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.8.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~30 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net bitcoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interoperability table ==&lt;br /&gt;
P2pool works fine with most hardware. This lists some of the hardware confirmed to work and any special configuration required.&lt;br /&gt;
&lt;br /&gt;
* ASICminer blade 10GH/s (Requires adding +1 to username or proxy)&lt;br /&gt;
* Avalon 110nm 60-110 GH/s (All batches)&lt;br /&gt;
* Avalon based 55nm 200 GH/s (specific makers?)&lt;br /&gt;
* Avalon prototype 55nm 120GH/s (~ 20 exist)&lt;br /&gt;
* Icarus FPGA&lt;br /&gt;
* Bitfury strikes back H-card and M-card ([https://bitcointalk.org/index.php?topic=18313.msg4424081#msg4424081 instructions])&lt;br /&gt;
* Bitmain Antminer S1 180GH/s ([https://github.com/AntMiner/AntGen1/tree/master/firmware Requires 20131226 firmware.])&lt;br /&gt;
* Bitmain Antminer S3 440GH/s&lt;br /&gt;
* BFL SC Jalapeno, SC Single 30, 50, &amp;amp; 60 GH/s&lt;br /&gt;
* Spondoolies Tech SP 10&lt;br /&gt;
* Spondoolies Tech SP 30&lt;br /&gt;
&lt;br /&gt;
(Various GPU and most FPGAs other than BFL single FPGAs work fine too)&lt;br /&gt;
&lt;br /&gt;
This is a list of hardware with known issues that should not be used on p2pool.&lt;br /&gt;
&lt;br /&gt;
* Cointerra Terraminer IV (10-20% hash rate loss when mining on p2pool)&lt;br /&gt;
* Btimain Antminer S2 (10-20% hash rate loss when mining on p2pool, the S1 &amp;amp; S3 both work well on p2pool)&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you need to replace 127.0.0.1 with the address of your P2Pool node if you&#039;re not running one locally.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==Sponsors==&lt;br /&gt;
&lt;br /&gt;
Thanks to:&lt;br /&gt;
&lt;br /&gt;
* The [https://bitcoinfoundation.org/ Bitcoin Foundation] for its generous support of P2Pool&lt;br /&gt;
* The [https://litecoin.org/ Litecoin Project] for its generous donations to P2Pool&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
* [http://p2pool-nodes.info/ p2pool-nodes.info] Another public list of P2Pool (BTC) nodes.&lt;br /&gt;
* [http://whatisp2pool.com whatisp2pool.com] An easy introduction to mining and P2Pool.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;br /&gt;
{{Pools}}&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=43666</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=43666"/>
		<updated>2014-01-10T23:26:50Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: removed mentions of http://127.0.0.1:9332/ , which isn&amp;#039;t actively maintained&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Links: http://p2pool.in/ - https://github.com/forrestv/p2pool - https://en.bitcoin.it/wiki/P2Pool - https://bitcointalk.org/index.php?topic=18313&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every thirty seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.8.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Interoperability table ==&lt;br /&gt;
P2pool works fine with most hardware. This lists some of the hardware confirmed to work and any special configuration required.&lt;br /&gt;
&lt;br /&gt;
* ASICminer blade 10GH/s (Requires adding +1 to username or proxy)&lt;br /&gt;
* Avalon 110nm 60-110 GH/s (All batches)&lt;br /&gt;
* Avalon based 55nm 200 GH/s (specific makers?)&lt;br /&gt;
* Avalon prototype 55nm 120GH/s (~ 20 exist)&lt;br /&gt;
* Icarus FPGA&lt;br /&gt;
* Bitfury strikes back H-card and M-card ([https://bitcointalk.org/index.php?topic=18313.msg4424081#msg4424081 instructions])&lt;br /&gt;
* Bitmain Antminer S1 180GH/s ([https://github.com/AntMiner/AntGen1/tree/master/firmware Requires 20131226 firmware.])&lt;br /&gt;
* BFL SC Jalapeno, SC Single 30, 50, &amp;amp; 60 GH/s&lt;br /&gt;
&lt;br /&gt;
(Various GPU and most FPGAs other than BFL single FPGAs work fine too)&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you need to replace 127.0.0.1 with the address of your P2Pool node if you&#039;re not running one locally.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://127.0.0.1:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==Sponsors==&lt;br /&gt;
&lt;br /&gt;
Thanks to:&lt;br /&gt;
&lt;br /&gt;
* The [https://bitcoinfoundation.org/ Bitcoin Foundation] for its generous support of P2Pool&lt;br /&gt;
* The [https://litecoin.org/ Litecoin Project] for its generous donations to P2Pool&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
* [http://whatisp2pool.com whatisp2pool.com] An easy introduction to mining and P2Pool.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=42221</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=42221"/>
		<updated>2013-11-07T23:57:12Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added sponsors&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Links: http://p2pool.in/ - https://github.com/forrestv/p2pool - https://en.bitcoin.it/wiki/P2Pool - https://bitcointalk.org/index.php?topic=18313&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every thirty seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==Sponsors==&lt;br /&gt;
&lt;br /&gt;
Thanks to:&lt;br /&gt;
&lt;br /&gt;
* The [https://bitcoinfoundation.org/ Bitcoin Foundation] for its generous support of P2Pool&lt;br /&gt;
* The [https://litecoin.org/ Litecoin Project] for its generous donations to P2Pool&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=41550</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=41550"/>
		<updated>2013-10-04T04:52:07Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Links: http://p2pool.in/ - https://github.com/forrestv/p2pool - https://en.bitcoin.it/wiki/P2Pool - https://bitcointalk.org/index.php?topic=18313&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every thirty seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Avalon&amp;diff=39668</id>
		<title>Avalon</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Avalon&amp;diff=39668"/>
		<updated>2013-07-18T21:50:22Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated p2pool information&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Avalon&#039;&#039;&#039; is a company that produces bitcoin mining hardware.&lt;br /&gt;
&lt;br /&gt;
= Pictures =&lt;br /&gt;
[[File:Avalon-case.jpg | 320px]] [[File:Avalon-eth-wifi.jpg | 320px]] [[File:Avalon-side-1.jpg | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Avalon-side-2.jpg | 320px]] [[File:Avalon-fan.jpg | 320px]] [[File:Avalon-modular-4.jpg | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Avalon-detail.JPG | 320px]] [[File:Avalon-side-3.jpg | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Avalon-IR-1.jpg | 320px]] [[File:Avalon-IR-2.jpg | 320px]]&lt;br /&gt;
&lt;br /&gt;
= Hardware Information =&lt;br /&gt;
== [https://bitcointalk.org/index.php?topic=120184.msg1294416#msg1294416 Chip Specification] ==&lt;br /&gt;
[[File:Avalon-A3256-Q48-front.png | 320px]] [[File:Avalon-A3256-Q48-foot.png | 320px]] [[File:Avalon-A3256-Q48-foot-side.png | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Avalon-A3256-Q48-foot-1.png | 320px]] [[File:Avalon-A3256-Q48-foot-detail.png | 320px]] [[File:Avalon-A3256-Q48-front-side-1.png | 320px]]&lt;br /&gt;
&lt;br /&gt;
 Technology Summary:&lt;br /&gt;
    TSMC 0.11- micron G process&lt;br /&gt;
        5 Metal&lt;br /&gt;
 Core Voltage: 1.2 V&lt;br /&gt;
 I/O Voltage: 3.3 V&lt;br /&gt;
 Core Frequency: 256+ MHz&lt;br /&gt;
 Number of Pads: 48&lt;br /&gt;
    8 Data&lt;br /&gt;
    40+1 Power&lt;br /&gt;
 Package Type: QFN48 -0.5 Pitch&lt;br /&gt;
 Packaged Chip Size: 7 mm x 7 mm&lt;br /&gt;
 &lt;br /&gt;
 Chip Interface&lt;br /&gt;
 Data Pins (8 in total):&lt;br /&gt;
 Clock                     i&lt;br /&gt;
 Serial Data In  [2]       i&lt;br /&gt;
 Serial Data Out [2]       o&lt;br /&gt;
 Serial Data Bypass [2]    o&lt;br /&gt;
 Reserved    [1]    -&lt;br /&gt;
&lt;br /&gt;
== Wafer ==&lt;br /&gt;
 TSMC&lt;br /&gt;
 TMEM91&lt;br /&gt;
 Chip Size :   X = 3.9760 ,Y = 4.0560 mm&lt;br /&gt;
 Reticle Size :   X/cell =  3 ,Y/cell =  3&lt;br /&gt;
 Offset Value :   X = -3.7668 ,Y = -2.2990 mm&lt;br /&gt;
 Alignment Mark :   (118.80,83.20),(-118.80,-83.20)&lt;br /&gt;
 Alignment Mark Tolerant Distance :      1.6 mm&lt;br /&gt;
 Notch Reserved Distance :   7.75 mm&lt;br /&gt;
 Start Distance :   7.75 mm&lt;br /&gt;
 Ring Edge :   3.0 mm&lt;br /&gt;
 Photo Die Number:    4055&lt;br /&gt;
&lt;br /&gt;
== Power ==&lt;br /&gt;
 Chip power efficienty: 6.6W/GHs @ 1.15 V&lt;br /&gt;
 Module power consumption: 149W @ 20GHs / 164W@ 22GHs&lt;br /&gt;
 Machine power consumption: 595W @ 220V-AC / 620W @ 120V-AC&lt;br /&gt;
&lt;br /&gt;
=== Comfirmed working PSU list ===&lt;br /&gt;
* [http://www.antec.com.cn/product.php?id=NzA0MjY0 ANTEC EA-650 GREEN]&lt;br /&gt;
* [http://www.enermax.cn/Products_Pages.asp?ID=188&amp;amp;SortID=1 Enermax GX650]&lt;br /&gt;
* [http://www.enermax.cn/Products_Pages.asp?ID=189&amp;amp;SortID=1 Enermax GX750]&lt;br /&gt;
* [http://www.corsair.com/cn/power-supply-units/gs-series-power-supply-units/gs-series-gs700-80-plus-bronze-certified-power-supply-840.html CORSAIR GS700]&lt;br /&gt;
* [http://www.corsair.com/cn/power-supply-units/gs-series-power-supply-units/gs-series-gs800-80-plus-bronze-certified-power-supply-841.html CORSAIR GS800]&lt;br /&gt;
* [http://www.super-flower.com.cn/gb/pro_detail.asp?id=212 Super-Flower(振华) SF-650P14XE(GX)]&lt;br /&gt;
* [http://www.enermax.cn/Products_Pages.asp?ID=145&amp;amp;SortID=1 Enermax 金魔冰核1000W(suit for 4 modules, a little bit long)]&lt;br /&gt;
* [http://ocz.com/consumer/psu/zx-series-850w-1250w-power-supply OCZ ZX Series 1250W]&lt;br /&gt;
&lt;br /&gt;
=== The PSU Spec ===&lt;br /&gt;
* &#039;&#039;&#039;155mm&#039;&#039;&#039; recommend,  MAX: 170mm&lt;br /&gt;
* For 3 module units:    650W, 48A 12V, at least. recommend for a 20% margin.&lt;br /&gt;
* For 4 module units:    750W, 60A 12V, at least. recommend for a 20% margin.&lt;br /&gt;
* Plugs:&lt;br /&gt;
** 1X ATX 24PIN&lt;br /&gt;
** 1X EPS 12V (8PIN)&lt;br /&gt;
** 2X PCIE 12V (8PIN)&lt;br /&gt;
&lt;br /&gt;
== The TP-LINK WR703N ==&lt;br /&gt;
[[File:avalon-703n-back.JPG | 320px]] [[File:avalon-703n-front.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
== Control Unit ==&lt;br /&gt;
[[File:avalon-controlunit-v1.2.JPG | 320px]]  [[File:avalon-controlunit-v1.2-fpga.JPG | 320px]] [[File:avalon-controlunit-v1.2-usb-serail-chip.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:avalon-controlunit-v1.2-spi-flash.JPG | 320px]] [[File:avalon-controlunit-v1.2-usb-connector.JPG | 320px]]  [[File:avalon-temperature-sensor-1.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:avalon-controlunit-v1.2-P5.JPG | 320px]] [[File:avalon-controlunit-v1.2-by-ngzhang.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
== PDU ==&lt;br /&gt;
[[File:avalon-pdu-v1.2.JPG | 320px]]&lt;br /&gt;
[[File:avalon-pdu-v1.2-side.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
== Parts ==&lt;br /&gt;
[[File:avalon-fpga-controller-led-detail.JPG | 320px]] [[File:avalon-fpga-controller-led.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:avalon-modular-date-cable-head.JPG | 320px]] [[File:avalon-modular-date-cable.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:avalon-modular-power-cable-head.JPG | 320px]] [[File:avalon-modular-power-cable.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
[[File:avalon-temperature-sensor-detail.JPG | 320px]] [[File:avalon-temperature-sensor.JPG | 320px]]&lt;br /&gt;
&lt;br /&gt;
= User Guide =&lt;br /&gt;
* Connect your laptop to the eithernet port of the Avalon&lt;br /&gt;
* Setup your laptop IP address 192.168.0.101&lt;br /&gt;
* Open http://192.168.0.100&lt;br /&gt;
* Make sure WR703N can access Internet, Configure WiFi:  Network -&amp;gt; WIFI -&amp;gt; Scan(select your WIFI network) -&amp;gt; Join Network -&amp;gt; WPA passphrase -&amp;gt; Submit -&amp;gt; Save &amp;amp; Apply for connect to WIFI Internet&lt;br /&gt;
* setup your mining worker: Status -&amp;gt; Cgminer Configuration. &lt;br /&gt;
* Restart the cgminer service:  System -&amp;gt; Startup, &lt;br /&gt;
* Check your avalon status:  Status -&amp;gt; Cgminer Status&lt;br /&gt;
* Setup password/using ssh&lt;br /&gt;
 ssh root@192.168.0.100 # Once you setup the password the telnet service will be stop. use ssh instead.&lt;br /&gt;
&lt;br /&gt;
== Cgminer option ==&lt;br /&gt;
&#039;&#039;&#039;--avalon-options 115200:24:10:45:282&#039;&#039;&#039;. this is the default avalon option. here is the details:&lt;br /&gt;
 &#039;&#039;&#039;115200&#039;&#039;&#039;: the serial baud. this have to match the controller baud.&lt;br /&gt;
 &#039;&#039;&#039;24&#039;&#039;&#039;: the miner count.(there are 3 modulars in avalon. each modular have 8 miners), if your avalon have 4 modulars. change it to 32&lt;br /&gt;
 &#039;&#039;&#039;10&#039;&#039;&#039;: the chip count pre miner.&lt;br /&gt;
 &#039;&#039;&#039;45&#039;&#039;&#039;: the controller timeout parameter. the valid number: 50, 47, 45, 40.&lt;br /&gt;
 &#039;&#039;&#039;282&#039;&#039;&#039;: the chip clock. the valid number: 256, 270, 282, 300.&lt;br /&gt;
&lt;br /&gt;
== Run cgminer manually ==&lt;br /&gt;
In case you need to run Cgminer in linux console please run the following command:&lt;br /&gt;
*Restart Cgminer:&lt;br /&gt;
 # /etc/init.d/cgminer restart&lt;br /&gt;
&lt;br /&gt;
If your avalon does not mine properly, please run Cgminer in debug mode with -D --verbose option. For example:&lt;br /&gt;
 # cgminer -S /dev/ttyUSB0 -o stratum.btcguild.com:3333 -O xxxx:yyyy -D --verbose --avalon-options 115200:24:10:45:282 --api-allow &amp;quot;W:0/0&amp;quot; --api-listen 2&amp;gt;/tmp/cgminer-debug.log&lt;br /&gt;
&lt;br /&gt;
== TP-LINK TL-WR703N ==&lt;br /&gt;
There is a modify version of TP-LINK TP-WR703N inside Avalon. cgminer running at 703n, this 703n have 64MB ram and modified power supply. it power from the usb-client side(we moved a 0R resistor from &#039;&#039;&#039;J1&#039;&#039;&#039; to &#039;&#039;&#039;R113&#039;&#039;&#039; for that)&lt;br /&gt;
&lt;br /&gt;
Why there is a ugly USB HUB there?  you can find more information about AR9331&#039;s usb stability issue [https://forum.openwrt.org/viewtopic.php?id=39956 here].&lt;br /&gt;
&lt;br /&gt;
=== How to reflash ===&lt;br /&gt;
# Download latest Avalon [http://downloads.qi-hardware.com/people/xiangfu/avalon/latest/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin image] to your PC.&lt;br /&gt;
# Goto:&lt;br /&gt;
  System -&amp;gt; Backup / Flash Firmware -&amp;gt; Flash new firmware image (make sure &#039;&#039;&#039;Keep settings&#039;&#039;&#039; is checked)&lt;br /&gt;
# Select the image you just download. then compare the md5 in next page. if everything fine. click &#039;&#039;&#039;Proceed&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Attention:&#039;&#039;&#039; To avoid your WR703N become a brick, during flash your WR703N be careful DO NOT power off avalon, and DO NOT break your network connection. Just wait there till you see OpenWrt login web page again.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Attention:&#039;&#039;&#039; If not essential please do not re-Flash your Avalon. Because not all of WR703N issue could be resolved by reset button. If you want to play WR703N I would like to recommend you order a standalone TP-LINK WR703N from ebay or somewhere for studying purpose.&lt;br /&gt;
&lt;br /&gt;
== WIFI or Ethernet Cable ? ==&lt;br /&gt;
Avalon shipped with a 9db antenna after connect it to WR703N usually could establish good wireless connection with your WIFI router. But if for some reason you would like to use Ethernet Cable to connect Avalon with your network, please login OpenWrt and configure the LAN port:&lt;br /&gt;
 Network -&amp;gt; Interfaces -&amp;gt; LAN -&amp;gt; Edit -&amp;gt; Common Configuration -&amp;gt; General Setup&lt;br /&gt;
 Disable the DHCP on Lan port&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Attention:&#039;&#039;&#039; You need to configure it correctly based on your own network enviroment. If anything wrong you might could not access your WR703N any more.&lt;br /&gt;
&lt;br /&gt;
== Start to mine ==&lt;br /&gt;
To maximize your Avalon miner&#039;s performance, it is recommended that you choose pools with the stratum protocol supported. The default mining pool configured in Avalon is ozco.in. To change it login to OpenWrt:&lt;br /&gt;
 Status -&amp;gt; Cgminer Configuration&lt;br /&gt;
 Click &amp;quot;Save &amp;amp; Apply&amp;quot; to save your update and restart cgminer immediately&lt;br /&gt;
&lt;br /&gt;
Currently the stratum pools that could work stable with Avalon are:&lt;br /&gt;
* [http://50btc.com/ 50BTC.com]&lt;br /&gt;
* [https://bitcointalk.org/index.php?topic=158105.0 Solo mining with Eloipool]&lt;br /&gt;
* [http://bitminter.com BitMinter]&lt;br /&gt;
* [http://eligius.st Eligius]&lt;br /&gt;
* [https://www.ozcoin.net Ozcoin]&lt;br /&gt;
* [http://www.btcguild.com btcguild]&lt;br /&gt;
* [http://mining.bitcoin.cz slush&#039;s pool]&lt;br /&gt;
* [http://www.triplemining.com Triplemining]&lt;br /&gt;
&lt;br /&gt;
To get more information about how to configure specific pools, please check their website. If you run multiple Avalons, we recommend that you create a dedicated worker for each of them. This will make it easier to monitor your Avalons through the pool&#039;s website and identify possible problems.&lt;br /&gt;
&lt;br /&gt;
== Source code ==&lt;br /&gt;
* https://github.com/BitSyncom/cgminer/tree/avalon&lt;br /&gt;
* https://github.com/BitSyncom/cgminer-openwrt-packages&lt;br /&gt;
* https://github.com/BitSyncom/luci/tree/cgminer-webui&lt;br /&gt;
* https://github.com/BitSyncom/avalon-extras&lt;br /&gt;
&lt;br /&gt;
== FPGA controller ==&lt;br /&gt;
=== V1.0 ~ V1.2 ===&lt;br /&gt;
About &#039;&#039;&#039;P5&#039;&#039;&#039; jumper: close this jumper will supply 5V to the USB-B port. in this system, the controller board power the 703N from the client side. if you connect the controller itself to a PC, you better remove the jumper.&lt;br /&gt;
&lt;br /&gt;
=== V1.5 ===&lt;br /&gt;
[[File:Avalon fpga controller v1.5.jpg | 320px]] [[File:Avalon fpga controller v1.5 usb hub.jpg | 320px]]&lt;br /&gt;
* Remove the &#039;&#039;&#039;[http://www3.picturepush.com/photo/a/13207881/1024/Anonymous/avf1.png F1(Fuse)]&#039;&#039;&#039; for fix the USB-HUB chip overheat, &lt;br /&gt;
# if you are batch2 user and your received Avalon between &#039;&#039;&#039;Apr 26 2013 ~ May 31 2013&#039;&#039;&#039;&lt;br /&gt;
# the FPGA controller is &#039;&#039;&#039;1.5&#039;&#039;&#039;&lt;br /&gt;
# your FPGA contoller board still have &#039;&#039;&#039;F1 mounted&#039;&#039;&#039;&lt;br /&gt;
you need do this by yourself.  removing F1 will not make the usb hub stop working, F1 powers the USB-A1 plug (which is normally unused), more info please checkout [https://github.com/BitSyncom/avalon-ref/issues/5 here]&lt;br /&gt;
&lt;br /&gt;
=== V1.51 ===&lt;br /&gt;
* Fixed USB-HUB chip overheat, NO NEEDS remove F1 anymore&lt;br /&gt;
&lt;br /&gt;
== Update FPGA controller firmware (NOT FINISHED/FULL DOCUMENT YET) ==&lt;br /&gt;
[[File:Fpga-controller-jtag-pins.png]]&lt;br /&gt;
&lt;br /&gt;
* Update under Avalon 703N: http://downloads.qi-hardware.com/people/xiangfu/avalon/fpga-controller/&lt;br /&gt;
* http://en.qi-hardware.com/w/images/f/ff/M1_JTAGserialpod_Pins.JPG&lt;br /&gt;
&lt;br /&gt;
 #mini-jtag load xc6slx16-2-ftg256.bscan_s6_spi_isf_ext.bit &amp;amp;&amp;amp; sleep 1 &amp;amp;&amp;amp; xc3sprog -c qi -v -I fpga_controller_2013-05-02-D.bit&lt;br /&gt;
 xc3sprog -c qi xc6slx16-2-ftg256.bscan_s6_spi_isf_ext.bit &amp;amp;&amp;amp; sleep 1 &amp;amp;&amp;amp; xc3sprog -c qi -v -I fpga_controller_2013-05-02-D.bit&lt;br /&gt;
 xc3sprog -c qi -v -I file.bin:R:0:bin&lt;br /&gt;
 dd if=file.bin bs=68 skip=1 of=file2.bin&lt;br /&gt;
 xc3sprog -c qi -v -I file2.bin:w:0:bin&lt;br /&gt;
 rm -f file.bin file2.bin&lt;br /&gt;
&lt;br /&gt;
== P2Pool Operation with Avalon ==&lt;br /&gt;
&lt;br /&gt;
Doing anything special is no longer required as of commit 11d63ef66 (which is yet unreleased). Since the recent P2Pool hardfork, dead-on-arrival rates of about 6% are normal, close to normal GPU rates (1-2%), so mining is nearly as efficient as solo mining.&lt;br /&gt;
&lt;br /&gt;
== About [usb 1-1: clear tt 1 (8030) error -71] ==&lt;br /&gt;
 Not all 703n have this problem. ignore this section if you never meet this error&lt;br /&gt;
&lt;br /&gt;
* There is a power issue with the 703N, The 703N is drawing to much power it caused the USB HUB chip on Senseless&#039;s FPGA controller to nearly destroy itself. See the destruction [ http://www.mysenselesslife.com/avalon/DSCN5212.JPG here]&lt;br /&gt;
&lt;br /&gt;
* In order to fix it you need had to &#039;&#039;&#039;power down the WiFi modem by disable it&#039;&#039;&#039;, use Eithernet instead. The kernel no long report -71 errors. thanks to senseless and others who help on identify the issue.&lt;br /&gt;
&lt;br /&gt;
* If your avalon was far away from your router. eithernet cable not fit. you may want try those kind of devices&lt;br /&gt;
** TP-LINK TL-PA500(For mainland China) : http://www.tp-link.com.cn/product_adapter_263.html&lt;br /&gt;
** TP-LINK TL-PA511 : http://www.tp-link.com/en/products/details/?model=TL-PA511&lt;br /&gt;
&lt;br /&gt;
== Others ==&lt;br /&gt;
* There is a pair of gloves in Avalon package. please put it on when assembling or carrying.&lt;br /&gt;
&lt;br /&gt;
* About the plastic sheets: please &#039;&#039;&#039;remove them BEFORE&#039;&#039;&#039; mining. we design the case as a part of heatsink, so remove the plastic sheets is a must&lt;br /&gt;
&lt;br /&gt;
* About FAN change: &#039;&#039;&#039;DO NOT&#039;&#039;&#039; change the fans to a low speed model. will cause over heat. &#039;&#039;&#039;DO NOT&#039;&#039;&#039; install extra fans at the rear &amp;quot;fan socket&amp;quot;. will cause PSU over heat and nearly useless for module cooling.&lt;br /&gt;
&lt;br /&gt;
* About install extra heat-sinks on each avalon chip: please do not do that. there is a air gap between the die and package top, install a heatsink on chip is useless. and will cause overheating. because  the top PCB copper act as a heatsink too. do not cover them.&lt;br /&gt;
&lt;br /&gt;
* About water cooling: yes, do it.&lt;br /&gt;
&lt;br /&gt;
= [http://downloads.qi-hardware.com/people/xiangfu/avalon/ Firmware] =&lt;br /&gt;
* Check your firmware version by goto &#039;&#039;&#039;Cgminer Status&#039;&#039;&#039; page&lt;br /&gt;
* Latest Firmware is [http://downloads.qi-hardware.com/people/xiangfu/avalon/latest/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory.bin here]&lt;br /&gt;
* The Avalon firmware SDK: [http://downloads.qi-hardware.com/people/xiangfu/avalon/latest/OpenWrt-SDK-ar71xx-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2 here]&lt;br /&gt;
&lt;br /&gt;
== [http://downloads.qi-hardware.com/people/xiangfu/avalon/next-testing/ NEXT] ==&lt;br /&gt;
 Please always using the latest testing image for testing.&lt;br /&gt;
&lt;br /&gt;
* New options for Avalon&lt;br /&gt;
 --avalon-auto       Adjust avalon overclock frequency dynamically for best hashrate&lt;br /&gt;
 --avalon-cutoff &amp;lt;arg&amp;gt; Set avalon overheat cut off temperature (default: 60)&lt;br /&gt;
 --avalon-fan &amp;lt;arg&amp;gt;  Set fanspeed percentage for avalon, single value or range (default: 20-100)&lt;br /&gt;
 --avalon-freq &amp;lt;arg&amp;gt; Set frequency range for avalon-auto, single value or range&lt;br /&gt;
 --avalon-options &amp;lt;arg&amp;gt; Set avalon options baud:miners:asic:timeout:freq&lt;br /&gt;
 --avalon-temp &amp;lt;arg&amp;gt; Set avalon target temperature (default: 50)&lt;br /&gt;
&lt;br /&gt;
== [http://downloads.qi-hardware.com/people/xiangfu/avalon/20130607/ 20130607] ==&lt;br /&gt;
* &#039;&#039;&#039;Update cgminer to 3.2.1&#039;&#039;&#039;, we have the direct USB feature now.&lt;br /&gt;
* Add --lowmem by default&lt;br /&gt;
* cgminer-monitor: change the schedule from 5mins to 2mins&lt;br /&gt;
* cgminer-monitor: switch from Diff1 work to Last Valid Work&lt;br /&gt;
* Disable DHCP on lan port.&lt;br /&gt;
* Remove custom DNS (8.8.8.8)&lt;br /&gt;
* Some minor changes on web page&lt;br /&gt;
&lt;br /&gt;
== [http://downloads.qi-hardware.com/people/xiangfu/avalon/20130519/ 20130519] ==&lt;br /&gt;
* &#039;&#039;&#039;Update cgminer to 3.1.1&#039;&#039;&#039;&lt;br /&gt;
* Add &#039;&#039;&#039;More Options&#039;&#039;&#039; on web configure page(you can add 4th,5th pool here now)&lt;br /&gt;
* Disable hotplug. useless on Avalon&lt;br /&gt;
* Include  &#039;&#039;&#039;usbmon&#039;&#039;&#039; in firmware, prepare/debug for usb code, this was for developers&lt;br /&gt;
* Dynamic display [match_work_count*] base on Modular Count&lt;br /&gt;
* You may want add &#039;&#039;&#039;--real-quiet&#039;&#039;&#039; under Cgminer Configuration --&amp;gt; More Options after upgrade&lt;br /&gt;
* Change 300MHS timeout from 40 to 43&lt;br /&gt;
* Change Modular Count(3 ~ 4) to Miner Count(1 ~ 32) on webui&lt;br /&gt;
* Switch buildhost from Ubuntu 12.10 to Debian 7.0.0&lt;br /&gt;
* NOTE: If your Pool URLs have trailing slash &#039;&#039;&#039;remove the trailing slash&#039;&#039;&#039; (symptom is: [2013-06-04 19:05:30] Failed to resolve (?wrong URL) host.name.com:PORT/ and/or all Pools with trailing slash listed as DEAD in status)&lt;br /&gt;
&lt;br /&gt;
== [http://downloads.qi-hardware.com/people/xiangfu/avalon/20130419 20130419] ==&lt;br /&gt;
* &#039;&#039;&#039;Merged to cgminer. BIG thanks to conman&#039;&#039;&#039;. so we have all cgminer&#039;s improvment&lt;br /&gt;
* Idle avalon chips after reset. for save power. (idle needs ~50W)&lt;br /&gt;
* Fix the cgminer restart bug.&lt;br /&gt;
* Fix temp/fan have wrong value(the wrong result from fpga controller)&lt;br /&gt;
* Fix the fan control. now base on the max value of temp2/3&lt;br /&gt;
* Fix no_matching_work only count in debug mode&lt;br /&gt;
* Update cgminer-monitor,  replace [Accept] with [Diff1 Work], add killall before restart. &lt;br /&gt;
* Fix a typo on /usr/bin/cgminer-monitor&lt;br /&gt;
* &#039;&#039;&#039;More check/fliter on result. this make Avalon more stable&#039;&#039;&#039;&lt;br /&gt;
* New status page, new api log page.&lt;br /&gt;
* Improve the cgminer service. a restart takes ~2 seconds now. no needs ntpd when restart&lt;br /&gt;
* Quiet some improvments on software develop/codeing. compile Avalon firmware is much eaiser with [https://github.com/BitSyncom/avalon-extras/blob/master/scripts/build-avalon-image.sh build-avalon-image.sh]&lt;br /&gt;
* Frimware version:&lt;br /&gt;
 [Firmware Version] =&amp;gt; 20130419&lt;br /&gt;
 cgminer-8e8313c&lt;br /&gt;
 luci-28b4ff2&lt;br /&gt;
 cgminer-openwrt-packages-f2bc5dc&lt;br /&gt;
&lt;br /&gt;
== [http://downloads.qi-hardware.com/people/xiangfu/avalon/20130321/ 20130321] ==&lt;br /&gt;
*For fix the cgminer-monitor, please run this command after you reflash&lt;br /&gt;
  &#039;&#039;&#039;sed -i &#039;s/ $B / &amp;quot;$B&amp;quot; /&#039; /usr/bin/cgminer-monitor&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
If you &amp;quot;check the Keep settings&amp;quot;, you need fill API Allow to &amp;quot;W:127.0.0.1&amp;quot; after reflash, edit it here: &amp;quot;http://AVALON_IP/cgi-bin/luci/admin/status/cgminer/&amp;quot;, &amp;quot;DO NOT&amp;quot; left it blank&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&amp;lt;source lang=&amp;quot;c&amp;quot;&amp;gt;&lt;br /&gt;
If you &amp;quot;uncheck the Keep settings&amp;quot; when reflashing, Please &amp;quot;reconfigure your Avalon&amp;quot; after reflash&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Update Linux from 3.6 to 3.8.3&lt;br /&gt;
* Update OpenWrt to r36095&lt;br /&gt;
* When there is no network. automatic idle chip after detect avalon, save power and protect your avalon overheat&lt;br /&gt;
* Idle chip when cgminer close avalon&lt;br /&gt;
* Add device_reinit support&lt;br /&gt;
* Add frequency, modular configure on web ui&lt;br /&gt;
* Add API Allow on web ui&lt;br /&gt;
* Add pool balance on web ui, by default balance on all 3 pools&lt;br /&gt;
* Add stratum+tcp:// by default&lt;br /&gt;
* Display Frequency on status page&lt;br /&gt;
* Fix the [https://bitcointalk.org/index.php?topic=155455.0 kern.err kernel:    ... ath: phy0: ...] bug&lt;br /&gt;
* Fliter &amp;gt;=100 degree result for debug&lt;br /&gt;
* Replace TempMax with No Matching Work&lt;br /&gt;
&lt;br /&gt;
==[http://downloads.qi-hardware.com/people/xiangfu/avalon/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory-20130225.bin 20130225]==&lt;br /&gt;
* A new cgminer status page&lt;br /&gt;
* /etc/avalon_version include all repo commit&lt;br /&gt;
* Fix temp_history_count, make sure 2~3s call adjuest_fan&lt;br /&gt;
&lt;br /&gt;
==[http://downloads.qi-hardware.com/people/xiangfu/avalon/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory-20130218.bin 20130218]==&lt;br /&gt;
* Update adjust_fan()&lt;br /&gt;
* Using avaon default worker&lt;br /&gt;
&lt;br /&gt;
==[http://downloads.qi-hardware.com/people/xiangfu/avalon/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory-20130212.bin 20130212]==&lt;br /&gt;
* Update fan pwm&lt;br /&gt;
&lt;br /&gt;
==[http://downloads.qi-hardware.com/people/xiangfu/avalon/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory-20130205.bin 20130205]==&lt;br /&gt;
* Update fan pwm MAX/MIN&lt;br /&gt;
* Sync with upstream, fix the memory leak bug&lt;br /&gt;
* Monitor the Accept number&lt;br /&gt;
&lt;br /&gt;
==[http://downloads.qi-hardware.com/people/xiangfu/avalon/openwrt-ar71xx-generic-tl-wr703n-v1-squashfs-factory-20130127.bin 20130127]==&lt;br /&gt;
* Add overclock code&lt;br /&gt;
* Change the cgminer configure to UCI system&lt;br /&gt;
* Add the simple web ui&lt;br /&gt;
&lt;br /&gt;
==20130117==&lt;br /&gt;
* Update OpenWRt to r35097&lt;br /&gt;
* Update cgminer to 2.10.4&lt;br /&gt;
* Remove /www/miner.php, change cgminer cron job to */5&lt;br /&gt;
* Start ntpd before start cgminer&lt;br /&gt;
&lt;br /&gt;
== Test Plan ==&lt;br /&gt;
* New firmware don&#039;t break Avalon for sure&lt;br /&gt;
* New firmware don&#039;t use all flash. have to keep some space for save configuration&lt;br /&gt;
* Either and WiFI connect works fine&lt;br /&gt;
* Cgminer works fine(the kernel user driver, cgminer it self, cgminer-monitor and uci configurations files)&lt;br /&gt;
* After configure cgminer. [Save &amp;amp; Apply] can restart the cgminer&lt;br /&gt;
* The Status/API log page works fine&lt;br /&gt;
* Test mining&lt;br /&gt;
* Test the cgminer-monitor&lt;br /&gt;
* Make sure 80/22/4028 open on WAN.&lt;br /&gt;
&lt;br /&gt;
== Unofficial Firmware ==&lt;br /&gt;
* [https://bitcointalk.org/?topic=78192.msg1566545#msg1566545 Untested BFGMiner 3.0 alpha1 for Avalon]&lt;br /&gt;
&lt;br /&gt;
= How to Compile Your Own Firmware for Avalon =&lt;br /&gt;
1. First check if you have met the building prerequisites. Checkout this page first [http://wiki.openwrt.org/doc/howto/buildroot.exigence OpenWrt Buildroot – Installation]&lt;br /&gt;
&lt;br /&gt;
For example, if your OS is Ubuntu/Debian, install the required packages like this:&lt;br /&gt;
 sudo apt-get update&lt;br /&gt;
 sudo apt-get install  gawk flex quilt xsltproc  unzip subversion git-core build-essential libxml-parser-perl libncurses5-dev zlib1g-dev libssl-dev liblua5.1-0-dev&lt;br /&gt;
&lt;br /&gt;
2. Now get the source code, prepare the code and build. &#039;&#039;&#039;this needs ~6GB&#039;&#039;&#039;&lt;br /&gt;
 wget https://raw.github.com/BitSyncom/avalon-extras/master/scripts/build-avalon-image.sh&lt;br /&gt;
 chmod +x build-avalon-image.sh&lt;br /&gt;
 ./build-avalon-image.sh --clone #prepare the code and build, &#039;&#039;&#039;ONLY NEED ONCE&#039;&#039;&#039;&lt;br /&gt;
 ./build-avalon-image.sh&lt;br /&gt;
&lt;br /&gt;
3. Update all repos&lt;br /&gt;
  ./build-avalon-image.sh --update&lt;br /&gt;
&lt;br /&gt;
4. Only rebuild cgminer&lt;br /&gt;
 ./build-avalon-image.sh --cgminer&lt;br /&gt;
&lt;br /&gt;
5. Finally you could get the freshly built firmware files under &#039;&#039;&#039;avalon/bin/&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Compile with kernel usbmon ==&lt;br /&gt;
* You need apply [https://lists.openwrt.org/pipermail/openwrt-devel/2013-May/020107.html this patch] to your OpenWrt for enable [https://www.kernel.org/doc/Documentation/usb/usbmon.txt usbmon]&lt;br /&gt;
* Run &#039;&#039;&#039;make menuconfig&#039;&#039;&#039; goto  &#039;&#039;&#039;Kernel modules&#039;&#039;&#039; --&amp;gt; &#039;&#039;&#039;USB Support&#039;&#039;&#039; enable &#039;&#039;&#039;kmod-usb-mon&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
= IRC: #avalon @freenode.net =&lt;br /&gt;
 &#039;&#039;&#039;#avalon @freenode.net&#039;&#039;&#039; Thanks to midnightmagic create that channel&lt;br /&gt;
&lt;br /&gt;
= FAQ =&lt;br /&gt;
* Why there is a USB-HUB inside&lt;br /&gt;
 [https://forum.openwrt.org/viewtopic.php?id=39956  AR9331&#039;s usb stability issue]&lt;br /&gt;
&lt;br /&gt;
*Why ASIC bitcoin mining?&lt;br /&gt;
*Why Avalon?&lt;br /&gt;
*Who made Avalon?&lt;br /&gt;
*How to order one?&lt;br /&gt;
 http://store.avalon-asics.com/&lt;br /&gt;
&lt;br /&gt;
= Links =&lt;br /&gt;
* http://launch.avalon-asics.com/&lt;br /&gt;
* [https://bitcointalk.org/index.php?topic=140539.0;all Avalon ASIC users thread]&lt;br /&gt;
* http://garzikrants.blogspot.de/2013/01/avalon-asic-miner-review.html&lt;br /&gt;
* Jgarzik&#039;s solo mining [https://bitcointalk.org/index.php?topic=158105.0 configuration]&lt;br /&gt;
* [http://squonk42.github.io/TL-WR703N/ Reverse-Engineering work on the TL-WR703N 150M 802.11n Wi-Fi Router]&lt;br /&gt;
* http://3.14.by/en/read/avalon-bitcoin-microscope-photos&lt;br /&gt;
&lt;br /&gt;
= Donation =&lt;br /&gt;
* Ngzhang0: [https://blockchain.info/address/1kBGUHDxmSAegACRB6fcE2vrnVAfPJarW 1kBGUHDxmSAegACRB6fcE2vrnVAfPJarW]&lt;br /&gt;
* Con Kolivas: [https://blockchain.info/address/15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ 15qSxP1SQcUX3o4nhkfdbgyoWEFMomJ4rZ]&lt;br /&gt;
* Kanoi: [https://blockchain.info/address/1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb 1KanoiBupPiZfkwqB7rfLXAzPnoTshAVmb]&lt;br /&gt;
* Xiangfu: [https://blockchain.info/address/12h6gdGnThW385JaX1LRMA8cXKmbYRTP8Q 12h6gdGnThW385JaX1LRMA8cXKmbYRTP8Q]&lt;br /&gt;
&lt;br /&gt;
[[zh-cn:阿瓦隆]]&lt;br /&gt;
&lt;br /&gt;
[[Category:Hardware]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=39263</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=39263"/>
		<updated>2013-07-10T06:03:54Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;b&amp;gt;IMPENDING HARDFORK - UPDATE P2POOL FROM THE FOLLOWING LINK&amp;lt;/b&amp;gt;&lt;br /&gt;
Download P2Pool from the forum thread: [https://bitcointalk.org/index.php?topic=18313.0 P2Pool]&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 25BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://p2pool.hostv.pl p2pool.hostv.pl] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=31070</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=31070"/>
		<updated>2012-09-20T17:53:21Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: removed upgrade notice&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Download P2Pool from the forum thread: [https://bitcointalk.org/index.php?topic=18313.0 P2Pool]&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide this same level of decentralization.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** bfgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does my miner report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for bfgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* bfgminer, cgminer, and ufasoft work perfectly without any extra options.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
====Tips to configure bfgminer to reduce stale/doa:====&lt;br /&gt;
* &amp;quot;gpu-threads&amp;quot; : &amp;quot;1&amp;quot;, (2 by default)&lt;br /&gt;
* &amp;quot;queue&amp;quot; : &amp;quot;0&amp;quot;, (1 by default)&lt;br /&gt;
&lt;br /&gt;
Because of fast longpooling in p2pool it is better not NOT fetch work ahead.&lt;br /&gt;
&lt;br /&gt;
On non-dedicated machines intensity=3 allows normal usage of PC, set it to 7 or more to get full hashrate.&lt;br /&gt;
&lt;br /&gt;
On most cards best is diablo and phatk kernel, looks like poclbm kernel have unstable rate.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=29543</id>
		<title>BIP 0022</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=29543"/>
		<updated>2012-08-08T02:19:38Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: clarified handling of BIP 0034 block height&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{bip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 22&lt;br /&gt;
  Title: getblocktemplate - Fundamentals&lt;br /&gt;
  Author: Luke Dashjr &amp;lt;luke+bip22@dashjr.org&amp;gt;&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 28-02-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
&lt;br /&gt;
This BIP describes a new JSON-RPC method for &amp;quot;smart&amp;quot; Bitcoin miners and proxies.&lt;br /&gt;
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: getblocktemplate===&lt;br /&gt;
&lt;br /&gt;
A JSON-RPC method is defined, called &amp;quot;getblocktemplate&amp;quot;.&lt;br /&gt;
It accepts exactly one argument, which MUST be an Object of request parameters.&lt;br /&gt;
If the request parameters include a &amp;quot;mode&amp;quot; key, that is used to explicitly select between [[#Block Template Request|&amp;quot;template&amp;quot;]], [[BIP 0023#Block Proposal|&amp;quot;proposal&amp;quot;]], and [[#Block Submission|&amp;quot;submit&amp;quot;]] calls.&lt;br /&gt;
Otherwise, it defaults to [[#Block Submission|a submission]] if there is a &amp;quot;data&amp;quot; key (including the String-type argument mentioned above), and [[#Block Template Request|a template request]] if not.&lt;br /&gt;
&lt;br /&gt;
===Block Template Request===&lt;br /&gt;
Block template creation can be influenced by various parameters:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=3|template request&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || Array of Strings || SHOULD contain a list of the following, to indicate client-side support: [[#Optional: Long Polling|&amp;quot;longpoll&amp;quot;]], &amp;quot;coinbasetxn&amp;quot;, &amp;quot;coinbasevalue&amp;quot;, [[BIP 0023#Block Proposal|&amp;quot;proposal&amp;quot;]], [[BIP 0023#Logical Services|&amp;quot;serverlist&amp;quot;]], &amp;quot;workid&amp;quot;, and any of the [[BIP 0023#Mutations|mutations]]&lt;br /&gt;
|-&lt;br /&gt;
| mode || String || MUST be &amp;quot;template&amp;quot; or omitted&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
getblocktemplate MUST return a JSON Object containing the following keys:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=3| template&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bits || String || the compressed difficulty in hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| curtime || Number || the current time as seen by the server (recommended for block time) - note this is not necessarily the system clock, and must fall within the mintime/maxtime rules&lt;br /&gt;
|-&lt;br /&gt;
| height || Number || the height of the block we are looking for&lt;br /&gt;
|-&lt;br /&gt;
| previousblockhash || String || the hash of the previous block, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || Number || number of sigops allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || Number || number of bytes allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| transactions || Array of Objects || Objects containing [[#Transactions Object Format|information for Bitcoin transactions]] (excluding coinbase)&lt;br /&gt;
|-&lt;br /&gt;
| version || Number || always 1 or 2 (at least for bitcoin) - if 2, clients MUST comply with [[BIP 0034]]&lt;br /&gt;
|-&lt;br /&gt;
| coinbaseaux || Object || data that SHOULD be included in the coinbase&#039;s scriptSig content. Only the values (hexadecimal byte-for-byte) in this Object should be included, not the keys. This does not include the block height, which is required to be included in the scriptSig by [[BIP 0034]].&lt;br /&gt;
|-&lt;br /&gt;
| coinbasetxn || String or Object || coinbase transaction, format specified by &amp;quot;tx:cb&amp;quot; parameter&lt;br /&gt;
|-&lt;br /&gt;
| coinbasevalue || Number || total funds available for the coinbase (in Satoshis)&lt;br /&gt;
|-&lt;br /&gt;
| workid || String || if provided, this value must be returned with results (see [[#Block Submission|Block Submission]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Transactions Object Format ====&lt;br /&gt;
&lt;br /&gt;
The Objects listed in the response&#039;s &amp;quot;transactions&amp;quot; key contains these keys:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=3|template &amp;quot;transactions&amp;quot; element&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| data || String || transaction data encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| depends || Array of Numbers || other transactions (by 1-based index in &amp;quot;transactions&amp;quot; list) that must be present in the final block if this one is; if key is not present, dependencies are unknown and clients MUST NOT assume there aren&#039;t any&lt;br /&gt;
|-&lt;br /&gt;
| fee || Number || difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy); if key is not present, fee is unknown and clients MUST NOT assume there isn&#039;t one&lt;br /&gt;
|-&lt;br /&gt;
| hash || String || hash/id encoded in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| required || Boolean || if provided and true, this transaction must be in the final block&lt;br /&gt;
|-&lt;br /&gt;
| sigops || Number || total number of SigOps, as counted for purposes of block limits; if key is not present, sigop count is unknown and clients MUST NOT assume there aren&#039;t any&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Only the &amp;quot;data&amp;quot; key is required, but servers should provide the others if they are known.&lt;br /&gt;
&lt;br /&gt;
===Block Submission===&lt;br /&gt;
&lt;br /&gt;
When getblocktemplate is called with a &amp;quot;data&amp;quot; key, and &amp;quot;mode&amp;quot; either set to &amp;quot;submit&amp;quot; or omitted, it is interpreted as a potential block (or share).&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=3|getblocktemplate parameters&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| data || String || MUST be hex-encoded block data&lt;br /&gt;
|-&lt;br /&gt;
| mode || String || MUST be &amp;quot;submit&amp;quot; or omitted&lt;br /&gt;
|-&lt;br /&gt;
| workid || String || if the server provided a workid, it MUST be included with submissions&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
This method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Optional: Long Polling===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; | template request&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || Array of Strings || miners which support long polling SHOULD provide a list including the String &amp;quot;longpoll&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || String || &amp;quot;longpollid&amp;quot; of job to monitor for expiration; required and valid only for long poll requests&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; | template&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || String || unique identifier for long poll request; MUST be omitted if the server does not support long polling&lt;br /&gt;
|-&lt;br /&gt;
| longpolluri || String || if provided, an alternate URI to use for long poll requests&lt;br /&gt;
|-&lt;br /&gt;
| submitold || Boolean || only relevant for long poll responses: indicates if work received prior to this response remains potentially valid (default) and should have its shares submitted; if false, the miner may wish to discard its share queue&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
If the server supports long polling, it MUST include a &amp;quot;longpollid&amp;quot; key in block templates.&lt;br /&gt;
It MAY supply the &amp;quot;longpolluri&amp;quot; key with a relative or absolute URI, which MAY specify a completely different resource than the original connection, including port number.&lt;br /&gt;
If &amp;quot;longpolluri&amp;quot; is provided by the server, clients MUST only attempt to use that URI for longpoll requests.&lt;br /&gt;
&lt;br /&gt;
Clients MAY start a longpoll request with a standard JSON-RPC request (in the case of HTTP transport, POST with data) and same authorization, setting the &amp;quot;longpollid&amp;quot; parameter in the request to the value provided by the server.&lt;br /&gt;
&lt;br /&gt;
This request SHOULD NOT be processed nor answered by the server until it wishes to replace the current block data as identified by the &amp;quot;longpollid&amp;quot;.&lt;br /&gt;
Clients SHOULD make this request with a very long request timeout and MUST accept servers sending a partial response in advance (such as HTTP headers with &amp;quot;chunked&amp;quot; Transfer-Encoding), and only delaying the completion of the final JSON response until processing.&lt;br /&gt;
&lt;br /&gt;
Upon receiving a completed response:&lt;br /&gt;
* Only if &amp;quot;submitold&amp;quot; is provided and false, the client MAY discard the results of past operations and MUST begin working on the new work immediately.&lt;br /&gt;
* The client SHOULD begin working on the new work received as soon as possible, if not immediately.&lt;br /&gt;
* The client SHOULD make a new request to the same long polling URI.&lt;br /&gt;
&lt;br /&gt;
If a client receives an incomplete or invalid response, it SHOULD retry the request with an exponential backoff.&lt;br /&gt;
Clients MAY implement this backoff with limitations (such as maximum backoff time) or any algorithm as deemed suitable.&lt;br /&gt;
It is, however, forbidden to simply retry immediately with no delay after more than one failure.&lt;br /&gt;
In the case of a &amp;quot;Forbidden&amp;quot; response (for example, HTTP 403), a client SHOULD NOT attempt to retry without user intervention.&lt;br /&gt;
&lt;br /&gt;
===Optional: Template Tweaking===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! colspan=&amp;quot;3&amp;quot; | template request&lt;br /&gt;
|-&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || Number or Boolean || maximum number of sigops to include in template&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || Number or Boolean || maximum number of bytes to use for the entire block&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
For &amp;quot;sigoplimit&amp;quot; and &amp;quot;sizelimit&amp;quot;, negative values and zero are offset from the server-determined block maximum.&lt;br /&gt;
If a Boolean is provided and true, the default limit is used; if false, the server is instructed not to use any limits on returned template.&lt;br /&gt;
Servers SHOULD respect these desired maximums, but are NOT required to:&lt;br /&gt;
clients SHOULD check that the returned template satisfies their requirements appropriately.&lt;br /&gt;
&lt;br /&gt;
===Appendix: Example Rejection Reasons===&lt;br /&gt;
Possible reasons a share may be rejected include, but are not limited to:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!colspan=2| share rejection reasons&lt;br /&gt;
|-&lt;br /&gt;
! Reason !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-flag || the server detected a feature-signifying flag that it does not allow&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-length || the coinbase was too long (bitcoin limit is 100 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-prefix || the server only allows appending to the coinbase, but it was modified beyond that&lt;br /&gt;
|-&lt;br /&gt;
| bad-diffbits || &amp;quot;bits&amp;quot; were changed&lt;br /&gt;
|-&lt;br /&gt;
| bad-prevblk || the previous-block is not the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| bad-txnmrklroot || the block header&#039;s merkle root did not match the transaction merkle tree&lt;br /&gt;
|-&lt;br /&gt;
| bad-txns || the server didn&#039;t like something about the transactions in the block&lt;br /&gt;
|-&lt;br /&gt;
| bad-version || the version was wrong&lt;br /&gt;
|-&lt;br /&gt;
| duplicate || the server already processed this block data&lt;br /&gt;
|-&lt;br /&gt;
| high-hash || the block header did not hash to a value lower than the specified target&lt;br /&gt;
|-&lt;br /&gt;
| rejected || a generic rejection without details&lt;br /&gt;
|-&lt;br /&gt;
| stale-prevblk || the previous-block is no longer the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| stale-work || the work this block was based on is no longer accepted&lt;br /&gt;
|-&lt;br /&gt;
| time-invalid || the time was not acceptable&lt;br /&gt;
|-&lt;br /&gt;
| time-too-new || the time was too far in the future&lt;br /&gt;
|-&lt;br /&gt;
| time-too-old || the time was too far in the past&lt;br /&gt;
|-&lt;br /&gt;
| unknown-user || the user submitting the block was not recognized&lt;br /&gt;
|-&lt;br /&gt;
| unknown-work || the template or workid could not be identified&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
bitcoind&#039;s JSON-RPC server can no longer support the load of generating the work required to productively mine Bitcoin, and external software specializing in work generation has become necessary.&lt;br /&gt;
At the same time, new independent node implementations are maturing to the point where they will also be able to support miners.&lt;br /&gt;
&lt;br /&gt;
A common standard for communicating block construction details is necessary to ensure compatibility between the full nodes and work generation software.&lt;br /&gt;
&lt;br /&gt;
==Rationale==&lt;br /&gt;
Why not just deal with transactions as hashes (txids)?&lt;br /&gt;
* Servers might not have access to the transaction database, or miners may wish to include transactions not broadcast to the network as a whole.&lt;br /&gt;
* Miners may opt not to do full transaction verification, and may not have access to the transaction database on their end.&lt;br /&gt;
&lt;br /&gt;
What is the purpose of &amp;quot;workid&amp;quot;?&lt;br /&gt;
* If servers allow all mutations, it may be hard to identify which job it is based on. While it may be possible to verify the submission by its content, it is much easier to compare it to the job issued. It is very easy for the miner to keep track of this. Therefore, using a &amp;quot;workid&amp;quot; is a very cheap solution to enable more mutations.&lt;br /&gt;
&lt;br /&gt;
Why should &amp;quot;sigops&amp;quot; be provided for transactions?&lt;br /&gt;
* Due to the [[BIP 0016]] changes regarding rules on block sigops, it is impossible to count sigops from the transactions themselves (the sigops in the scriptCheck must also be included in the count).&lt;br /&gt;
&lt;br /&gt;
==Reference Implementation==&lt;br /&gt;
&lt;br /&gt;
* [https://gitorious.org/bitcoin/eloipool Eloipool]&lt;br /&gt;
* [https://github.com/bitcoin/bitcoin/pull/936/files bitcoind]&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[BIP 0023|BIP 23: getblocktemplate - Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
[[Category:BIP|D]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28133</id>
		<title>P2Pool code documentation</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28133"/>
		<updated>2012-06-24T21:45:25Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Ignore this page for the minute.&#039;&#039;&#039; Is just a scratch pad for documenting the p2pool code.&lt;br /&gt;
Feel free to add or correct errors if you are familiar with code.&lt;br /&gt;
&lt;br /&gt;
Will tidy up once initial pass done.&lt;br /&gt;
==Files==&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Files Name&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/main.py&lt;br /&gt;
  |Main startup and initialisation code&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/data.py&lt;br /&gt;
  |P2Pool data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/networks.py&lt;br /&gt;
  |Definitions of P2Pool networks (eg. Bitcoin, Bitcoin-testnet, Litecoin, ...)&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/p2p.py&lt;br /&gt;
  |P2Pool P2P protocol implementation&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/web.py&lt;br /&gt;
  |P2Pool web interface&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/bitcoin/&lt;br /&gt;
  |Code related to Bitcoin and its clones. Contains nothing specific to P2Pool&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/pack.py&lt;br /&gt;
  |Handling of over the wire data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/variable.py&lt;br /&gt;
  |Code to allow monitoring of when variables change and triggering events&lt;br /&gt;
|-&lt;br /&gt;
  |[[p2pool_util_forest|p2pool/util/forest.py]]&lt;br /&gt;
  |Contains Tracker class and other classes to track shares and which share is head/tail.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==p2pool/main.py==&lt;br /&gt;
Makes extensive use of twisted.defer. This allows it to &amp;quot;yield&amp;quot; to allow long running network code to complete.&lt;br /&gt;
Read up on Python Generators and this before progressing!&lt;br /&gt;
&lt;br /&gt;
Contains main startup code.&lt;br /&gt;
&lt;br /&gt;
===Function run()===&lt;br /&gt;
This is the initially executed function.&lt;br /&gt;
# Parses arguments&lt;br /&gt;
# Reads user/password from bitcoin config file&lt;br /&gt;
# Sets up log file&lt;br /&gt;
# Sets up logger that reports errors to http://u.forre.st/p2pool_error.cgi (If you are concerned this is a privacy issue add --no-bugreport to command line.)&lt;br /&gt;
Finally it adds the main function to the Twister Reactor and start the reactor. (i.e. runs the function main!).&lt;br /&gt;
&lt;br /&gt;
===Function main()===&lt;br /&gt;
This does all the startup tasks.&lt;br /&gt;
# Tests connection to bitcoind.&lt;br /&gt;
# Prints hash of latest block to show bitcoind is up to date.&lt;br /&gt;
# Tests connection to p2pool network.&lt;br /&gt;
# Gets address to use for payout either from  file or bitcoind.&lt;br /&gt;
# Validates address and checks local bitcoind owns it.&lt;br /&gt;
# Create a &amp;quot;tracker&amp;quot; and loads know shares from files in data/bitcoin/sharesX where X is a number.&lt;br /&gt;
# poll_bitcoind then gets work from bitcoind (i.e. block header to hash). Does this by calling getwork function explained below. &lt;br /&gt;
# The work_poller() function then polls bitcoind every 15 seconds for new work.&lt;br /&gt;
# Check for work from peers. This is new code to try to reduce stales. It gets new block headers from peers if they arrive before they arrive from bitcoind.&lt;br /&gt;
# Set up merged work for merged mining.&lt;br /&gt;
# Sets up combined work.&lt;br /&gt;
# Sets up Longpoll to trigger when current_work changes (transitions).&lt;br /&gt;
# Creates Node class that handles connections to other p2pool nodes (see p2p.py also).&lt;br /&gt;
# Read p2pool node address from addrs file else use bootstrap addresses.&lt;br /&gt;
# Create node object and start it connecting/sending/receiving data.&lt;br /&gt;
# Setup loop to save shares to disk every 60 seconds.&lt;br /&gt;
# Create tunnel through routers using upnp if enabled.&lt;br /&gt;
# Start listening for workers using WorkerBridge Class (e.g. cgminers).&lt;br /&gt;
# Create web_root and start web server. This is the monitoring web pages. (see web.py)&lt;br /&gt;
# Start IRC connection for announcing blocks.&lt;br /&gt;
# Start Status process that output to screen data every 3 seconds.&lt;br /&gt;
&lt;br /&gt;
====Function main/submit_block====&lt;br /&gt;
This is a critical function that watches for tracker.verified shares being added. If they meet the difficulty requirements it then submits the block to bitcoind using BOTH the p2p connection and the JSONRPC connection.&lt;br /&gt;
&lt;br /&gt;
The _ function that calls it also send the share that contains the block solution out over the p2pool network to propagate the solution asap and so reduce orphans.&lt;br /&gt;
&lt;br /&gt;
====Class main/WorkerBridge ====&lt;br /&gt;
This is the main communication between p2pool process and the workers (mining processes running cgminer or similar).&lt;br /&gt;
=====get_user_details=====&lt;br /&gt;
This allows clients to connect. Also parses out if this client wants a higher than normal pseudoshare difficulty.&lt;br /&gt;
=====get_work=====&lt;br /&gt;
This is the main method.&lt;br /&gt;
Creates a new share to solve from current data.&lt;br /&gt;
Create a &amp;quot;BlockAttempt&amp;quot; which is a bitcoin header for the miner to find a nonce for.&lt;br /&gt;
returns the BlockAttempt and a got_response function.&lt;br /&gt;
&lt;br /&gt;
got_response is called when miner finds a solution. It checks that the solution is valid. If below block target we found a block. If below share target we found a share.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;More debugging in here would be useful to find the &amp;quot;10%&amp;quot; issue&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Function getWork()===&lt;br /&gt;
This connects to the bitcoind process using the jsonrpc proxy. It calls the getmemorypool function (see [[API_reference_(JSON-RPC)|Bitcoin json-rpc API document]] and [[Original_Bitcoin_client/API_Calls_list|getmemorypool document]]) This returns all the data needed to create a new block (except the nounce obviously!).&lt;br /&gt;
&lt;br /&gt;
getwork then unpacks this into a dictionary containing the header info, the transactions&lt;br /&gt;
, the merkel branch/root and the coinbase flags. This is everything that a miner needs to calculate a valid nonce/block.&lt;br /&gt;
&lt;br /&gt;
===Class Node===&lt;br /&gt;
This also covers code in p2pool/p2p.py.&lt;br /&gt;
It is dependant on p2pool/util/p2protocol.py which is the Twisted.protocol class that handles low level network communication and passes on messages to the handle_xxx methods of the Client and Server factories and Node class.&lt;br /&gt;
This class is the main class that handles all the p2pool connections and message handling. It is the core of the p2p network for p2pool.&lt;br /&gt;
&lt;br /&gt;
Is initialised with best_share_hash variable so it can update/monitor it, port, store of peer addresses.&lt;br /&gt;
&lt;br /&gt;
Initially it starts up the client factory that connects to other nodes and a server factory that allows incoming connections.&lt;br /&gt;
&lt;br /&gt;
Then it checks it has enough node addresses, if not asks random peers to send it 8 more addresses.&lt;br /&gt;
&lt;br /&gt;
====Method Node.handle_shares====&lt;br /&gt;
Passes new shares onto tracker.&lt;br /&gt;
Update peer_heads&lt;br /&gt;
Calls compute_work if a new share.&lt;br /&gt;
&lt;br /&gt;
==p2pool/data.py==&lt;br /&gt;
Contains the main data structures used in p2pool.&lt;br /&gt;
These are:&lt;br /&gt;
===hash_link_type===&lt;br /&gt;
Serialized SHA256 engine state, used to prove that a coinbase transaction contains some data near the end without sending the entire transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;hash_link_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |state&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |extra_data&lt;br /&gt;
  |String(0)&lt;br /&gt;
  |Comments say this is a hack&lt;br /&gt;
|-&lt;br /&gt;
  |length&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===small_block_header===&lt;br /&gt;
Bitcoin block header, excluding the merkle root. Included in shares, where the merkle root is computed implicitly from the coinbase transaction and the merkle branch.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;small_block_header&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |previous_block&lt;br /&gt;
  |None or Int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |FloatingInteger(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_data_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool and that the client has control over (i.e. its value isn&#039;t fixed by the protocol rules).&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_data_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |previous_share_hash&lt;br /&gt;
  |None or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |coinbase&lt;br /&gt;
  |VarString&lt;br /&gt;
  |coinbase script&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |internal P2Pool nonce&lt;br /&gt;
|-&lt;br /&gt;
  |pubkey_hash&lt;br /&gt;
  |Int(160)&lt;br /&gt;
  |pubkey hash of Bitcoin address that this share&#039;s payouts will go to&lt;br /&gt;
|-&lt;br /&gt;
  |subsidy&lt;br /&gt;
  |Int(64)&lt;br /&gt;
  |total block value&lt;br /&gt;
|-&lt;br /&gt;
  |donation&lt;br /&gt;
  |Int(16)&lt;br /&gt;
  |donation to authors. 0 = 0%, 65535 = 100%&lt;br /&gt;
|-&lt;br /&gt;
  |stale_info&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |Flag that tells whether the node that generated this share&#039;s last share was orphaned or dead. Used to compute pool statistics. Enum (orphan, dao, unk253, unk252...???&lt;br /&gt;
|-&lt;br /&gt;
  |desired_version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |Vote for P2Pool version. Used to trigger upgrade warnings on other nodes&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_info_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_info_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |share_data&lt;br /&gt;
  |share_data_type (see above)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |far_share_hash&lt;br /&gt;
  |none or int(256)&lt;br /&gt;
  |Hash of 100th parent of this share. Not currently used for anything, but has applications in timestamping and more secure sharechain bootstrapping&lt;br /&gt;
|-&lt;br /&gt;
  |max_bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |Maximum share target allowed&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |Share target this share was mined at&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_common_type===&lt;br /&gt;
Data common to both of the following two types of shares.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_common_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |min_header&lt;br /&gt;
  |small_block_header_type&lt;br /&gt;
  |Block header of mined share&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |see above&lt;br /&gt;
|-&lt;br /&gt;
  |ref_merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |Merkle branch from hash(ref_type) to ref hash. Currently always empty in generated shares, but could be used by new merged mining implementations&lt;br /&gt;
|-&lt;br /&gt;
  |hash_link&lt;br /&gt;
  |hash_link_type&lt;br /&gt;
  |Lets you compute the generation transaction hash as a function of this and the ref hash&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1a_type===&lt;br /&gt;
This is a share that isn&#039;t a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1a_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |Merkle branch from generation transaction hash to block header&#039;s merkle root&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1b_type===&lt;br /&gt;
This is a share that is a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1b_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |other_txs&lt;br /&gt;
  |List(bitcoin_data.tx_type)&lt;br /&gt;
  |List of transactions included in the block besides the generation transaction&lt;br /&gt;
|}&lt;br /&gt;
===ref_type===&lt;br /&gt;
Internal data structure, hashed to determine the &amp;quot;reference hash&amp;quot; at the end of generation transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;ref_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |identifier&lt;br /&gt;
  |str(4)&lt;br /&gt;
  |Value different for every P2Pool instance (Bitcoin, Bitcoin-testnet, Litecoin...)&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |see above&lt;br /&gt;
|}&lt;br /&gt;
===Class share===&lt;br /&gt;
Class used to store shares.&lt;br /&gt;
====Method generate_transaction====&lt;br /&gt;
Returns the share_info and the generation transations. These are all the transactions that pay the other p2pool users the generated coins and fees.&lt;br /&gt;
It include 2 special transactions&lt;br /&gt;
# The donation sent to the developers.&lt;br /&gt;
# A transaction that is not valid, but just has a value of zero and the hash of the share info. This is to prove that when a share is found it was whilst looking for a real p2pool block. This is computed from the ref_type data structure.&lt;br /&gt;
&lt;br /&gt;
==p2pool/util/pack.py==&lt;br /&gt;
I think this handles all the binary data types used in the bitcoin protocol to send data over the network wire.&lt;br /&gt;
These are nasty as very low level and many big endian/little endian complications.&lt;br /&gt;
The p2pool network protocol uses these also.&lt;br /&gt;
Do not think you need to really understand this unless making changes at this low level.&lt;br /&gt;
&lt;br /&gt;
==p2pool/__init__.py==&lt;br /&gt;
At bottom has DEBUG flag. Change to true to get more output. (running p2pool with --debug does this)&lt;br /&gt;
Other than that just returns version number from git if it can.&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2pool_util_forest&amp;diff=28131</id>
		<title>P2pool util forest</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2pool_util_forest&amp;diff=28131"/>
		<updated>2012-06-24T21:37:08Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: described deltas&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This contains code for tracking shares.&lt;br /&gt;
==Class Tracker==&lt;br /&gt;
Number of dictionaries that store the shares in various ways to allow fast access.&lt;br /&gt;
# shares (hash-&amp;gt;share) Since share contains parent share allows you to link to previous shares all the way to the tail.&lt;br /&gt;
# reverse_shares (delta.tail-&amp;gt;set of share_hashes) Allows you to link share to the next share that came after it all the way to the head.&lt;br /&gt;
# deltas (share_hash -&amp;gt; delta, ref)&lt;br /&gt;
# reverse_deltas (ref -&amp;gt; set of share_hashes)&lt;br /&gt;
# delta_refs (ref -&amp;gt; delta)&lt;br /&gt;
# reverse_delta_refs ( delta.tail -&amp;gt; ref)&lt;br /&gt;
&lt;br /&gt;
Deltas are used for quickly answering queries by caching data between two points in the sharechain. Each share has a delta that goes between it and its highest parent and contains information such as how much work was done and how many shares are in between. If the highest parent has its parent added, the delta will keep referring to the old highest parent until it is next needed, and then it will be updated.&lt;br /&gt;
===Method add===&lt;br /&gt;
Adds a share to the tracker&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28100</id>
		<title>P2Pool code documentation</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28100"/>
		<updated>2012-06-24T05:07:42Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added file descriptions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Ignore this page for the minute.&#039;&#039;&#039; Is just a scratch pad for documenting the p2pool code.&lt;br /&gt;
Feel free to add or correct errors if you are familiar with code.&lt;br /&gt;
&lt;br /&gt;
Will tidy up once initial pass done.&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Files Name&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/main.py&lt;br /&gt;
  |Main startup and initialisation code&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/data.py&lt;br /&gt;
  |P2Pool data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/networks.py&lt;br /&gt;
  |Definitions of P2Pool networks (eg. Bitcoin, Bitcoin-testnet, Litecoin, ...)&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/p2p.py&lt;br /&gt;
  |P2Pool P2P protocol implementation&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/web.py&lt;br /&gt;
  |P2Pool web interface&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/bitcoin/&lt;br /&gt;
  |Code related to Bitcoin and its clones. Contains nothing specific to P2Pool&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/pack.py&lt;br /&gt;
  |Handling of over the wire data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/variable.py&lt;br /&gt;
  |Code to allow monitoring of when variables change and triggering events&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/...&lt;br /&gt;
  |&amp;lt;needs expansion&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==p2pool/main.py==&lt;br /&gt;
Makes extensive use of twisted.defer. This allows it to &amp;quot;yield&amp;quot; to allow long running network code to complete.&lt;br /&gt;
Read up on Python Generators and this before progressing!&lt;br /&gt;
&lt;br /&gt;
Contains main startup code.&lt;br /&gt;
&lt;br /&gt;
===Function run()===&lt;br /&gt;
This is the initially executed function.&lt;br /&gt;
# Parses arguments&lt;br /&gt;
# Reads user/password from bitcoin config file&lt;br /&gt;
# Sets up log file&lt;br /&gt;
# Sets up logger that reports errors to http://u.forre.st/p2pool_error.cgi (If you are concerned this is a privacy issue add --no-bugreport to command line.)&lt;br /&gt;
Finally it adds the main function to the Twister Reactor and start the reactor. (i.e. runs the function main!).&lt;br /&gt;
&lt;br /&gt;
===Function main()===&lt;br /&gt;
This does all the startup tasks.&lt;br /&gt;
# Tests connection to bitcoind.&lt;br /&gt;
# Prints hash of latest block to show bitcoind is up to date.&lt;br /&gt;
# Tests connection to p2pool network.&lt;br /&gt;
# Gets address to use for payout either from  file or bitcoind.&lt;br /&gt;
# Validates address and checks local bitcoind owns it.&lt;br /&gt;
# Create a &amp;quot;tracker&amp;quot; and loads know shares from files in data/bitcoin/sharesX where X is a number.&lt;br /&gt;
# poll_bitcoind then gets work from bitcoind (i.e. block header to hash). Does this by calling getwork function explained below. &lt;br /&gt;
# The work_poller() function then polls bitcoind every 15 seconds for new work.&lt;br /&gt;
# Check for work from peers. This is new code to try to reduce stales. It gets new block headers from peers if they arrive before they arrive from bitcoind.&lt;br /&gt;
# Set up merged work for merged mining.&lt;br /&gt;
# Sets up combined work.&lt;br /&gt;
# Sets up Longpoll to trigger when current_work changes (transitions).&lt;br /&gt;
# Creates Node class that handles connections to other p2pool nodes (see p2p.py also).&lt;br /&gt;
# Read p2pool node address from addrs file else use bootstrap addresses.&lt;br /&gt;
# Create node object and start it connecting/sending/receiving data.&lt;br /&gt;
# Setup loop to save shares to disk every 60 seconds.&lt;br /&gt;
# Create tunnel through routers using upnp if enabled.&lt;br /&gt;
# Start listening for workers using WorkerBridge Class (e.g. cgminers).&lt;br /&gt;
# Create web_root and start web server. This is the monitoring web pages. (see web.py)&lt;br /&gt;
# Start IRC connection for announcing blocks.&lt;br /&gt;
# Start Status process that output to screen data every 3 seconds.&lt;br /&gt;
&lt;br /&gt;
====Function main/submit_block====&lt;br /&gt;
This is a critical function that watches for tracker.verified shares being added. If they meet the difficulty requirements it then submits the block to bitcoind using BOTH the p2p connection and the JSONRPC connection.&lt;br /&gt;
&lt;br /&gt;
The _ function that calls it also send the share that contains the block solution out over the p2pool network to propagate the solution asap and so reduce orphans.&lt;br /&gt;
&lt;br /&gt;
====Class main/WorkerBridge ====&lt;br /&gt;
This is the main communication between p2pool process and the workers (mining processes running cgminer or similar).&lt;br /&gt;
=====get_user_details=====&lt;br /&gt;
This allows clients to connect. Also parses out if this client wants a higher than normal pseudoshare difficulty.&lt;br /&gt;
=====get_work=====&lt;br /&gt;
This is the main method.&lt;br /&gt;
Creates a new share to solve from current data.&lt;br /&gt;
Create a &amp;quot;BlockAttempt&amp;quot; which is a bitcoin header for the miner to find a nonce for.&lt;br /&gt;
returns the BlockAttempt and a got_response function.&lt;br /&gt;
&lt;br /&gt;
got_response is called when miner finds a solution. It checks that the solution is valid. If below block target we found a block. If below share target we found a share.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;More debugging in here would be useful to find the &amp;quot;10%&amp;quot; issue&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Function getWork()===&lt;br /&gt;
This connects to the bitcoind process using the jsonrpc proxy. It calls the getmemorypool function (see [[API_reference_(JSON-RPC)|Bitcoin json-rpc API document]] and [[Original_Bitcoin_client/API_Calls_list|getmemorypool document]]) This returns all the data needed to create a new block (except the nounce obviously!).&lt;br /&gt;
&lt;br /&gt;
getwork then unpacks this into a dictionary containing the header info, the transactions&lt;br /&gt;
, the merkel branch/root and the coinbase flags. This is everything that a miner needs to calculate a valid nonce/block.&lt;br /&gt;
&lt;br /&gt;
===Class Node===&lt;br /&gt;
This also covers code in p2pool/p2p.py.&lt;br /&gt;
It is dependant on p2pool/util/p2protocol.py which is the Twisted.protocol class that handles low level network communication and passes on messages to the handle_xxx methods of the Client and Server factories and Node class.&lt;br /&gt;
This class is the main class that handles all the p2pool connections and message handling. It is the core of the p2p network for p2pool.&lt;br /&gt;
&lt;br /&gt;
Is initialised with best_share_hash variable so it can update/monitor it, port, store of peer addresses.&lt;br /&gt;
&lt;br /&gt;
Initially it starts up the client factory that connects to other nodes and a server factory that allows incoming connections.&lt;br /&gt;
&lt;br /&gt;
Then it checks it has enough node addresses, if not asks random peers to send it 8 more addresses.&lt;br /&gt;
&lt;br /&gt;
====Method Node.handle_shares====&lt;br /&gt;
Passes new shares onto tracker.&lt;br /&gt;
Update peer_heads&lt;br /&gt;
Calls compute_work if a new share.&lt;br /&gt;
&lt;br /&gt;
==p2pool/data.py==&lt;br /&gt;
Contains the main data structures used in p2pool.&lt;br /&gt;
These are:&lt;br /&gt;
===hash_link_type===&lt;br /&gt;
Serialized SHA256 engine state, used to prove that a coinbase transaction contains some data near the end without sending the entire transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;hash_link_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |state&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |extra_data&lt;br /&gt;
  |String(0)&lt;br /&gt;
  |Comments say this is a hack&lt;br /&gt;
|-&lt;br /&gt;
  |length&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===small_block_header===&lt;br /&gt;
Bitcoin block header, excluding the merkle root. Included in shares, where the merkle root is computed implicitly from the coinbase transaction and the merkle branch.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;small_block_header&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |previous_block&lt;br /&gt;
  |None or Int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |FloatingInteger(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_data_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool and that the client has control over (i.e. its value isn&#039;t fixed by the protocol rules).&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_data_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |previous_share_hash&lt;br /&gt;
  |None or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |coinbase&lt;br /&gt;
  |VarString&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |pubkey_hash&lt;br /&gt;
  |Int(160)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |subsidy&lt;br /&gt;
  |Int(64)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |donation&lt;br /&gt;
  |Int(16)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |stale_info&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |Enum (orpan, dao, unk253, unk252...???&lt;br /&gt;
|-&lt;br /&gt;
  |desired_version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_info_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_info_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |share_data&lt;br /&gt;
  |share_data_type (see above)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |far_share_hash&lt;br /&gt;
  |none or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |max_bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_common_type===&lt;br /&gt;
Data common to both of the following two types of shares.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_common_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |min_header&lt;br /&gt;
  |small_block_header_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |ref_merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |hash_link&lt;br /&gt;
  |hash_link_type&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1a_type===&lt;br /&gt;
This is a share that isn&#039;t a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1a_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1b_type===&lt;br /&gt;
This is a share that is a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1b_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |other_txs&lt;br /&gt;
  |List(bitcoin_data.tx_type)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===ref_type===&lt;br /&gt;
Internal data structure, hashed to determine the &amp;quot;reference hash&amp;quot; at the end of generation transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;ref_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |identifier&lt;br /&gt;
  |str(4)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==p2pool/util/pack.py==&lt;br /&gt;
I think this handles all the binary data types used in the bitcoin protocol to send data over the network wire.&lt;br /&gt;
These are nasty as very low level and many big endian/little endian complications.&lt;br /&gt;
The p2pool network protocol uses these also.&lt;br /&gt;
Do not think you need to really understand this unless making changes at this low level.&lt;br /&gt;
&lt;br /&gt;
==p2pool/__init__.py==&lt;br /&gt;
At bottom has DEBUG flag. Change to true to get more output. (running p2pool with --debug does this)&lt;br /&gt;
Other than that just returns version number from git if it can.&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28099</id>
		<title>P2Pool code documentation</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=28099"/>
		<updated>2012-06-24T05:04:02Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: explained some data structures&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Ignore this page for the minute.&#039;&#039;&#039; Is just a scratch pad for documenting the p2pool code.&lt;br /&gt;
Feel free to add or correct errors if you are familiar with code.&lt;br /&gt;
&lt;br /&gt;
Will tidy up once initial pass done.&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Files Name&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/main.py&lt;br /&gt;
  |Main Startup and initialisation code&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/data.py&lt;br /&gt;
  |P2Pool main data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/pack.py&lt;br /&gt;
  |Handling of over the wire data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/variable.py&lt;br /&gt;
  |Code to allow monitoring of when variables change and triggering events&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==p2pool/main.py==&lt;br /&gt;
Makes extensive use of twisted.defer. This allows it to &amp;quot;yield&amp;quot; to allow long running network code to complete.&lt;br /&gt;
Read up on Python Generators and this before progressing!&lt;br /&gt;
&lt;br /&gt;
Contains main startup code.&lt;br /&gt;
&lt;br /&gt;
===Function run()===&lt;br /&gt;
This is the initially executed function.&lt;br /&gt;
# Parses arguments&lt;br /&gt;
# Reads user/password from bitcoin config file&lt;br /&gt;
# Sets up log file&lt;br /&gt;
# Sets up logger that reports errors to http://u.forre.st/p2pool_error.cgi (If you are concerned this is a privacy issue add --no-bugreport to command line.)&lt;br /&gt;
Finally it adds the main function to the Twister Reactor and start the reactor. (i.e. runs the function main!).&lt;br /&gt;
&lt;br /&gt;
===Function main()===&lt;br /&gt;
This does all the startup tasks.&lt;br /&gt;
# Tests connection to bitcoind.&lt;br /&gt;
# Prints hash of latest block to show bitcoind is up to date.&lt;br /&gt;
# Tests connection to p2pool network.&lt;br /&gt;
# Gets address to use for payout either from  file or bitcoind.&lt;br /&gt;
# Validates address and checks local bitcoind owns it.&lt;br /&gt;
# Create a &amp;quot;tracker&amp;quot; and loads know shares from files in data/bitcoin/sharesX where X is a number.&lt;br /&gt;
# poll_bitcoind then gets work from bitcoind (i.e. block header to hash). Does this by calling getwork function explained below. &lt;br /&gt;
# The work_poller() function then polls bitcoind every 15 seconds for new work.&lt;br /&gt;
# Check for work from peers. This is new code to try to reduce stales. It gets new block headers from peers if they arrive before they arrive from bitcoind.&lt;br /&gt;
# Set up merged work for merged mining.&lt;br /&gt;
# Sets up combined work.&lt;br /&gt;
# Sets up Longpoll to trigger when current_work changes (transitions).&lt;br /&gt;
# Creates Node class that handles connections to other p2pool nodes (see p2p.py also).&lt;br /&gt;
# Read p2pool node address from addrs file else use bootstrap addresses.&lt;br /&gt;
# Create node object and start it connecting/sending/receiving data.&lt;br /&gt;
# Setup loop to save shares to disk every 60 seconds.&lt;br /&gt;
# Create tunnel through routers using upnp if enabled.&lt;br /&gt;
# Start listening for workers using WorkerBridge Class (e.g. cgminers).&lt;br /&gt;
# Create web_root and start web server. This is the monitoring web pages. (see web.py)&lt;br /&gt;
# Start IRC connection for announcing blocks.&lt;br /&gt;
# Start Status process that output to screen data every 3 seconds.&lt;br /&gt;
&lt;br /&gt;
====Function main/submit_block====&lt;br /&gt;
This is a critical function that watches for tracker.verified shares being added. If they meet the difficulty requirements it then submits the block to bitcoind using BOTH the p2p connection and the JSONRPC connection.&lt;br /&gt;
&lt;br /&gt;
The _ function that calls it also send the share that contains the block solution out over the p2pool network to propagate the solution asap and so reduce orphans.&lt;br /&gt;
&lt;br /&gt;
====Class main/WorkerBridge ====&lt;br /&gt;
This is the main communication between p2pool process and the workers (mining processes running cgminer or similar).&lt;br /&gt;
=====get_user_details=====&lt;br /&gt;
This allows clients to connect. Also parses out if this client wants a higher than normal pseudoshare difficulty.&lt;br /&gt;
=====get_work=====&lt;br /&gt;
This is the main method.&lt;br /&gt;
Creates a new share to solve from current data.&lt;br /&gt;
Create a &amp;quot;BlockAttempt&amp;quot; which is a bitcoin header for the miner to find a nonce for.&lt;br /&gt;
returns the BlockAttempt and a got_response function.&lt;br /&gt;
&lt;br /&gt;
got_response is called when miner finds a solution. It checks that the solution is valid. If below block target we found a block. If below share target we found a share.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;More debugging in here would be useful to find the &amp;quot;10%&amp;quot; issue&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
===Function getWork()===&lt;br /&gt;
This connects to the bitcoind process using the jsonrpc proxy. It calls the getmemorypool function (see [[API_reference_(JSON-RPC)|Bitcoin json-rpc API document]] and [[Original_Bitcoin_client/API_Calls_list|getmemorypool document]]) This returns all the data needed to create a new block (except the nounce obviously!).&lt;br /&gt;
&lt;br /&gt;
getwork then unpacks this into a dictionary containing the header info, the transactions&lt;br /&gt;
, the merkel branch/root and the coinbase flags. This is everything that a miner needs to calculate a valid nonce/block.&lt;br /&gt;
&lt;br /&gt;
===Class Node===&lt;br /&gt;
This also covers code in p2pool/p2p.py.&lt;br /&gt;
It is dependant on p2pool/util/p2protocol.py which is the Twisted.protocol class that handles low level network communication and passes on messages to the handle_xxx methods of the Client and Server factories and Node class.&lt;br /&gt;
This class is the main class that handles all the p2pool connections and message handling. It is the core of the p2p network for p2pool.&lt;br /&gt;
&lt;br /&gt;
Is initialised with best_share_hash variable so it can update/monitor it, port, store of peer addresses.&lt;br /&gt;
&lt;br /&gt;
Initially it starts up the client factory that connects to other nodes and a server factory that allows incoming connections.&lt;br /&gt;
&lt;br /&gt;
Then it checks it has enough node addresses, if not asks random peers to send it 8 more addresses.&lt;br /&gt;
&lt;br /&gt;
====Method Node.handle_shares====&lt;br /&gt;
Passes new shares onto tracker.&lt;br /&gt;
Update peer_heads&lt;br /&gt;
Calls compute_work if a new share.&lt;br /&gt;
&lt;br /&gt;
==p2pool/data.py==&lt;br /&gt;
Contains the main data structures used in p2pool.&lt;br /&gt;
These are:&lt;br /&gt;
===hash_link_type===&lt;br /&gt;
Serialized SHA256 engine state, used to prove that a coinbase transaction contains some data near the end without sending the entire transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;hash_link_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |state&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |extra_data&lt;br /&gt;
  |String(0)&lt;br /&gt;
  |Comments say this is a hack&lt;br /&gt;
|-&lt;br /&gt;
  |length&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===small_block_header===&lt;br /&gt;
Bitcoin block header, excluding the merkle root. Included in shares, where the merkle root is computed implicitly from the coinbase transaction and the merkle branch.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;small_block_header&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |previous_block&lt;br /&gt;
  |None or Int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |FloatingInteger(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_data_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool and that the client has control over (i.e. its value isn&#039;t fixed by the protocol rules).&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_data_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |previous_share_hash&lt;br /&gt;
  |None or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |coinbase&lt;br /&gt;
  |VarString&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |pubkey_hash&lt;br /&gt;
  |Int(160)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |subsidy&lt;br /&gt;
  |Int(64)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |donation&lt;br /&gt;
  |Int(16)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |stale_info&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |Enum (orpan, dao, unk253, unk252...???&lt;br /&gt;
|-&lt;br /&gt;
  |desired_version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_info_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_info_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |share_data&lt;br /&gt;
  |share_data_type (see above)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |far_share_hash&lt;br /&gt;
  |none or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |max_bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_common_type===&lt;br /&gt;
Data common to both of the following two types of shares.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_common_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |min_header&lt;br /&gt;
  |small_block_header_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |ref_merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |hash_link&lt;br /&gt;
  |hash_link_type&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1a_type===&lt;br /&gt;
This is a share that isn&#039;t a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1a_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |merkle_link&lt;br /&gt;
  |ComposedType(branch:List(Int), index:VarInt)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share1b_type===&lt;br /&gt;
This is a share that is a block solution.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share1b_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |common&lt;br /&gt;
  |share_common_type&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |other_txs&lt;br /&gt;
  |List(bitcoin_data.tx_type)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===ref_type===&lt;br /&gt;
Internal data structure, hashed to determine the &amp;quot;reference hash&amp;quot; at the end of generation transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;ref_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |identifier&lt;br /&gt;
  |str(4)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |share_info&lt;br /&gt;
  |share_info_type&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==p2pool/util/pack.py==&lt;br /&gt;
I think this handles all the binary data types used in the bitcoin protocol to send data over the network wire.&lt;br /&gt;
These are nasty as very low level and many big endian/little endian complications.&lt;br /&gt;
The p2pool network protocol uses these also.&lt;br /&gt;
Do not think you need to really understand this unless making changes at this low level.&lt;br /&gt;
&lt;br /&gt;
==p2pool/__init__.py==&lt;br /&gt;
At bottom has DEBUG flag. Change to true to get more output. (running p2pool with --debug does this)&lt;br /&gt;
Other than that just returns version number from git if it can.&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=27982</id>
		<title>P2Pool code documentation</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool_code_documentation&amp;diff=27982"/>
		<updated>2012-06-19T05:33:48Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added some comments&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Ignore this page for the minute.&#039;&#039;&#039; Is just a scratch pad for documenting the p2pool code.&lt;br /&gt;
Will tidy up once initial pass done.&lt;br /&gt;
&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;Files&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Files Name&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/main.py&lt;br /&gt;
  |Main Startup and initialisation code&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/data.py&lt;br /&gt;
  |P2Pool main data structures&lt;br /&gt;
|-&lt;br /&gt;
  |p2pool/util/pack.py&lt;br /&gt;
  |Handling of over the wire data structures&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==p2pool/main.py==&lt;br /&gt;
Makes extensive use of twisted.defer. This allows it to &amp;quot;yield&amp;quot; to allow long running network code to complete.&lt;br /&gt;
Read up on Python Generators and this before progressing!&lt;br /&gt;
&lt;br /&gt;
Contains main startup code.&lt;br /&gt;
&lt;br /&gt;
Tests connection to bitcoind.&lt;br /&gt;
Prints hash of latest block to show bitcoind is up to date.&lt;br /&gt;
&lt;br /&gt;
Tests connection to p2pool network.&lt;br /&gt;
&lt;br /&gt;
Gets address to use for payout either from  file or bitcoind.&lt;br /&gt;
Validates address and checks local bitcoind owns it.&lt;br /&gt;
&lt;br /&gt;
==p2pool/data.py==&lt;br /&gt;
Contains the main data structures used in p2pool.&lt;br /&gt;
These are:&lt;br /&gt;
===hash_link_type===&lt;br /&gt;
Serialized SHA256 engine state, used to prove that a coinbase transaction contains some data near the end without sending the entire transaction.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;hash_link_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |state&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |extra_data&lt;br /&gt;
  |String(0)&lt;br /&gt;
  |Comments say this is a hack&lt;br /&gt;
|-&lt;br /&gt;
  |length&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===small_block_header===&lt;br /&gt;
Bitcoin block header, excluding the merkle root. Included in shares, where the merkle root is computed implicitly from the coinbase transaction and the merkle branch.&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;small_block_header&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |previous_block&lt;br /&gt;
  |None or Int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |FloatingInteger(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_data_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool and that the client has control over (i.e. its value isn&#039;t fixed by the protocol rules).&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_data_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |previous_share_hash&lt;br /&gt;
  |None or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |coinbase&lt;br /&gt;
  |VarString&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |nonce&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |pubkey_hash&lt;br /&gt;
  |Int(160)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |subsidy&lt;br /&gt;
  |Int(64)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |donation&lt;br /&gt;
  |Int(16)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |stale_info&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |Enum (orpan, dao, unk253, unk252...???&lt;br /&gt;
|-&lt;br /&gt;
  |desired_version&lt;br /&gt;
  |VarInt&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===share_info_type===&lt;br /&gt;
Information contained within a share that is only relevant to P2Pool&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;share_info_type&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |share_data&lt;br /&gt;
  |share_data_type (see above)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |far_share_hash&lt;br /&gt;
  |none or int(256)&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |max_bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |bits&lt;br /&gt;
  |Float Int&lt;br /&gt;
  |?&lt;br /&gt;
|-&lt;br /&gt;
  |timestamp&lt;br /&gt;
  |Int(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===x===&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;x&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |name&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===x===&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;x&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |name&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
===x===&lt;br /&gt;
{| border=1&lt;br /&gt;
  |+ &#039;&#039;&#039;x&#039;&#039;&#039;&lt;br /&gt;
|-&lt;br /&gt;
  !Field&lt;br /&gt;
  !Type&lt;br /&gt;
  !Description&lt;br /&gt;
|-&lt;br /&gt;
  |name&lt;br /&gt;
  |String(32)&lt;br /&gt;
  |?&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==p2pool/util/pack.py==&lt;br /&gt;
I think this handles all the binary data types used in the bitcoin protocol to send data over the network wire.&lt;br /&gt;
These are nasty as very low level and many big endian/little endian complications.&lt;br /&gt;
The p2pool network protocol uses these also.&lt;br /&gt;
Do not think you need to really understand this unless making changes at this low level.&lt;br /&gt;
&lt;br /&gt;
==p2pool/__init__.py==&lt;br /&gt;
At bottom has DEBUG flag. Change to true to get more output. (running p2pool with --debug does this)&lt;br /&gt;
Other than that just returns version number for git if it can.&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=27929</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=27929"/>
		<updated>2012-06-18T14:15:02Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 3.1 as soon as possible! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network, however, none can provide the guarantees against pool operator cheating that P2Pool can.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
* [[P2Pool code documentation]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26453</id>
		<title>BIP 0022</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26453"/>
		<updated>2012-05-12T04:10:12Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{bip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 22&lt;br /&gt;
  Title: getmemorypool&lt;br /&gt;
  Author: Luke Dashjr &amp;lt;luke+bip22@dashjr.org&amp;gt;&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 28-02-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
&lt;br /&gt;
This BIP describes a new JSON-RPC method for &amp;quot;smart&amp;quot; Bitcoin miners and proxies.&lt;br /&gt;
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: getmemorypool===&lt;br /&gt;
&lt;br /&gt;
A new JSON-RPC method is defined, called &amp;quot;getmemorypool&amp;quot;.&lt;br /&gt;
It accepts two arguments, both optional.&lt;br /&gt;
If the first argument is provided, and a String, the call is interpreted as a block [[#Block Submission|submission]] or [[#Block Proposal|proposal]];&lt;br /&gt;
otherwise, this call is interpreted as a request for a new block template from the server.&lt;br /&gt;
&lt;br /&gt;
===Block Template Request===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool [{parameters...}]&lt;br /&gt;
&lt;br /&gt;
If called with a single Object argument, getmemorypool interprets that Object as a set of parameters to build a block template from:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || Array of Strings || SHOULD contain a list of the following, to indicate client-side support: [[#Long Polling|&amp;quot;longpoll&amp;quot;]], &amp;quot;coinbasetxn&amp;quot;, &amp;quot;coinbasevalue&amp;quot;, [[#Block Proposal|&amp;quot;proposal&amp;quot;]], [[#Logical Services|&amp;quot;serverlist&amp;quot;]], &amp;quot;workid&amp;quot;, and any of the [[#Mutations|mutations]]&lt;br /&gt;
|-&lt;br /&gt;
| longpoll || Boolean || if provided and true, indicates this is a [[#Long Polling|long poll request]]&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || String || &amp;quot;longpollid&amp;quot; of job to monitor for expiration; required and valid only for [[#Long Polling|long poll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| nonces || Number || size of nonce range the miner needs; if not provided, the server SHOULD assume the client requires 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || Number || number of sigops to include in template, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || Number || number of bytes to use for the entire block, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| tx || String || format of response &amp;quot;transactions&amp;quot; key elements (&amp;quot;hex&amp;quot; per default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
getmemorypool MUST return a JSON Object containing the following keys:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bits || {{Yes}} || String || the compressed difficulty in hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| curtime || {{Yes}} || Number || the current time as seen by the server (recommended for block time)&lt;br /&gt;
|-&lt;br /&gt;
| height || {{Yes|Should}} || Number || the height of the block we are looking for&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || {{Yes|Should}} || String || unique identifier for [[#Long Polling|long poll request]]; MUST be omitted if the server does not support long polling&lt;br /&gt;
|-&lt;br /&gt;
| previousblockhash || {{Yes}} || String || the hash of the previous block, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || {{Yes|Should}} || Number || number of sigops allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || {{Yes|Should}} || Number || number of bytes allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hash&amp;quot;) || {{Yes|Should}} || Array of Strings || hashes/ids of Bitcoin transactions (excluding coinbase), in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hex&amp;quot;) || {{Yes|Should}} || Array of Strings || data for Bitcoin transactions (excluding coinbase) encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;obj&amp;quot;) || {{Yes|Should}} || Array of Objects || Objects containing [[#Transactions Object Format|information for Bitcoin transactions]] (excluding coinbase)&lt;br /&gt;
|-&lt;br /&gt;
| version || {{Yes}} || Number || always 1 (at least for bitcoin)&lt;br /&gt;
|-&lt;br /&gt;
| coinbasetxn || {{Patch|this or ↓}} || See &amp;quot;transactions&amp;quot; || coinbase transaction, in the same format as &amp;quot;transactions&amp;quot; key&lt;br /&gt;
|-&lt;br /&gt;
| coinbasevalue || {{Patch|this or ↑}} || Number || total funds available for the coinbase (in Satoshis)&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || {{No}} || Array of Strings || MAY contain &amp;quot;proposal&amp;quot; to indicate support for [[#Block Proposal|block proposal]], and SHOULD contain [[#Long Polling|&amp;quot;longpoll&amp;quot;]] to indicate support for that&lt;br /&gt;
|-&lt;br /&gt;
| coinbaseaux || {{No}} || Object || data that SHOULD or MUST (depending on mutable flags) be included in the coinbase&#039;s scriptSig content. Only the values (hexadecimal byte-for-byte) in this Object should be included, not the keys.&lt;br /&gt;
|-&lt;br /&gt;
| expires || {{No}} || Number || how many seconds (beginning from when the server sent the response) this work is valid for, at most&lt;br /&gt;
|-&lt;br /&gt;
| fulltarget || {{No}} || String || the number which full results should be less than, in big-endian hexadecimal (see [[#Mutations|&amp;quot;share/*&amp;quot; mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| longpolluri || {{No}} || String || if provided, an alternate URI to use for [[#Long Polling|longpoll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| maxtime || {{No}} || Number || the maximum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| maxtimeoff || {{No}} || Number || the maximum time allowed (as a moving offset from &amp;quot;curtime&amp;quot; - every second, the actual maxtime is incremented by 1; for example, &amp;quot;maxtimeoff&amp;quot;:0 means &amp;quot;time&amp;quot; may be incremented by 1 every second)&lt;br /&gt;
|-&lt;br /&gt;
| mintime || {{No}} || Number || the minimum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| mintimeoff || {{No}} || Number || the minimum time allowed (as a moving offset from &amp;quot;curtime&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| mutable || {{No}} || Array of Strings || different manipulations that the server explicitly allows to be made (see [[#Mutations|Mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| noncerange || {{No}} || String || two 32-bit integers, concatenated in big-endian hexadecimal, which represent the valid ranges of nonces the miner may scan&lt;br /&gt;
|-&lt;br /&gt;
| serverlist || {{No}} || Array of Objects || list of servers in this [[#Logical Services|single logical service]]&lt;br /&gt;
|-&lt;br /&gt;
| submitold || {{No}} || Boolean || only relevant for [[#Long Polling|long poll]] responses; indicates if work received prior to this response remains potentially valid (default) and should have its shares submitted; if false, the miner may wish to discard its share queue&lt;br /&gt;
|-&lt;br /&gt;
| target || {{No}} || String || the number which valid results must be less than, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| txrequired || {{No}} || Number || this many of the first transactions provided must be present in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| workid || {{No}} || String or Number || if provided, this value must be returned with results (see [[#JSON-RPC Method: submitblock|&amp;quot;submitblock&amp;quot;]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Transactions Object Format ====&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;tx&amp;quot; option is provided as &amp;quot;obj&amp;quot;, the Objects listed in the response&#039;s &amp;quot;transactions&amp;quot; key may contain these keys:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| data || {{Yes}} || String || transaction data encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| depends || {{No}} || Array of Numbers || other transactions (by index in &amp;quot;transactions&amp;quot; list) that must be present in the final block if this one is&lt;br /&gt;
|-&lt;br /&gt;
| fee || {{No}} || Number || difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy)&lt;br /&gt;
|-&lt;br /&gt;
| hash || {{No}} || String || hash/id encoded in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| required || {{No}} || Boolean || if provided and true, this transaction must be in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| sigops || {{No}} || Number || total number of SigOps, as counted for purposes of block limits&lt;br /&gt;
|-&lt;br /&gt;
| sigopsreal || {{No}} || Number || total number of SigOps, as counted by current standard rules&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Mutations====&lt;br /&gt;
&lt;br /&gt;
Any of these may be listed in the &amp;quot;mutable&amp;quot; key to signify modifications the miner is allowed to make:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Significance&lt;br /&gt;
|-&lt;br /&gt;
| coinbase/append&lt;br /&gt;
| append the provided coinbase scriptSig&lt;br /&gt;
|-&lt;br /&gt;
| coinbase&lt;br /&gt;
| provide their own coinbase; if one is provided, it may be replaced or modified (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| generation&lt;br /&gt;
| add or remove outputs from the coinbase/generation transaction (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| share/coinbase&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header and coinbase transaction, but only if the other transactions are unmodified from those proposed in the getmemorypool job&lt;br /&gt;
|-&lt;br /&gt;
| share/merkle&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header, coinbase transaction, and merkle tree connecting that transaction to the root (in the form of repeated right-side SHA256 hashes) in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| share/truncate&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| time/increment&lt;br /&gt;
| change the time header to a value after &amp;quot;time&amp;quot; (implied if &amp;quot;maxtime&amp;quot; or &amp;quot;maxtimeoff&amp;quot; are provided)&lt;br /&gt;
|-&lt;br /&gt;
| time/decrement&lt;br /&gt;
| change the time header to a value before &amp;quot;time&amp;quot; (implied if &amp;quot;mintime&amp;quot; is provided)&lt;br /&gt;
|-&lt;br /&gt;
| time&lt;br /&gt;
| modify the time header of the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/add&lt;br /&gt;
| add other valid transactions to the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/remove&lt;br /&gt;
| remove transactions provided by the server&lt;br /&gt;
|-&lt;br /&gt;
| transactions&lt;br /&gt;
| add or remove transactions (both of the above; implied if &amp;quot;transactions&amp;quot; omitted from result)&lt;br /&gt;
|-&lt;br /&gt;
| prevblock&lt;br /&gt;
| use the work with other previous-blocks; this implicitly allows removing transactions that are no longer valid, unless they are part of the &amp;quot;txrequired&amp;quot; count; it also implies adjusting &amp;quot;height&amp;quot; as necessary&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that miners are NOT required to implement any of these mutations.&lt;br /&gt;
&lt;br /&gt;
===== Format of Data for Merkle-Only Shares =====&lt;br /&gt;
&lt;br /&gt;
The format used for submitting shares with the &amp;quot;share/merkle&amp;quot; mutation shall be the 80-byte block header, followed by the coinbase transaction, and then finally the little-endian SHA256 hashes of each link in the merkle chain connecting it to the merkle root.&lt;br /&gt;
&lt;br /&gt;
==== Long Polling ====&lt;br /&gt;
If the server supports long polling, it MUST include the &amp;quot;longpollid&amp;quot; key&lt;br /&gt;
It MAY supply the &amp;quot;longpolluri&amp;quot; key with a relative or absolute URI, which MAY specify a completely different resource than the original connection, including port number.&lt;br /&gt;
If &amp;quot;longpolluri&amp;quot; is provided by the server, clients MUST only attempt to use that URI for longpoll requests.&lt;br /&gt;
&lt;br /&gt;
Clients MAY start a longpoll request with a standard JSON-RPC request (in the case of HTTP transport, POST with data) and same authorization, setting the &amp;quot;longpoll&amp;quot; parameter in the request to true.&lt;br /&gt;
The client MUST also include the &amp;quot;longpollid&amp;quot; key provided by the server in the parameters.&lt;br /&gt;
&lt;br /&gt;
This request SHOULD NOT be processed nor answered by the server until it wishes to replace the current block data as identified by the &amp;quot;longpollid&amp;quot;.&lt;br /&gt;
Clients SHOULD make this request with a very long request timeout and MUST accept servers sending a partial response in advance (such as HTTP headers with &amp;quot;chunked&amp;quot; Transfer-Encoding), and only delaying the completion of the final JSON response until processing.&lt;br /&gt;
&lt;br /&gt;
Upon receiving a completed response:&lt;br /&gt;
* Only if &amp;quot;submitold&amp;quot; is provided and false, the client MAY discard the results of past operations and MUST begin working on the new work immediately.&lt;br /&gt;
* The client SHOULD begin working on the new work received as soon as possible, if not immediately.&lt;br /&gt;
* The client SHOULD make a new request to the same long polling URI.&lt;br /&gt;
&lt;br /&gt;
If a client receives an incomplete or invalid response, it SHOULD retry the request with an exponential backoff.&lt;br /&gt;
Clients MAY implement this backoff with limitations (such as maximum backoff time) or any algorithm as deemed suitable.&lt;br /&gt;
It is, however, forbidden to simply retry immediately with no delay after more than one failure.&lt;br /&gt;
In the case of a &amp;quot;Forbidden&amp;quot; response (for example, HTTP 403), a client SHOULD NOT attempt to retry without user intervention.&lt;br /&gt;
&lt;br /&gt;
====Logical Services====&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;serverlist&amp;quot; parameter is provided, clients MAY choose to intelligently treat the server as part of a larger single logical service.&lt;br /&gt;
&lt;br /&gt;
Each host Object in the Array is comprised of the following fields:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| uri || {{Yes}} || String || URI of the individual server; if authentication information is omitted, the same authentication used for this request MUST be assumed&lt;br /&gt;
|-&lt;br /&gt;
| avoid || {{No}} || Number || number of seconds to avoid using this server&lt;br /&gt;
|-&lt;br /&gt;
| priority || {{No}} || Number || an integer priority of this host (default: 0)&lt;br /&gt;
|-&lt;br /&gt;
| sticky || {{No}} || Number || number of seconds to stick to this server when used&lt;br /&gt;
|-&lt;br /&gt;
| update || {{No}} || Boolean || whether this server may update the serverlist (default: true)&lt;br /&gt;
|-&lt;br /&gt;
| weight || {{No}} || Number || a relative weight for hosts with the same priority (default: 1)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When choosing which actual server to get the next job from, URIs MUST be tried in order of their &amp;quot;priority&amp;quot; key, lowest Number first.&lt;br /&gt;
Where the priority of URIs is the same, they should be chosen from in random order, weighed by their &amp;quot;weight&amp;quot; key.&lt;br /&gt;
&lt;br /&gt;
Updates to the Logical Service server list may only be made by the original server, or servers listed with the &amp;quot;update&amp;quot; key missing or true.&lt;br /&gt;
Clients MAY choose to advertise serverlist capability to servers with a false &amp;quot;update&amp;quot; key, but if so, MUST treat the server list provided as a subset of the current one, only considered in the context of this server.&lt;br /&gt;
At least one server with &amp;quot;update&amp;quot; privilege MUST be attempted at least once daily.&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;sticky&amp;quot; key is provided, then when that server is used, it should be used consistently for at least that many seconds, if possible.&lt;br /&gt;
&lt;br /&gt;
A permanent change in server URI MAY be indicated with a simple &amp;quot;serverlist&amp;quot; parameter:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
A temporary delegation to another server for 5 minutes MAY be indicated likewise:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;&amp;quot;, avoid: 300}, {&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;, &amp;quot;update&amp;quot;: false}]&lt;br /&gt;
&lt;br /&gt;
===Block Proposal===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; {mode: &amp;quot;proposal&amp;quot;, parameters...}&lt;br /&gt;
&lt;br /&gt;
At any point before a job expires, a miner MAY propose a block to the server for general validation.&lt;br /&gt;
This is accomplished by calling getmemorypool with the hex-encoded block data as the first argument (as in a [[#Block Submission|submission]]), and an Object as the second argument with the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The block data MUST be validated and checked against the server&#039;s usual acceptance rules (excluding the check for a valid proof-of-work).&lt;br /&gt;
If it is found to be in violation of any of these rules, the server MUST return a String giving the reason for the rejection (see [[#Block Submission|Block Submission]] for example reasons).&lt;br /&gt;
If it is acceptable as-is, the server MAY return a true Boolean.&lt;br /&gt;
Otherwise, the server may return a new block template (with or without changes); in this case, any missing keys are assumed to default to those in the proposed block or, if not applicable, the original block template it was based on.&lt;br /&gt;
&lt;br /&gt;
It is RECOMMENDED that servers which merely need to track the proposed block for later share/* submissions, return a simple Object of the form:&lt;br /&gt;
 {&amp;quot;workid&amp;quot;:&amp;quot;new workid&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Clients SHOULD assume their proposed block will remain valid if the only changes they make are to the portion of the coinbase scriptSig they themselves provided (if any) and the time header.&lt;br /&gt;
Servers SHOULD NOT break this assumption without good cause.&lt;br /&gt;
&lt;br /&gt;
===Block Submission===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; [{...}]&lt;br /&gt;
&lt;br /&gt;
When getmemorypool is called with a String as its first argument, it is interpreted as hex-encoded data for a potential block; this may be truncated or merkle-ified depending on the &amp;quot;share/truncate&amp;quot; or &amp;quot;share/merkle&amp;quot; mutations, respectively.&lt;br /&gt;
The second argument, if provided, is an Object of parameters for the submission.&lt;br /&gt;
If this includes the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;, the [[#Block Proposal|block proposal]] process should be followed instead.&lt;br /&gt;
The only other defined key for this Object is the &amp;quot;workid&amp;quot; provided by the server:&lt;br /&gt;
if a &amp;quot;workid&amp;quot; was specified in the template, it must be submitted with the share/block.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is specified, this method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is omitted, this method SHOULD return either true (if the share is accepted) or false (if rejected).&lt;br /&gt;
Clients MUST NOT depend on this boolean response, and servers MAY choose not to implement this paragraph.&lt;br /&gt;
&lt;br /&gt;
Possible reasons a share may be rejected include, but are not limited to:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reason !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-flag || the server detected a feature-signifying flag that it does not allow&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-length || the coinbase was too long (bitcoin limit is 100 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-prefix || the server only allows appending to the coinbase, but it was modified beyond that&lt;br /&gt;
|-&lt;br /&gt;
| bad-diffbits || &amp;quot;bits&amp;quot; were changed&lt;br /&gt;
|-&lt;br /&gt;
| bad-prevblk || the previous-block is not the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| bad-txnmrklroot || the block header&#039;s merkle root did not match the transaction merkle tree&lt;br /&gt;
|-&lt;br /&gt;
| bad-txns || the server didn&#039;t like something about the transactions in the block&lt;br /&gt;
|-&lt;br /&gt;
| bad-version || the version was wrong&lt;br /&gt;
|-&lt;br /&gt;
| duplicate || the server already processed this block data&lt;br /&gt;
|-&lt;br /&gt;
| high-hash || the block header did not hash to a value lower than the specified target&lt;br /&gt;
|-&lt;br /&gt;
| rejected || a generic rejection without details&lt;br /&gt;
|-&lt;br /&gt;
| stale-prevblk || the previous-block is no longer the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| stale-work || the work this block was based on is no longer accepted&lt;br /&gt;
|-&lt;br /&gt;
| time-invalid || the time was not acceptable&lt;br /&gt;
|-&lt;br /&gt;
| time-too-new || the time was too far in the future&lt;br /&gt;
|-&lt;br /&gt;
| time-too-old || the time was too far in the past&lt;br /&gt;
|-&lt;br /&gt;
| unknown-user || the user submitting the block was not recognized&lt;br /&gt;
|-&lt;br /&gt;
| unknown-work || the template or workid could not be identified&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Known Bugs ===&lt;br /&gt;
This BIP should not be promoted from Draft status until these are addressed:&lt;br /&gt;
* &#039;&#039;(feel free to add issues here)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
There is reasonable concerns about mining currently being too centralized on pools, and the amount of control these pools hold.&lt;br /&gt;
By exposing the details of the block proposals to the miners, they are enabled to audit and possibly modify the block before hashing it.&lt;br /&gt;
&lt;br /&gt;
==Reference Implementation==&lt;br /&gt;
&lt;br /&gt;
* [https://gitorious.org/bitcoin/eloipool Eloipool]&lt;br /&gt;
* [http://luke.dashjr.org/programs/bitcoin/w/bitcoind/luke-jr.git/blobdiff/722d9387be4b267b689d7b7d78daeb7157bd12d8..gmp_bip:/src/bitcoinrpc.cpp bitcoind]&lt;br /&gt;
&lt;br /&gt;
[[Category:BIP|D]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26451</id>
		<title>BIP 0022</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26451"/>
		<updated>2012-05-12T03:57:38Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{bip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 22&lt;br /&gt;
  Title: getmemorypool&lt;br /&gt;
  Author: Luke Dashjr &amp;lt;luke+bip22@dashjr.org&amp;gt;&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 28-02-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
&lt;br /&gt;
This BIP describes a new JSON-RPC method for &amp;quot;smart&amp;quot; Bitcoin miners and proxies.&lt;br /&gt;
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: getmemorypool===&lt;br /&gt;
&lt;br /&gt;
A new JSON-RPC method is defined, called &amp;quot;getmemorypool&amp;quot;.&lt;br /&gt;
It accepts two arguments, both optional.&lt;br /&gt;
If the first argument is provided, and a String, the call is interpreted as a block [[#Block Submission|submission]] or [[#Block Proposal|proposal]];&lt;br /&gt;
otherwise, this call is interpreted as a request for a new block template from the server.&lt;br /&gt;
&lt;br /&gt;
===Block Template Request===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool [{parameters...}]&lt;br /&gt;
&lt;br /&gt;
If called with a single Object argument, getmemorypool interprets that Object as a set of parameters to build a block template from:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || Array of Strings || SHOULD contain a list of the following, to indicate client-side support: [[#Long Polling|&amp;quot;longpoll&amp;quot;]], &amp;quot;coinbasetxn&amp;quot;, &amp;quot;coinbasevalue&amp;quot;, [[#Block Proposal|&amp;quot;proposal&amp;quot;]], [[#Logical Services|&amp;quot;serverlist&amp;quot;]], &amp;quot;workid&amp;quot;, and any of the [[#Mutations|mutations]]&lt;br /&gt;
|-&lt;br /&gt;
| longpoll || Boolean || if provided and true, indicates this is a [[#Long Polling|long poll request]]&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || String || &amp;quot;longpollid&amp;quot; of job to monitor for expiration; required and valid only for [[#Long Polling|long poll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| nonces || Number || size of nonce range the miner needs; if not provided, the server SHOULD assume the client requires 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || Number || number of sigops to include in template, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || Number || number of bytes to use for the entire block, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| tx || String || format of response &amp;quot;transactions&amp;quot; key elements (&amp;quot;hex&amp;quot; per default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
getmemorypool MUST return a JSON Object containing the following keys:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bits || {{Yes}} || String || the compressed difficulty in hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| curtime || {{Yes}} || Number || the current time as seen by the server (recommended for block time)&lt;br /&gt;
|-&lt;br /&gt;
| height || {{Yes|Should}} || Number || the height of the block we are looking for&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || {{Yes|Should}} || String || unique identifier for [[#Long Polling|long poll request]]; MUST be omitted if the server does not support long polling&lt;br /&gt;
|-&lt;br /&gt;
| previousblockhash || {{Yes}} || String || the hash of the previous block, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || {{Yes|Should}} || Number || number of sigops allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || {{Yes|Should}} || Number || number of bytes allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hash&amp;quot;) || {{Yes|Should}} || Array of Strings || hashes/ids of Bitcoin transactions (excluding coinbase), in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hex&amp;quot;) || {{Yes|Should}} || Array of Strings || data for Bitcoin transactions (excluding coinbase) encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;obj&amp;quot;) || {{Yes|Should}} || Array of Objects || Objects containing [[#Transactions Object Format|information for Bitcoin transactions]] (excluding coinbase)&lt;br /&gt;
|-&lt;br /&gt;
| version || {{Yes}} || Number || always 1 (at least for bitcoin)&lt;br /&gt;
|-&lt;br /&gt;
| coinbasetxn || {{Patch|this or ↓}} || See &amp;quot;transactions&amp;quot; || coinbase transaction, in the same format as &amp;quot;transactions&amp;quot; key&lt;br /&gt;
|-&lt;br /&gt;
| coinbasevalue || {{Patch|this or ↑}} || Number || total funds available for the coinbase (in Satoshis)&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || {{No}} || Array of Strings || MAY contain &amp;quot;proposal&amp;quot; to indicate support for [[#Block Proposal|block proposal]], and SHOULD contain [[#Long Polling|&amp;quot;longpoll&amp;quot;]] to indicate support for that&lt;br /&gt;
|-&lt;br /&gt;
| coinbaseaux || {{No}} || Object || data that SHOULD or MUST (depending on mutable flags) be included in the coinbase&#039;s scriptSig content. Only the values (hexadecimal byte-for-byte) in this Object should be included, not the keys.&lt;br /&gt;
|-&lt;br /&gt;
| expires || {{No}} || Number || how many seconds (beginning from when the server sent the response) this work is valid for, at most&lt;br /&gt;
|-&lt;br /&gt;
| fulltarget || {{No}} || String || the number which full results should be less than, in big-endian hexadecimal (see [[#Mutations|&amp;quot;share/*&amp;quot; mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| longpolluri || {{No}} || String || if provided, an alternate URI to use for [[#Long Polling|longpoll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| maxtime || {{No}} || Number || the maximum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| maxtimeoff || {{No}} || Number || the maximum time allowed (as a moving offset from &amp;quot;curtime&amp;quot; - every second, the actual maxtime is incremented by 1; for example, &amp;quot;maxtimeoff&amp;quot;:0 means &amp;quot;time&amp;quot; may be incremented by 1 every second)&lt;br /&gt;
|-&lt;br /&gt;
| mintime || {{No}} || Number || the minimum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| mintimeoff || {{No}} || Number || the minimum time allowed (as a moving offset from &amp;quot;curtime&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| mutable || {{No}} || Array of Strings || different manipulations that the server explicitly allows to be made (see [[#Mutations|Mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| noncerange || {{No}} || String || two 32-bit integers, concatenated in big-endian hexadecimal, which represent the valid ranges of nonces the miner may scan&lt;br /&gt;
|-&lt;br /&gt;
| serverlist || {{No}} || Array of Objects || list of servers in this [[#Logical Services|single logical service]]&lt;br /&gt;
|-&lt;br /&gt;
| submitold || {{No}} || Boolean || only relevant for [[#Long Polling|long poll]] responses; indicates if work received prior to this response remains potentially valid (default) and should have its shares submitted; if false, the miner may wish to discard its share queue&lt;br /&gt;
|-&lt;br /&gt;
| target || {{No}} || String || the number which valid results must be less than, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| txrequired || {{No}} || Number || this many of the first transactions provided must be present in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| workid || {{No}} || String or Number || if provided, this value must be returned with results (see [[#JSON-RPC Method: submitblock|&amp;quot;submitblock&amp;quot;]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Transactions Object Format ====&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;tx&amp;quot; option is provided as &amp;quot;obj&amp;quot;, the Objects listed in the response&#039;s &amp;quot;transactions&amp;quot; key may contain these keys:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| data || {{Yes}} || String || transaction data encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| depends || {{No}} || Array of Numbers || other transactions (by index in &amp;quot;transactions&amp;quot; list) that must be present in the final block if this one is&lt;br /&gt;
|-&lt;br /&gt;
| fee || {{No}} || Number || difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy)&lt;br /&gt;
|-&lt;br /&gt;
| hash || {{No}} || String || hash/id encoded in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| required || {{No}} || Boolean || if provided and true, this transaction must be in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| sigops || {{No}} || Number || total number of SigOps, as counted for purposes of block limits&lt;br /&gt;
|-&lt;br /&gt;
| sigopsreal || {{No}} || Number || total number of SigOps, as counted by current standard rules&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Mutations====&lt;br /&gt;
&lt;br /&gt;
Any of these may be listed in the &amp;quot;mutable&amp;quot; key to signify modifications the miner is allowed to make:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Significance&lt;br /&gt;
|-&lt;br /&gt;
| coinbase/append&lt;br /&gt;
| append the provided coinbase scriptSig&lt;br /&gt;
|-&lt;br /&gt;
| coinbase&lt;br /&gt;
| provide their own coinbase; if one is provided, it may be replaced or modified (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| generation&lt;br /&gt;
| add or remove outputs from the coinbase/generation transaction (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| share/coinbase&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header and coinbase transaction, but only if the other transactions are unmodified from those proposed in the getmemorypool job&lt;br /&gt;
|-&lt;br /&gt;
| share/merkle&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header, coinbase transaction, and merkle tree connecting that transaction to the root (in the form of repeated right-side SHA256 hashes) in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| share/truncate&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| time/increment&lt;br /&gt;
| change the time header to a value after &amp;quot;time&amp;quot; (implied if &amp;quot;maxtime&amp;quot; or &amp;quot;maxtimeoff&amp;quot; are provided)&lt;br /&gt;
|-&lt;br /&gt;
| time/decrement&lt;br /&gt;
| change the time header to a value before &amp;quot;time&amp;quot; (implied if &amp;quot;mintime&amp;quot; is provided)&lt;br /&gt;
|-&lt;br /&gt;
| time&lt;br /&gt;
| modify the time header of the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/add&lt;br /&gt;
| add other valid transactions to the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/remove&lt;br /&gt;
| remove transactions provided by the server&lt;br /&gt;
|-&lt;br /&gt;
| transactions&lt;br /&gt;
| add or remove transactions (both of the above; implied if &amp;quot;transactions&amp;quot; omitted from result)&lt;br /&gt;
|-&lt;br /&gt;
| prevblock&lt;br /&gt;
| use the work with other previous-blocks; this implicitly allows removing transactions that are no longer valid, unless they are part of the &amp;quot;txrequired&amp;quot; count; it also implies adjusting &amp;quot;height&amp;quot; as necessary&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that miners are NOT required to implement any of these mutations.&lt;br /&gt;
&lt;br /&gt;
===== Format of Data for Merkle-Only Shares =====&lt;br /&gt;
&lt;br /&gt;
The format used for submitting shares with the &amp;quot;share/merkle&amp;quot; mutation shall be the 80-byte block header, followed by the coinbase transaction, and then finally the little-endian SHA256 hashes of each link in the merkle chain connecting it to the merkle root.&lt;br /&gt;
&lt;br /&gt;
==== Long Polling ====&lt;br /&gt;
If the server supports long polling, it MUST include the &amp;quot;longpollid&amp;quot; key&lt;br /&gt;
It MAY supply the &amp;quot;longpolluri&amp;quot; key with a relative or absolute URI, which MAY specify a completely different resource than the original connection, including port number.&lt;br /&gt;
If &amp;quot;longpolluri&amp;quot; is provided by the server, clients MUST only attempt to use that URI for longpoll requests.&lt;br /&gt;
&lt;br /&gt;
Clients MAY start a longpoll request with a standard JSON-RPC request (in the case of HTTP transport, POST with data) and same authorization, setting the &amp;quot;longpoll&amp;quot; parameter in the request to true.&lt;br /&gt;
The client MUST also include the &amp;quot;longpollid&amp;quot; key provided by the server in the parameters.&lt;br /&gt;
&lt;br /&gt;
This request SHOULD NOT be processed nor answered by the server until it wishes to replace the current block data as identified by the &amp;quot;longpollid&amp;quot;.&lt;br /&gt;
Clients SHOULD make this request with a very long request timeout and MUST accept servers sending a partial response in advance (such as HTTP headers with &amp;quot;chunked&amp;quot; Transfer-Encoding), and only delaying the completion of the final JSON response until processing.&lt;br /&gt;
&lt;br /&gt;
Upon receiving a completed response:&lt;br /&gt;
* Only if &amp;quot;submitold&amp;quot; is provided and false, the client MAY discard the results of past operations and MUST begin working on the new work immediately.&lt;br /&gt;
* The client SHOULD begin working on the new work received as soon as possible, if not immediately.&lt;br /&gt;
* The client SHOULD make a new request to the same long polling URI.&lt;br /&gt;
&lt;br /&gt;
If a client receives an incomplete or invalid response, it SHOULD retry the request with an exponential backoff.&lt;br /&gt;
Clients MAY implement this backoff with limitations (such as maximum backoff time) or any algorithm as deemed suitable.&lt;br /&gt;
It is, however, forbidden to simply retry immediately with no delay after more than one failure.&lt;br /&gt;
In the case of a &amp;quot;Forbidden&amp;quot; response (for example, HTTP 403), a client SHOULD NOT attempt to retry without user intervention.&lt;br /&gt;
&lt;br /&gt;
====Logical Services====&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;serverlist&amp;quot; parameter is provided, clients MAY choose to intelligently treat the server as part of a larger single logical service.&lt;br /&gt;
&lt;br /&gt;
Each host Object in the Array is comprised of the following fields:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| uri || {{Yes}} || String || URI of the individual server; if authentication information is omitted, the same authentication used for this request MUST be assumed&lt;br /&gt;
|-&lt;br /&gt;
| avoid || {{No}} || Number || number of seconds to avoid using this server&lt;br /&gt;
|-&lt;br /&gt;
| priority || {{No}} || Number || an integer priority of this host (default: 0)&lt;br /&gt;
|-&lt;br /&gt;
| sticky || {{No}} || Number || number of seconds to stick to this server when used&lt;br /&gt;
|-&lt;br /&gt;
| update || {{No}} || Boolean || whether this server may update the serverlist (default: true)&lt;br /&gt;
|-&lt;br /&gt;
| weight || {{No}} || Number || a relative weight for hosts with the same priority (default: 1)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When choosing which actual server to get the next job from, URIs MUST be tried in order of their &amp;quot;priority&amp;quot; key, lowest Number first.&lt;br /&gt;
Where the priority of URIs is the same, they should be chosen from in random order, weighed by their &amp;quot;weight&amp;quot; key.&lt;br /&gt;
&lt;br /&gt;
Updates to the Logical Service server list may only be made by the original server, or servers listed with the &amp;quot;update&amp;quot; key missing or true.&lt;br /&gt;
Clients MAY choose to advertise serverlist capability to servers with a false &amp;quot;update&amp;quot; key, but if so, MUST treat the server list provided as a subset of the current one, only considered in the context of this server.&lt;br /&gt;
At least one server with &amp;quot;update&amp;quot; privilege MUST be attempted at least once daily.&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;sticky&amp;quot; key is provided, then when that server is used, it should be used consistently for at least that many seconds, if possible.&lt;br /&gt;
&lt;br /&gt;
A permanent change in server URI MAY be indicated with a simple &amp;quot;serverlist&amp;quot; parameter:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
A temporary delegation to another server for 5 minutes MAY be indicated likewise:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;&amp;quot;, avoid: 300}, {&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;, &amp;quot;update&amp;quot;: false}]&lt;br /&gt;
&lt;br /&gt;
===Block Proposal===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; {mode: proposal, parameters...}&lt;br /&gt;
&lt;br /&gt;
At any point before a job expires, a miner MAY propose a block to the server for general validation.&lt;br /&gt;
This is accomplished by calling getmemorypool with the hex-encoded block data as the first argument (as in a [[#Block Submission|submission]]), and an Object as the second argument with the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The block data MUST be validated and checked against the server&#039;s usual acceptance rules (excluding the check for a valid proof-of-work).&lt;br /&gt;
If it is found to be in violation of any of these rules, the server MUST return a String giving the reason for the rejection (see [[#Block Submission|Block Submission]] for example reasons).&lt;br /&gt;
If it is acceptable as-is, the server MAY return a true Boolean.&lt;br /&gt;
Otherwise, the server may return a new block template (with or without changes); in this case, any missing keys are assumed to default to those in the proposed block or, if not applicable, the original block template it was based on.&lt;br /&gt;
&lt;br /&gt;
It is RECOMMENDED that servers which merely need to track the proposed block for later share/* submissions, return a simple Object of the form:&lt;br /&gt;
 {&amp;quot;workid&amp;quot;:&amp;quot;new workid&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Clients SHOULD assume their proposed block will remain valid if the only changes they make are to the portion of the coinbase scriptSig they themselves provided (if any) and the time header.&lt;br /&gt;
Servers SHOULD NOT break this assumption without good cause.&lt;br /&gt;
&lt;br /&gt;
===Block Submission===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; [{...}]&lt;br /&gt;
&lt;br /&gt;
When getmemorypool is called with a String as its first argument, it is interpreted as hex-encoded data for a potential block; this may be truncated or merkle-ified depending on the &amp;quot;share/truncate&amp;quot; or &amp;quot;share/merkle&amp;quot; mutations, respectively.&lt;br /&gt;
The second argument, if provided, is an Object of parameters for the submission.&lt;br /&gt;
If this includes the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;, the [[#Block Proposal|block proposal]] process should be followed instead.&lt;br /&gt;
The only other defined key for this Object is the &amp;quot;workid&amp;quot; provided by the server:&lt;br /&gt;
if a &amp;quot;workid&amp;quot; was specified in the template, it must be submitted with the share/block.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is specified, this method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is omitted, this method SHOULD return either true (if the share is accepted) or false (if rejected).&lt;br /&gt;
Clients MUST NOT depend on this boolean response, and servers MAY choose not to implement this paragraph.&lt;br /&gt;
&lt;br /&gt;
Possible reasons a share may be rejected include, but are not limited to:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reason !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-flag || the server detected a feature-signifying flag that it does not allow&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-length || the coinbase was too long (bitcoin limit is 100 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-prefix || the server only allows appending to the coinbase, but it was modified beyond that&lt;br /&gt;
|-&lt;br /&gt;
| bad-diffbits || &amp;quot;bits&amp;quot; were changed&lt;br /&gt;
|-&lt;br /&gt;
| bad-prevblk || the previous-block is not the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| bad-txnmrklroot || the block header&#039;s merkle root did not match the transaction merkle tree&lt;br /&gt;
|-&lt;br /&gt;
| bad-txns || the server didn&#039;t like something about the transactions in the block&lt;br /&gt;
|-&lt;br /&gt;
| bad-version || the version was wrong&lt;br /&gt;
|-&lt;br /&gt;
| duplicate || the server already processed this block data&lt;br /&gt;
|-&lt;br /&gt;
| high-hash || the block header did not hash to a value lower than the specified target&lt;br /&gt;
|-&lt;br /&gt;
| rejected || a generic rejection without details&lt;br /&gt;
|-&lt;br /&gt;
| stale-prevblk || the previous-block is no longer the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| stale-work || the work this block was based on is no longer accepted&lt;br /&gt;
|-&lt;br /&gt;
| time-invalid || the time was not acceptable&lt;br /&gt;
|-&lt;br /&gt;
| time-too-new || the time was too far in the future&lt;br /&gt;
|-&lt;br /&gt;
| time-too-old || the time was too far in the past&lt;br /&gt;
|-&lt;br /&gt;
| unknown-user || the user submitting the block was not recognized&lt;br /&gt;
|-&lt;br /&gt;
| unknown-work || the template or workid could not be identified&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Known Bugs ===&lt;br /&gt;
This BIP should not be promoted from Draft status until these are addressed:&lt;br /&gt;
* &#039;&#039;(feel free to add issues here)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
There is reasonable concerns about mining currently being too centralized on pools, and the amount of control these pools hold.&lt;br /&gt;
By exposing the details of the block proposals to the miners, they are enabled to audit and possibly modify the block before hashing it.&lt;br /&gt;
&lt;br /&gt;
==Reference Implementation==&lt;br /&gt;
&lt;br /&gt;
* [https://gitorious.org/bitcoin/eloipool Eloipool]&lt;br /&gt;
* [http://luke.dashjr.org/programs/bitcoin/w/bitcoind/luke-jr.git/blobdiff/722d9387be4b267b689d7b7d78daeb7157bd12d8..gmp_bip:/src/bitcoinrpc.cpp bitcoind]&lt;br /&gt;
&lt;br /&gt;
[[Category:BIP|D]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26450</id>
		<title>BIP 0022</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=26450"/>
		<updated>2012-05-12T03:46:20Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: clarified some things&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{bip}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: 22&lt;br /&gt;
  Title: getmemorypool&lt;br /&gt;
  Author: Luke Dashjr &amp;lt;luke+bip22@dashjr.org&amp;gt;&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 28-02-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
&lt;br /&gt;
This BIP describes a new JSON-RPC method for &amp;quot;smart&amp;quot; Bitcoin miners and proxies.&lt;br /&gt;
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: getmemorypool===&lt;br /&gt;
&lt;br /&gt;
A new JSON-RPC method is defined, called &amp;quot;getmemorypool&amp;quot;.&lt;br /&gt;
It accepts two arguments, both optional.&lt;br /&gt;
If the first argument is provided, and a String, the call is interpreted as a block [[#Block Submission|submission]] or [[#Block Proposal|proposal]];&lt;br /&gt;
otherwise, this call is interpreted as a request for a new block template from the server.&lt;br /&gt;
&lt;br /&gt;
===Block Template Request===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool [{parameters...}]&lt;br /&gt;
&lt;br /&gt;
If called with a single Object argument, getmemorypool interprets that Object as a set of parameters to build a block template from:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || Array of Strings || SHOULD contain a list of the following, to indicate client-side support: [[#Long Polling|&amp;quot;longpoll&amp;quot;]], &amp;quot;coinbasetxn&amp;quot;, &amp;quot;coinbasevalue&amp;quot;, [[#Block Proposal|&amp;quot;proposal&amp;quot;]], [[#Logical Services|&amp;quot;serverlist&amp;quot;]], &amp;quot;workid&amp;quot;, and any of the [[#Mutations|mutations]]&lt;br /&gt;
|-&lt;br /&gt;
| longpoll || Boolean || if provided and true, indicates this is a [[#Long Polling|long poll request]]&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || String || &amp;quot;longpollid&amp;quot; of job to monitor for expiration; required and valid only for [[#Long Polling|long poll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| nonces || Number || size of nonce range the miner needs; if not provided, the server SHOULD assume the client requires 2&amp;lt;sup&amp;gt;32&amp;lt;/sup&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || Number || number of sigops to include in template, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || Number || number of bytes to use for the entire block, at most; if negative, offset from the block maximum&lt;br /&gt;
|-&lt;br /&gt;
| tx || String || format of response &amp;quot;transactions&amp;quot; key elements (&amp;quot;hex&amp;quot; per default)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
getmemorypool MUST return a JSON Object containing the following keys:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bits || {{Yes}} || String || the compressed difficulty in hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| curtime || {{Yes}} || Number || the current time as seen by the server (recommended for block time)&lt;br /&gt;
|-&lt;br /&gt;
| height || {{Yes|Should}} || Number || the height of the block we are looking for&lt;br /&gt;
|-&lt;br /&gt;
| longpollid || {{Yes|Should}} || String || unique identifier for [[#Long Polling|long poll request]]; MUST be omitted if the server does not support long polling&lt;br /&gt;
|-&lt;br /&gt;
| previousblockhash || {{Yes}} || String || the hash of the previous block, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| sigoplimit || {{Yes|Should}} || Number || number of sigops allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| sizelimit || {{Yes|Should}} || Number || number of bytes allowed in blocks&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hash&amp;quot;) || {{Yes|Should}} || Array of Strings || hashes/ids of Bitcoin transactions (excluding coinbase), in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;hex&amp;quot;) || {{Yes|Should}} || Array of Strings || data for Bitcoin transactions (excluding coinbase) encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| transactions (&amp;quot;obj&amp;quot;) || {{Yes|Should}} || Array of Objects || Objects containing [[#Transactions Object Format|information for Bitcoin transactions]] (excluding coinbase)&lt;br /&gt;
|-&lt;br /&gt;
| version || {{Yes}} || Number || always 1 (at least for bitcoin)&lt;br /&gt;
|-&lt;br /&gt;
| coinbasetxn || {{Patch|or ↓}} || See &amp;quot;transactions&amp;quot; || coinbase transaction, in the same format as &amp;quot;transactions&amp;quot; key&lt;br /&gt;
|-&lt;br /&gt;
| coinbasevalue || {{Patch|or ↑}} || Number || total funds available for the coinbase (in Satoshis)&lt;br /&gt;
|-&lt;br /&gt;
| capabilities || {{No}} || Array of Strings || MAY contain &amp;quot;proposal&amp;quot; to indicate support for [[#Block Proposal|block proposal]], and SHOULD contain [[#Long Polling|&amp;quot;longpoll&amp;quot;]] to indicate support for that&lt;br /&gt;
|-&lt;br /&gt;
| coinbaseaux || {{No}} || Object || data that SHOULD or MUST (depending on mutable flags) be included in the coinbase&#039;s scriptSig content. Only the values (hexadecimal byte-for-byte) in this Object should be included, not the keys.&lt;br /&gt;
|-&lt;br /&gt;
| expires || {{No}} || Number || how many seconds (beginning from when the server sent the response) this work is valid for, at most&lt;br /&gt;
|-&lt;br /&gt;
| fulltarget || {{No}} || String || the number which full results should be less than, in big-endian hexadecimal (see [[#Mutations|&amp;quot;share/*&amp;quot; mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| longpolluri || {{No}} || String || if provided, an alternate URI to use for [[#Long Polling|longpoll requests]]&lt;br /&gt;
|-&lt;br /&gt;
| maxtime || {{No}} || Number || the maximum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| maxtimeoff || {{No}} || Number || the maximum time allowed (as a moving offset from &amp;quot;curtime&amp;quot; - every second, the actual maxtime is incremented by 1; for example, &amp;quot;maxtimeoff&amp;quot;:0 means &amp;quot;time&amp;quot; may be incremented by 1 every second)&lt;br /&gt;
|-&lt;br /&gt;
| mintime || {{No}} || Number || the minimum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| mintimeoff || {{No}} || Number || the minimum time allowed (as a moving offset from &amp;quot;curtime&amp;quot;)&lt;br /&gt;
|-&lt;br /&gt;
| mutable || {{No}} || Array of Strings || different manipulations that the server explicitly allows to be made (see [[#Mutations|Mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| noncerange || {{No}} || String || two 32-bit integers, concatenated in big-endian hexadecimal, which represent the valid ranges of nonces the miner may scan&lt;br /&gt;
|-&lt;br /&gt;
| serverlist || {{No}} || Array of Objects || list of servers in this [[#Logical Services|single logical service]]&lt;br /&gt;
|-&lt;br /&gt;
| submitold || {{No}} || Boolean || only relevant for [[#Long Polling|long poll]] responses; indicates if work received prior to this response remains potentially valid (default) and should have its shares submitted; if false, the miner may wish to discard its share queue&lt;br /&gt;
|-&lt;br /&gt;
| target || {{No}} || String || the number which valid results must be less than, in big-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| txrequired || {{No}} || Number || this many of the first transactions provided must be present in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| workid || {{No}} || String or Number || if provided, this value must be returned with results (see [[#JSON-RPC Method: submitblock|&amp;quot;submitblock&amp;quot;]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==== Transactions Object Format ====&lt;br /&gt;
&lt;br /&gt;
When the &amp;quot;tx&amp;quot; option is provided as &amp;quot;obj&amp;quot;, the Objects listed in the response&#039;s &amp;quot;transactions&amp;quot; key may contain these keys:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| data || {{Yes}} || String || transaction data encoded in hexadecimal (byte-for-byte)&lt;br /&gt;
|-&lt;br /&gt;
| depends || {{No}} || Array of Numbers || other transactions (by index in &amp;quot;transactions&amp;quot; list) that must be present in the final block if this one is&lt;br /&gt;
|-&lt;br /&gt;
| fee || {{No}} || Number || difference in value between transaction inputs and outputs (in Satoshis); for coinbase transactions, this is a negative Number of the total collected block fees (ie, not including the block subsidy)&lt;br /&gt;
|-&lt;br /&gt;
| hash || {{No}} || String || hash/id encoded in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| required || {{No}} || Boolean || if provided and true, this transaction must be in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| sigops || {{No}} || Number || total number of SigOps, as counted for purposes of block limits&lt;br /&gt;
|-&lt;br /&gt;
| sigopsreal || {{No}} || Number || total number of SigOps, as counted by current standard rules&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Mutations====&lt;br /&gt;
&lt;br /&gt;
Any of these may be listed in the &amp;quot;mutable&amp;quot; key to signify modifications the miner is allowed to make:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Significance&lt;br /&gt;
|-&lt;br /&gt;
| coinbase/append&lt;br /&gt;
| append the provided coinbase scriptSig&lt;br /&gt;
|-&lt;br /&gt;
| coinbase&lt;br /&gt;
| provide their own coinbase; if one is provided, it may be replaced or modified (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| generation&lt;br /&gt;
| add or remove outputs from the coinbase/generation transaction (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| share/coinbase&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header and coinbase transaction, but only if the other transactions are unmodified from those proposed in the getmemorypool job&lt;br /&gt;
|-&lt;br /&gt;
| share/merkle&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header, coinbase transaction, and merkle tree connecting that transaction to the root (in the form of repeated right-side SHA256 hashes) in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| share/truncate&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| time/increment&lt;br /&gt;
| change the time header to a value after &amp;quot;time&amp;quot; (implied if &amp;quot;maxtime&amp;quot; or &amp;quot;maxtimeoff&amp;quot; are provided)&lt;br /&gt;
|-&lt;br /&gt;
| time/decrement&lt;br /&gt;
| change the time header to a value before &amp;quot;time&amp;quot; (implied if &amp;quot;mintime&amp;quot; is provided)&lt;br /&gt;
|-&lt;br /&gt;
| time&lt;br /&gt;
| modify the time header of the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/add&lt;br /&gt;
| add other valid transactions to the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/remove&lt;br /&gt;
| remove transactions provided by the server&lt;br /&gt;
|-&lt;br /&gt;
| transactions&lt;br /&gt;
| add or remove transactions (both of the above; implied if &amp;quot;transactions&amp;quot; omitted from result)&lt;br /&gt;
|-&lt;br /&gt;
| prevblock&lt;br /&gt;
| use the work with other previous-blocks; this implicitly allows removing transactions that are no longer valid, unless they are part of the &amp;quot;txrequired&amp;quot; count; it also implies adjusting &amp;quot;height&amp;quot; as necessary&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that miners are NOT required to implement any of these mutations.&lt;br /&gt;
&lt;br /&gt;
===== Format of Data for Merkle-Only Shares =====&lt;br /&gt;
&lt;br /&gt;
The format used for submitting shares with the &amp;quot;share/merkle&amp;quot; mutation shall be the 80-byte block header, followed by the coinbase transaction, and then finally the little-endian SHA256 hashes of each link in the merkle chain connecting it to the merkle root.&lt;br /&gt;
&lt;br /&gt;
==== Long Polling ====&lt;br /&gt;
If the server supports long polling, it MUST include the &amp;quot;longpollid&amp;quot; key&lt;br /&gt;
It MAY supply the &amp;quot;longpolluri&amp;quot; key with a relative or absolute URI, which MAY specify a completely different resource than the original connection, including port number.&lt;br /&gt;
If &amp;quot;longpolluri&amp;quot; is provided by the server, clients MUST only attempt to use that URI for longpoll requests.&lt;br /&gt;
&lt;br /&gt;
Clients MAY start a longpoll request with a standard JSON-RPC request (in the case of HTTP transport, POST with data) and same authorization, setting the &amp;quot;longpoll&amp;quot; parameter in the request to true.&lt;br /&gt;
The client MUST also include the &amp;quot;longpollid&amp;quot; key provided by the server in the parameters.&lt;br /&gt;
&lt;br /&gt;
This request SHOULD NOT be processed nor answered by the server until it wishes to replace the current block data as identified by the &amp;quot;longpollid&amp;quot;.&lt;br /&gt;
Clients SHOULD make this request with a very long request timeout and MUST accept servers sending a partial response in advance (such as HTTP headers with &amp;quot;chunked&amp;quot; Transfer-Encoding), and only delaying the completion of the final JSON response until processing.&lt;br /&gt;
&lt;br /&gt;
Upon receiving a completed response:&lt;br /&gt;
* Only if &amp;quot;submitold&amp;quot; is provided and false, the client MAY discard the results of past operations and MUST begin working on the new work immediately.&lt;br /&gt;
* The client SHOULD begin working on the new work received as soon as possible, if not immediately.&lt;br /&gt;
* The client SHOULD make a new request to the same long polling URI.&lt;br /&gt;
&lt;br /&gt;
If a client receives an incomplete or invalid response, it SHOULD retry the request with an exponential backoff.&lt;br /&gt;
Clients MAY implement this backoff with limitations (such as maximum backoff time) or any algorithm as deemed suitable.&lt;br /&gt;
It is, however, forbidden to simply retry immediately with no delay after more than one failure.&lt;br /&gt;
In the case of a &amp;quot;Forbidden&amp;quot; response (for example, HTTP 403), a client SHOULD NOT attempt to retry without user intervention.&lt;br /&gt;
&lt;br /&gt;
====Logical Services====&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;serverlist&amp;quot; parameter is provided, clients MAY choose to intelligently treat the server as part of a larger single logical service.&lt;br /&gt;
&lt;br /&gt;
Each host Object in the Array is comprised of the following fields:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| uri || {{Yes}} || String || URI of the individual server; if authentication information is omitted, the same authentication used for this request MUST be assumed&lt;br /&gt;
|-&lt;br /&gt;
| avoid || {{No}} || Number || number of seconds to avoid using this server&lt;br /&gt;
|-&lt;br /&gt;
| priority || {{No}} || Number || an integer priority of this host (default: 0)&lt;br /&gt;
|-&lt;br /&gt;
| sticky || {{No}} || Number || number of seconds to stick to this server when used&lt;br /&gt;
|-&lt;br /&gt;
| update || {{No}} || Boolean || whether this server may update the serverlist (default: true)&lt;br /&gt;
|-&lt;br /&gt;
| weight || {{No}} || Number || a relative weight for hosts with the same priority (default: 1)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
When choosing which actual server to get the next job from, URIs MUST be tried in order of their &amp;quot;priority&amp;quot; key, lowest Number first.&lt;br /&gt;
Where the priority of URIs is the same, they should be chosen from in random order, weighed by their &amp;quot;weight&amp;quot; key.&lt;br /&gt;
&lt;br /&gt;
Updates to the Logical Service server list may only be made by the original server, or servers listed with the &amp;quot;update&amp;quot; key missing or true.&lt;br /&gt;
Clients MAY choose to advertise serverlist capability to servers with a false &amp;quot;update&amp;quot; key, but if so, MUST treat the server list provided as a subset of the current one, only considered in the context of this server.&lt;br /&gt;
At least one server with &amp;quot;update&amp;quot; privilege MUST be attempted at least once daily.&lt;br /&gt;
&lt;br /&gt;
If the &amp;quot;sticky&amp;quot; key is provided, then when that server is used, it should be used consistently for at least that many seconds, if possible.&lt;br /&gt;
&lt;br /&gt;
A permanent change in server URI MAY be indicated with a simple &amp;quot;serverlist&amp;quot; parameter:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;}]&lt;br /&gt;
&lt;br /&gt;
A temporary delegation to another server for 5 minutes MAY be indicated likewise:&lt;br /&gt;
 &amp;quot;serverlist&amp;quot;:[{&amp;quot;uri&amp;quot;: &amp;quot;&amp;quot;, avoid: 300}, {&amp;quot;uri&amp;quot;: &amp;quot;http://newserver&amp;quot;, &amp;quot;update&amp;quot;: false}]&lt;br /&gt;
&lt;br /&gt;
===Block Proposal===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; {mode: proposal, parameters...}&lt;br /&gt;
&lt;br /&gt;
At any point before a job expires, a miner MAY propose a block to the server for general validation.&lt;br /&gt;
This is accomplished by calling getmemorypool with the hex-encoded block data as the first argument (as in a [[#Block Submission|submission]]), and an Object as the second argument with the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The block data MUST be validated and checked against the server&#039;s usual acceptance rules (excluding the check for a valid proof-of-work).&lt;br /&gt;
If it is found to be in violation of any of these rules, the server MUST return a String giving the reason for the rejection (see [[#Block Submission|Block Submission]] for example reasons).&lt;br /&gt;
If it is acceptable as-is, the server MAY return a true Boolean.&lt;br /&gt;
Otherwise, the server may return a new block template (with or without changes); in this case, any missing keys are assumed to default to those in the proposed block or, if not applicable, the original block template it was based on.&lt;br /&gt;
&lt;br /&gt;
It is RECOMMENDED that servers which merely need to track the proposed block for later share/* submissions, return a simple Object of the form:&lt;br /&gt;
 {&amp;quot;workid&amp;quot;:&amp;quot;new workid&amp;quot;}&lt;br /&gt;
&lt;br /&gt;
Clients SHOULD assume their proposed block will remain valid if the only changes they make are to the portion of the coinbase scriptSig they themselves provided (if any) and the time header.&lt;br /&gt;
Servers SHOULD NOT break this assumption without good cause.&lt;br /&gt;
&lt;br /&gt;
===Block Submission===&lt;br /&gt;
&lt;br /&gt;
 getmemorypool &amp;quot;hex-encoded block data...&amp;quot; [{...}]&lt;br /&gt;
&lt;br /&gt;
When getmemorypool is called with a String as its first argument, it is interpreted as hex-encoded data for a potential block; this may be truncated or merkle-ified depending on the &amp;quot;share/truncate&amp;quot; or &amp;quot;share/merkle&amp;quot; mutations, respectively.&lt;br /&gt;
The second argument, if provided, is an Object of parameters for the submission.&lt;br /&gt;
If this includes the &amp;quot;mode&amp;quot; key set to &amp;quot;proposal&amp;quot;, the [[#Block Proposal|block proposal]] process should be followed instead.&lt;br /&gt;
The only other defined key for this Object is the &amp;quot;workid&amp;quot; provided by the server:&lt;br /&gt;
if a &amp;quot;workid&amp;quot; was specified in the template, it must be submitted with the share/block.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is specified, this method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.&lt;br /&gt;
&lt;br /&gt;
If the parameters argument is omitted, this method SHOULD return either true (if the share is accepted) or false (if rejected).&lt;br /&gt;
Clients MUST NOT depend on this boolean response, and servers MAY choose not to implement this paragraph.&lt;br /&gt;
&lt;br /&gt;
Possible reasons a share may be rejected include, but are not limited to:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reason !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-flag || the server detected a feature-signifying flag that it does not allow&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-length || the coinbase was too long (bitcoin limit is 100 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-prefix || the server only allows appending to the coinbase, but it was modified beyond that&lt;br /&gt;
|-&lt;br /&gt;
| bad-diffbits || &amp;quot;bits&amp;quot; were changed&lt;br /&gt;
|-&lt;br /&gt;
| bad-prevblk || the previous-block is not the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| bad-txnmrklroot || the block header&#039;s merkle root did not match the transaction merkle tree&lt;br /&gt;
|-&lt;br /&gt;
| bad-txns || the server didn&#039;t like something about the transactions in the block&lt;br /&gt;
|-&lt;br /&gt;
| bad-version || the version was wrong&lt;br /&gt;
|-&lt;br /&gt;
| duplicate || the server already processed this block data&lt;br /&gt;
|-&lt;br /&gt;
| high-hash || the block header did not hash to a value lower than the specified target&lt;br /&gt;
|-&lt;br /&gt;
| rejected || a generic rejection without details&lt;br /&gt;
|-&lt;br /&gt;
| stale-prevblk || the previous-block is no longer the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| stale-work || the work this block was based on is no longer accepted&lt;br /&gt;
|-&lt;br /&gt;
| time-invalid || the time was not acceptable&lt;br /&gt;
|-&lt;br /&gt;
| time-too-new || the time was too far in the future&lt;br /&gt;
|-&lt;br /&gt;
| time-too-old || the time was too far in the past&lt;br /&gt;
|-&lt;br /&gt;
| unknown-user || the user submitting the block was not recognized&lt;br /&gt;
|-&lt;br /&gt;
| unknown-work || the template or workid could not be identified&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== Known Bugs ===&lt;br /&gt;
This BIP should not be promoted from Draft status until these are addressed:&lt;br /&gt;
* &#039;&#039;(feel free to add issues here)&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
There is reasonable concerns about mining currently being too centralized on pools, and the amount of control these pools hold.&lt;br /&gt;
By exposing the details of the block proposals to the miners, they are enabled to audit and possibly modify the block before hashing it.&lt;br /&gt;
&lt;br /&gt;
==Reference Implementation==&lt;br /&gt;
&lt;br /&gt;
* [https://gitorious.org/bitcoin/eloipool Eloipool]&lt;br /&gt;
* [http://luke.dashjr.org/programs/bitcoin/w/bitcoind/luke-jr.git/blobdiff/722d9387be4b267b689d7b7d78daeb7157bd12d8..gmp_bip:/src/bitcoinrpc.cpp bitcoind]&lt;br /&gt;
&lt;br /&gt;
[[Category:BIP|D]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26197</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26197"/>
		<updated>2012-05-07T18:27:31Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated README and --help text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 0.11.0 as soon as possible! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network, however, none can provide the guarantees against pool operator cheating that P2Pool can.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.6.0rc4 or Bitcoin &amp;gt;=0.5.4 (for BIP16 support) or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin,litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--iocp]&lt;br /&gt;
                     [--irc-announce] [--no-bugreport] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [--max-conns CONNS]&lt;br /&gt;
                     [-w PORT or ADDR:PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 0.11.1-8-ged9359d)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin,litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work towards the development&lt;br /&gt;
                        of p2pool (default: 0.5)&lt;br /&gt;
  --iocp                use Windows IOCP API in order to avoid errors due to&lt;br /&gt;
                        large number of sockets being open&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --no-bugreport        disable submitting caught exceptions to the author&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
  --max-conns CONNS     maximum incoming connections (default: 40)&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT or ADDR:PORT, --worker-port PORT or ADDR:PORT&lt;br /&gt;
                        listen on PORT on interface with ADDR for RPC&lt;br /&gt;
                        connections from miners (default: all interfaces,&lt;br /&gt;
                        bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26145</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26145"/>
		<updated>2012-05-05T23:52:32Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: documented pseudoshare difficulty option&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 0.11.0 as soon as possible! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network, however, none can provide the guarantees against pool operator cheating that P2Pool can.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
** Appending &amp;quot;+1&amp;quot; (for example) after that will make P2Pool always give your miners work with a difficulty of 1&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26015</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=26015"/>
		<updated>2012-05-03T05:11:34Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated warning to 0.11.0&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 0.11.0 as soon as possible! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network, however, none can provide the guarantees against pool operator cheating that P2Pool can.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=25986</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=25986"/>
		<updated>2012-05-02T05:29:47Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: clarified &amp;quot;other pools&amp;quot; note :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 0.10.3 before April 1st! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network, however, none can provide the guarantees against pool operator cheating that P2Pool can.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /static/ - Lots of information from shares to graphs to payouts.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The pool began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=Alternative_chain&amp;diff=25296</id>
		<title>Alternative chain</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=Alternative_chain&amp;diff=25296"/>
		<updated>2012-04-14T02:19:23Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added note to &amp;quot;Generalized proof of work&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;An &#039;&#039;&#039;alternative chain&#039;&#039;&#039; is a system using the block chain algorithm to achieve distributed consensus on a particular topic. Alternative chains may share miners with a &#039;&#039;&#039;parent&#039;&#039;&#039; network such as Bitcoin&#039;s; this is called &#039;&#039;&#039;merged mining&#039;&#039;&#039;. Alternative chains have been suggested as ways to implement DNS, SSL certificate authorities, timestamping, file storage and voting systems.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Objective ==&lt;br /&gt;
&lt;br /&gt;
Bitcoin uses the [[block chain]] algorithm to achieve distributed consensus on who owns what coins. Block chains were invented specifically for the Bitcoin project but they can be applied anywhere a distributed consensus needs to be established in the presence of malicious or untrustworthy actors.&lt;br /&gt;
&lt;br /&gt;
Whilst it&#039;s possible to abuse the Bitcoin financial block chain for other purposes, it&#039;s better to set up an alternative network and chain which share the same miners. There are several reasons to do this.&lt;br /&gt;
&lt;br /&gt;
* The block chain is a large, complex data structure shared between many people. Verifying its integrity requires many slow (and thus expensive) operations like ECDSA verifications and disk seeks. Everyone who takes part in Bitcoin today runs a node and thus maintains the whole thing. Whilst in future end-users will probably use more efficient but slightly less secure modes (SPV), merchants and miners will probably always pay the full costs for the upkeep of this shared data structure. All these people today are united by a common interest in a new form of payments. They may or may not also be interested in other schemes. So one reason to keep the Bitcoin chain for finance is it&#039;s unfair to externalize the costs of unrelated schemes onto people who are interested only in payments - the canonical example being merchants. Increasing the cost of accepting Bitcoins for goods and services hurts everyone who uses the system by reducing the number of merchants or increasing their costs.&lt;br /&gt;
&lt;br /&gt;
* Another reason is that it&#039;s just bad engineering to cram every possible distributed quorum into the design constraints of Bitcoin. The transaction format Bitcoin uses is flexible but ultimately designed for finance. You cannot leave out the &amp;quot;value&amp;quot; field. It&#039;s always there, even if it&#039;d make no sense for your particular application. Building non-financial applications on top of a financial system results in bizarre protocols and code that are difficult to understand, leading to maintainability problems.&lt;br /&gt;
&lt;br /&gt;
* One final reason is that [[Satoshi Nakamoto|Satoshi]] was opposed to putting non-Bitcoin related data into the main chain. As creator of the system, his opinion should carry a lot of weight with anyone serious about extending it.&lt;br /&gt;
&lt;br /&gt;
=== Designing a new network ===&lt;br /&gt;
&lt;br /&gt;
To create a new network that uses Nakamoto block chains, you need to start by defining what a transaction in your new network means. Bitcoin transactions split and combine value using scripts, but yours don&#039;t have to do that. They could be anything. Here&#039;s an example of a simple DNS style &amp;quot;transaction&amp;quot; described using [http://code.google.com/p/protobuf/ Google protocol buffers] syntax.&lt;br /&gt;
&lt;br /&gt;
 message NameTx {&lt;br /&gt;
   required string name = 1;&lt;br /&gt;
   repeated bytes ip_addresses = 2;&lt;br /&gt;
   required bytes pubkey = 3;&lt;br /&gt;
   enum ClaimType {&lt;br /&gt;
     NEW_NAME,&lt;br /&gt;
     TRANSFER&lt;br /&gt;
   }&lt;br /&gt;
   required ClaimType type = 4;&lt;br /&gt;
   &lt;br /&gt;
   // Only used if type == TRANSFER. The new owner of the name and signature proving current ownership.&lt;br /&gt;
   optional bytes dest_pubkey = 5;&lt;br /&gt;
   optional bytes signature = 6;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
This is very different to a Bitcoin style transaction. There&#039;s no concept of inputs, outputs, addresses, values or scripts. It&#039;s got what you need for a very simple DNS style scheme (that lacks abuse controls etc) and nothing more. There&#039;s also no concept of a &amp;quot;coinbase&amp;quot; transaction.&lt;br /&gt;
&lt;br /&gt;
The block definition is also up to you. It does not have to be formatted in the same way as Satoshi chose, but you need most of the same conceptual parts. You also need to store something else, some data from Bitcoin. Here&#039;s a minimal example of what&#039;s needed:&lt;br /&gt;
&lt;br /&gt;
 message MyBlock {&lt;br /&gt;
   required bytes prev_block_hash = 1;&lt;br /&gt;
   required uint32 difficulty = 2;&lt;br /&gt;
   required uint32 time = 3; &lt;br /&gt;
 &lt;br /&gt;
   repeated MyTx transactions = 4;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 message SuperBlock {&lt;br /&gt;
   required MyBlock my_data = 1;&lt;br /&gt;
   required BitcoinData bitcoin_data = 2;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
It&#039;s important to observe what we don&#039;t have as well as what we do. We don&#039;t have the following fields from Satoshis format:&lt;br /&gt;
&lt;br /&gt;
# version: protobufs handles the versioning of binary data formats for us&lt;br /&gt;
# merkle root: you can choose to arrange your transactions into a merkle root if you like, so you can use the same disk space reclamation trick Satoshi did. But it&#039;s strictly optional. If you want to simplify things down you can skip it.&lt;br /&gt;
# nonce&lt;br /&gt;
&lt;br /&gt;
== Sharing work ==&lt;br /&gt;
&lt;br /&gt;
The bitcoin_data field is how you share work with miners today (assuming they opt in by installing your software alongside their bitcoin node). It&#039;s defined like this:&lt;br /&gt;
&lt;br /&gt;
 message BitcoinData {&lt;br /&gt;
   // A Bitcoin format block header. Because it&#039;s in Satoshis custom format we represent this as a byte array.&lt;br /&gt;
   required bytes header = 1;&lt;br /&gt;
 &lt;br /&gt;
   // The first transaction from the block.&lt;br /&gt;
   required bytes coinbase_tx = 2;&lt;br /&gt;
 &lt;br /&gt;
   // The merkle branch linking the coinbase transaction to the header.&lt;br /&gt;
   required bytes coinbase_merkle_branch = 3;&lt;br /&gt;
 &lt;br /&gt;
   // The coinbase scriptSig contains bits of data in order. Which one is our hash?&lt;br /&gt;
   required int coinbase_tx_index = 4;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
All you need to share work is the above four things.&lt;br /&gt;
&lt;br /&gt;
A [[wikipedia:Merkle tree|merkle tree]] is a data structure in which each node in the tree is a hash. The leaf nodes are hashes of the things you want to include in the tree. The interior nodes are hashes of the concatenations of the child nodes. A merkle branch is a part of a merkle tree which allows you to cryptographically prove that something you&#039;re given was in the tree, without needing everything that was in the tree. They are calculated by the CBlock::GetMerkleBranch() function in the Bitcoin code.&lt;br /&gt;
&lt;br /&gt;
We store a merkle branch here for efficiency. It means no matter how large the current Bitcoin block is, your alternative network only needs to handle a small amount of data. You could just store the entire Bitcoin block - that would be simpler but inefficient.&lt;br /&gt;
&lt;br /&gt;
The merkle branch links the coinbase transaction to the block header, so you can prove it was in that block. The coinbase TX is a regular Bitcoin coinbase (that makes new coins and claims fees), except the scriptSig on its input contains an extra entry that todays scriptSigs don&#039;t. That extra entry is a hash of your block structure. The coinbase scriptSig today is formatted like this:&lt;br /&gt;
&lt;br /&gt;
 void IncrementExtraNonce(CBlock* pblock, CBlockIndex* pindexPrev, unsigned int&amp;amp; nExtraNonce, int64&amp;amp; nPrevTime)&lt;br /&gt;
 {&lt;br /&gt;
     .....&lt;br /&gt;
     pblock-&amp;gt;vtx[0].vin[0].scriptSig = CScript() &amp;lt;&amp;lt; pblock-&amp;gt;nBits &amp;lt;&amp;lt; CBigNum(nExtraNonce);&lt;br /&gt;
     .....&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
Just the difficulty bits and the &amp;quot;extra nonce&amp;quot;. But it&#039;s actually allowed to contain anything, as long as it&#039;s not too big. So in your new blocks it&#039;d be:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MyBlock hash&amp;gt; &amp;lt;nBits&amp;gt; &amp;lt;nExtraNonce&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To get the MyBlock hash into Bitcoin requires a presently unimplemented RPC command, &amp;quot;setextrahashes&amp;quot;. It&#039;d update a global list and the IncrementExtraNonce function would include the extra hashes when the scriptSig is built. This is a very simple change to Bitcoin.&lt;br /&gt;
&lt;br /&gt;
In the scriptSig above the coinbase_tx_index would be zero. It&#039;s possible to work on an arbitrary number of alternative chains simultaneously:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;MyBlock hash&amp;gt; &amp;lt;SomeOtherChainBlock hash&amp;gt; &amp;lt;nBits&amp;gt; &amp;lt;nExtraNonce&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in which case the BitcoinData message for SomeOtherChain would be 1 rather than zero.&lt;br /&gt;
&lt;br /&gt;
A more complex change is the other new RPC. Because you have your own chain, it has its own difficulty. Most likely it&#039;ll be different to Bitcoins own. So you need a way to tell Bitcoin &amp;quot;when you find a block that matches an extradifficulty, please let me know&amp;quot;. To mine on multiple difficulties at once, the node vends work (via getwork) matching the easiest difficulty. When a miner reports finding a solution the difficulty is checked to see which chains it is sufficiently difficult for.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Important note: Your chain has its &amp;lt;i&amp;gt;own difficulty&amp;lt;/i&amp;gt; and as such the block creation rate is independent of how much mining takes place.&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Independent node software ==&lt;br /&gt;
&lt;br /&gt;
Your new network has its own codebase. It can be written in whatever language you like, use whatever P2P protocol you like, store its data however you like and so on.&lt;br /&gt;
&lt;br /&gt;
When a node on your network receives a message informing it about a new transaction, it verifies that transaction follows the rules of your network. To use our simple DNS example it would verify that if you&#039;re claiming a new name, it doesn&#039;t already exist and if you&#039;re transferring a name that the signatures are correct.&lt;br /&gt;
&lt;br /&gt;
If the transaction is valid, it&#039;s added to your current MyBlock message. That message is serialized to binary (protobufs does this for you), hashed and then your node makes an RPC to Bitcoin telling it what the current extra hash is. When Bitcoin finds a Bitcoin-format block of the right difficulty for your network, it informs your software and passes the block header, coinbase transaction and merkle branch to it. Your node combines them together into a BitcoinData message, which is then glued together with your alternative chains block. This &amp;quot;superblock&amp;quot; is then broadcast via your independent P2P network.&lt;br /&gt;
&lt;br /&gt;
When a node on your new network receives a superblock it does the following things:&lt;br /&gt;
&lt;br /&gt;
# Verifies the MyBlock contents are correct, ie, that the transactions follow the rules.&lt;br /&gt;
# Verifies that the MyBlock prev hash makes it fit somewhere in the chain and that the difficulty is correct.&lt;br /&gt;
# Hashes the MyBlock structure and then verifies that this hash appears in the BitcoinData coinbase scriptSig, in the right place.&lt;br /&gt;
# Extracts the merkle root of the Bitcoin format block from the header and then verifies that the coinbase tx provided did, in fact, exist in that block (using the branch, root, tx and header together).&lt;br /&gt;
# Verifies that the hash of the Bitcoin format block header is below the difficulty found in the MyBlock structure.&lt;br /&gt;
&lt;br /&gt;
You&#039;ve now verified that a sufficiently hard proof of work was done over the contents of the MyBlock structure, so your node can relay the newly found block (or if you don&#039;t use a P2P network make it available on your server, etc).&lt;br /&gt;
&lt;br /&gt;
On the other side when Bitcoin finds a block that is correct for the Bitcoin network and chain, it broadcasts it and obviously the hash of your MyBlock is included. Fortunately this is only an additional 33 bytes overhead so nobody cares about it - the pollution of the financial chain is both trivial and constant. Note that regular Bitcoin nodes just ignore this extra hash, it doesn&#039;t mean anything to them.&lt;br /&gt;
&lt;br /&gt;
== Handling your new block chain ==&lt;br /&gt;
&lt;br /&gt;
You have to handle re-organizations. This is a standard part of the block chain algorithm. When a re-org occurs you have to verify that the state of your world still makes sense. For example in the new chain maybe somebody else now owns a resource you thought you owned. It&#039;s up to you how to inform your users of these events and what app specific logic is appropriate here.&lt;br /&gt;
&lt;br /&gt;
You can choose your own parameters for the new chain. As an example, Satoshi chose to target one new block every ten minutes as a tradeoff between latency and wasted work. You could choose something much larger (hours, days) or much faster if you&#039;re willing to tolerate more splits due to blocks being found simultaneously. Bitcoin retargets the difficulty roughly every two weeks. You could choose some other length of time.&lt;br /&gt;
&lt;br /&gt;
To store the block chain, Satoshi chose to use Berkeley DB as a way to index from transactions to the blocks they appeared in (amongst other things). You could use any database you liked.&lt;br /&gt;
&lt;br /&gt;
== Paying for resources on alternative chains with Bitcoins ==&lt;br /&gt;
&lt;br /&gt;
A commonly cited reason for putting DNS related data into the financial chain is the desire to pay for names with Bitcoins. You can do this with an independent chain too, because you make the rules and can link the two chains together as you see fit.&lt;br /&gt;
&lt;br /&gt;
To start, decide on the purpose of your payments and who will receive the coins - if anyone. In the case of a DNS system, there are two reasons you might want to pay for names:&lt;br /&gt;
&lt;br /&gt;
# To prevent abuse by people claiming all interesting names via a dictionary attack.&lt;br /&gt;
# To incentivise people to run your software and mine on your alternative chain.&lt;br /&gt;
&lt;br /&gt;
In the first case really nobody should receive the payment. The money is being put up as a collateral and has no other use, so as long as it&#039;s sitting around unspent that is good enough. In the second case the payment should go to the miner working on the DNS chain.&lt;br /&gt;
&lt;br /&gt;
To implement this we extend our hypothetical DNS transaction message like this:&lt;br /&gt;
&lt;br /&gt;
 message NameTx {&lt;br /&gt;
   required string name = 1;&lt;br /&gt;
   repeated bytes ip_addresses = 2;&lt;br /&gt;
   required bytes pubkey = 3;&lt;br /&gt;
   enum ClaimType {&lt;br /&gt;
     NEW_NAME,&lt;br /&gt;
     TRANSFER&lt;br /&gt;
   }&lt;br /&gt;
   required ClaimType type = 4;&lt;br /&gt;
   &lt;br /&gt;
   // Only used if type == TRANSFER. The new owner of the name and signature proving current ownership.&lt;br /&gt;
   optional bytes dest_pubkey = 5;&lt;br /&gt;
   optional bytes signature = 6;&lt;br /&gt;
 &lt;br /&gt;
   // Only used if type == NEW_NAME.&lt;br /&gt;
   optional bytes collateral_signature = 7;&lt;br /&gt;
   optional string miner_address = 8;&lt;br /&gt;
   optional uint64 miner_fee = 9;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The collateral_signature field contains an ECDSA signature generated from a public key that holds some Bitcoins. The miner address is blank when the name purchaser creates the transaction and is filled out after a miner receives it, but before they begin working on it.&lt;br /&gt;
&lt;br /&gt;
To buy a name that costs 10 BTC with a miner fee of 2 BTC, a user presses the &amp;quot;buy name&amp;quot; button in their DNS software. It talks to their local Bitcoin node via RPC and does the following:&lt;br /&gt;
&lt;br /&gt;
# Creates a new Bitcoin address (key).&lt;br /&gt;
# Sends 10 BTC to the new address (a send-to-self transaction).&lt;br /&gt;
# Extracts the key from Bitcoin, meaning it&#039;s no longer available to spend in your wallet.&lt;br /&gt;
# Stores the key in a local DNS data file (&amp;quot;wallet&amp;quot;) somewhere.&lt;br /&gt;
# Sets the miner_fee field to the pre-agreed value of 2 BTC.&lt;br /&gt;
# Takes the public key part and uses it to sign a version of the NameTx that lacks collateral_signature (a signature can&#039;t sign itself) and miner_address.&lt;br /&gt;
# The signature is placed in collateral_signature field.&lt;br /&gt;
# The transaction is sent to a miner who charges 2 BTC.&lt;br /&gt;
&lt;br /&gt;
When the miner receives the transaction, it verifies that the 10 BTC is not spent:&lt;br /&gt;
&lt;br /&gt;
# The ECDSA public key recovery algorithm is run on the collateral_signature. It can yield several possible keys.&lt;br /&gt;
# The public keys recovered are used to verify the signature is correct. This step also figures out which of the possible keys is the right one.&lt;br /&gt;
# The correct public key is turned into a Bitcoin address (by hashing it)&lt;br /&gt;
# The DNS node software queries Bitcoin to discover whether that address has 10 BTC associated with it, or whether the balance of that address is lower. Note that todays software does not index the balance of every address in the system, but it can be added (the Block Explorer does this).&lt;br /&gt;
# If the address does indeed have 10 unspent Bitcoins then the collateral is present and it&#039;s OK to serve the name&lt;br /&gt;
&lt;br /&gt;
The miner then creates a new Bitcoin address for themselves and sets miner_address to contain it, then includes it into the current block being worked on. After a block matching the DNS chains difficulty is found, it is broadcast. Other nodes do the following:&lt;br /&gt;
&lt;br /&gt;
# For each transaction, repeat the verification steps to ensure the collateral is not spent.&lt;br /&gt;
# Check the balance of the miners own address.&lt;br /&gt;
# If the balance is not yet equal to miner_fee, the name is put into a &amp;quot;pending&amp;quot; state in which it is owned but not served in response to DNS queries.&lt;br /&gt;
&lt;br /&gt;
The user observes the broadcast and sees that their name is now pending payment, so they send 2 BTC to the address they find in their transaction. As nodes notice the payment becoming confirmed they start responding to DNS queries for that name (ie, the ownership process is complete).&lt;br /&gt;
&lt;br /&gt;
When the user gets tired of owning the name, he can simply re-import the collateral key into his wallet and spend the coins. The DNS network will soon observe that the coins are spent and make the name available for purchasing by somebody else.&lt;br /&gt;
&lt;br /&gt;
== Incentivising non-resource based chains ==&lt;br /&gt;
&lt;br /&gt;
It&#039;s possible to incentivise mining on an alt-chain even if that chain does not have any concept of ownership, ie, if the act of finding a block itself is what is being paid for. An example of this is a timestamping chain in which presence in a block alone is sufficient to satisfy the user.&lt;br /&gt;
&lt;br /&gt;
To implement this, set up a new chain as normal. Blocks in this new chain arrange transactions into a merkle tree in the same manner as Bitcoin does. A client that wants something incorporated into a block connects directly to some miners and submits their transaction. The miners add their address to the transaction as normal. Once a miner finds a block, it immediately sends the block to connected clients whose transactions made it in, but does not broadcast the new block to other miners. The clients respond with a valid Bitcoin transaction which pays for block inclusion. Once all clients have paid up the transaction is broadcast. &lt;br /&gt;
&lt;br /&gt;
If a client has disconnected or does not pay quickly enough, their transaction can be replaced inside the block with its hash. In this way the blocks validity is preserved because the merkle tree is still valid. The newly found alt-block is broadcast, minus the transaction of the delinquent customer. As long as clients are still connected the payment process for all found transactions can be completed quickly: it would only take a few seconds to gather the payments and broadcast those on the Bitcoin network, minimizing the chance of a race that would require you to trust the miner to reinclude your transactions in the next block despite having already been paid.&lt;br /&gt;
&lt;br /&gt;
== Mining on the alt-chain but not Bitcoin ==&lt;br /&gt;
&lt;br /&gt;
So far we&#039;ve considered a scheme in which all alt-chain miners simultaneously mine on Bitcoin. It&#039;s possible some people may wish to mine on your chain but not Bitcoin, perhaps because the cost of keeping up with the Bitcoin transaction rate has become too high for them to bother.&lt;br /&gt;
&lt;br /&gt;
To mine without an attached Bitcoin node, your software can simply implement the same getwork protocol Bitcoin itself does. When a mining tool requests work your program would generate a correctly formatted but ultimately bogus Bitcoin block. The contents of this block don&#039;t need to be correct because it will never be broadcast on the Bitcoin network, for example, the prevBlockHash field can be all zeros. It exists purely for backwards compatibility. Whilst the block needs a valid merkle root and a coinbase transaction, no other transactions are required and the only part of the coinbase tx that matters is the part holding the hash.&lt;br /&gt;
&lt;br /&gt;
== Scaling up ==&lt;br /&gt;
&lt;br /&gt;
In the simple scheme each alt-chain being worked on needs 33 bytes in the Bitcoin coinbase transaction (1 for the length and 32 for the hash). Note that if there are two independent miners working on two different alt-chains, you still only need 1 hash in the coinbase scriptSig because the hash isn&#039;t meaningful to anyone else on the Bitcoin network. If miners only want to work a handful of chains this overhead is trivially dwarfed by the rest of the data in a Bitcoin block. &lt;br /&gt;
&lt;br /&gt;
But if a miner wishes to work on hundreds, thousands or millions of alternative chains the size of the coinbase scriptSig would balloon and become unworkable. To solve this, the hash stored in the scriptSig can be the root of yet another merkle tree, this time a tree over the hashes of all blocks being worked on. The BitcoinData message is extended like this:&lt;br /&gt;
&lt;br /&gt;
 message MyBlock {&lt;br /&gt;
   required bytes prev_block_hash = 1;&lt;br /&gt;
   required uint32 difficulty = 2;&lt;br /&gt;
   required uint32 time = 3; &lt;br /&gt;
 &lt;br /&gt;
   repeated MyTx transactions = 4;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 message SuperBlock {&lt;br /&gt;
   required MyBlock my_data = 1;&lt;br /&gt;
   required BitcoinData bitcoin_data = 2;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 message BitcoinData {&lt;br /&gt;
   // A Bitcoin format block header. Because it&#039;s in Satoshis custom format we represent this as a byte array.&lt;br /&gt;
   required bytes header = 1;&lt;br /&gt;
 &lt;br /&gt;
   // The first transaction from the block.&lt;br /&gt;
   required bytes coinbase_tx = 2;&lt;br /&gt;
 &lt;br /&gt;
   // The merkle branch linking the coinbase transaction to the header.&lt;br /&gt;
   required bytes coinbase_merkle_branch = 3;&lt;br /&gt;
 &lt;br /&gt;
   // The merkle branch linking MyBlock to the merkle root in the coinbase_tx.&lt;br /&gt;
   required bytes altblock_merkle_branch = 4;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
The verification step becomes a bit more complex:&lt;br /&gt;
&lt;br /&gt;
# Verify the header is of sufficient difficulty for the alt-chain&lt;br /&gt;
# Verify coinbase_tx was a part of that block by checking the coinbase_merkle_branch is linked to the merkle root in the header.&lt;br /&gt;
# Extract the root of the second merkle tree from the coinbase_tx (call it 2MR).&lt;br /&gt;
# Hash the alt-chain block (my_data), verify that altblock_merkle_branch links the my_data hash to 2MR.&lt;br /&gt;
&lt;br /&gt;
You have now proven that the MyBlock instance was worked on, along with perhaps thousands of other chains you don&#039;t have to know anything about.&lt;br /&gt;
&lt;br /&gt;
This is an advanced technique which is probably not worth implementing unless the additional scalability is required. It can be introduced in a backwards compatible manner for new chains without impacting older networks.&lt;br /&gt;
&lt;br /&gt;
=== Protecting against double proof ===&lt;br /&gt;
&lt;br /&gt;
The merkle tree approach to scalability comes with a caveat.  If naïvely implemented, a miner could cheat the proof-of-work system by putting more than one alt-chain block header into one Bitcoin block.  This &amp;quot;cheating&amp;quot; would not cause a problem if the alt-chain blocks all had the same previous-block hash: one or another would win the race, as happens when competing blocks enter the network.  The problem would arise if a linked series of alt-chain blocks all existed in one Bitcoin block&#039;s auxiliary merkle trees.  The miner could work on them all at once, getting more from his hashes than difficulty warrants.&lt;br /&gt;
&lt;br /&gt;
Namecoin&#039;s [http://dot-bit.org/forum/viewtopic.php?f=5&amp;amp;t=269&amp;amp;start=11 solution] is to constrain the paths by which alt-chain blocks may be embedded in Bitcoin blocks.  This works, but it complicates the picture for miners and chain designers in a future with many alternative chains.&lt;br /&gt;
&lt;br /&gt;
A better solution for new chains is to forbid multiple blocks from having the same proof of work hash - the hash measured against the difficulty target would need to be unique over all blocks. This means you can&#039;t embed a series of blocks into the same merkle tree and win them all simultaneously as the network would accept only one.&lt;br /&gt;
&lt;br /&gt;
== Generalized proof of work ==&lt;br /&gt;
&lt;br /&gt;
Hashes embedded in transactions and headers, merkle branches, and [[Nonce|nonces]] all contribute to the goal of [[Proof of work|proving work]] on a block header.  One can express all as sequences of these basic operations:&lt;br /&gt;
&lt;br /&gt;
* prepend a byte string to the current data&lt;br /&gt;
* append a byte string to the current data&lt;br /&gt;
* hash the current data&lt;br /&gt;
&lt;br /&gt;
For maximum flexibility, a work-sharing chain&#039;s block acceptance algorithm might accept proof in the form of a script using just these operations.  The script would receive as input an alternative chain block header, and the hash of its output would have to satisfy the chain&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
This design would even support plain Bitcoin proof of work, where the &amp;quot;header&amp;quot; consists of all [[Protocol Specification#block|Bitcoin block header fields]] except the nonce, and the proof-of-work script simply appends the nonce.  Thus, one can think of the work-sharing rules as an extension of the original Bitcoin rules.&lt;br /&gt;
&lt;br /&gt;
Note that any naive implementation of this idea would let people create proofs-of-work by including data in a Bitcoin transaction, which would be accepted into a block.&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [https://bitcointalk.org/index.php?topic=6197.0 BitDNS in the words of Satoshi]&lt;br /&gt;
* [http://dot-bit.org/Merged_Mining Merged Mining] in Namecoin&lt;br /&gt;
* [http://dot-bit.org/forum/viewtopic.php?f=5&amp;amp;t=269 Namecoin forum discussion]&lt;br /&gt;
* [https://bitcointalk.org/index.php?topic=46927.msg572981#msg572981 Forum thread about double proof]&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
See also [[Intrinsic worth brainstorming]].&lt;br /&gt;
&lt;br /&gt;
[[Category:Technical]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24968</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24968"/>
		<updated>2012-03-29T17:37:33Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added notice about april 1st&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;p style=&amp;quot;color:red&amp;quot;&amp;gt;URGENT: All P2Pool miners must upgrade to P2Pool 0.10.3 before April 1st! See [https://bitcointalk.org/index.php?topic=18313.0 the forum post]&amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640 (= 24 hours of shares), whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24825</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24825"/>
		<updated>2012-03-24T22:36:03Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: several corrections&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin and avoids the risk of hard to detect theft by pool operators.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization, some Bitcoin supporters donate to P2Pool miners, resulting in average returns above 100% of the expected reward.&lt;br /&gt;
However, it should be noted that there are other pools (such as [[BitPenny]] and [[Eligius]]) which can provide the same level of reduction of the power of the pool operator over the Bitcoin network.&lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
This means that finding shares becomes more difficult (resulting in higher variance) the more people mine on P2Pool, though large miners have the option to raise their difficulty, and so reduce the impact of their mining on P2Pool&#039;s minimum difficulty.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: edit bitcoin.conf to include:&lt;br /&gt;
 rpcuser=USER&lt;br /&gt;
 rpcpassword=LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
 server=1&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher (but not 3.x)&lt;br /&gt;
* python-argparse&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on other pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless. If you are concerned about the pool operator stealing a block, you should try to inspect the source code of each new version.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seamless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
* Appending &amp;quot;/1000&amp;quot; to a miner&#039;s username will increase the difficulty of producing a P2Pool share to at most 1000. This is useful to large miners because doing this can make it easier for small miners while minimally impacting the large miners themselves. See [https://bitcointalk.org/index.php?topic=18313.msg816322#msg816322 recommended values].&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
* [http://nodes.p2pmine.com nodes.p2pmine.com] Public list of P2Pool BTC/LTC nodes.&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24524</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24524"/>
		<updated>2012-03-07T23:49:01Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated donation urls&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on normal pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany/10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24522</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24522"/>
		<updated>2012-03-07T21:57:00Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Decrease the load on your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on normal pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24473</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24473"/>
		<updated>2012-03-06T03:02:16Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: copied readme into&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting very many shares?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on normal pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does my miner say it has found a lot of shares but p2pool say I have only found a few?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The real P2Pool difficulty is hundreds of times higher than on normal pools, but p2pool essentially lies to your miner and tells it to work on relatively easy shares so that it submits shares every few seconds instead of every few hours.  P2Pool then ignores any submitted shares that don&#039;t match the real share difficulty.  By doing this, P2Pool can more accurately report your local hash rate and you can see if you are having problems with too many stale shares quickly&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Included README ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Requirements:&lt;br /&gt;
    Generic:&lt;br /&gt;
        Bitcoin &amp;gt;=0.5.0 or Litecoin&lt;br /&gt;
        Python&lt;br /&gt;
        Twisted&lt;br /&gt;
        python-argparse (for Python &amp;lt;=2.6)&lt;br /&gt;
    &lt;br /&gt;
    Linux:&lt;br /&gt;
        sudo apt-get install python-zope.interface python-twisted python-twisted-web&lt;br /&gt;
        sudo apt-get install python-argparse # if on Python 2.6 or older&lt;br /&gt;
    &lt;br /&gt;
    Windows:&lt;br /&gt;
        Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
        Install Twisted: http://twistedmatrix.com/trac/wiki/Downloads&lt;br /&gt;
        Install Zope.Interface: http://pypi.python.org/pypi/zope.interface/3.8.0&lt;br /&gt;
            Unzip the files into C:\Python27\Lib\site-packages&lt;br /&gt;
&lt;br /&gt;
Running P2Pool:&lt;br /&gt;
    To use P2Pool, you must be running your own local bitcoind. For standard&lt;br /&gt;
    configurations, using P2Pool should be as simple as:&lt;br /&gt;
&lt;br /&gt;
        python run_p2pool.py&lt;br /&gt;
&lt;br /&gt;
    Then run your miner program, connecting to 127.0.0.1 on port 9332 with any&lt;br /&gt;
    username and password.&lt;br /&gt;
&lt;br /&gt;
    If you are behind a NAT, you should enable TCP port forwarding on your&lt;br /&gt;
    router. Forward port 9333 to the host running P2Pool.&lt;br /&gt;
&lt;br /&gt;
    Run &amp;quot;python run_p2pool.py --help&amp;quot; for additional options.&lt;br /&gt;
&lt;br /&gt;
Notes for Litecoin:&lt;br /&gt;
    Requirements:&lt;br /&gt;
        In order to run P2Pool with the Litecoin network, you would need to build and install the&lt;br /&gt;
        ltc_scrypt module that includes the scrypt proof of work code that Litecoin uses for hashes.&lt;br /&gt;
&lt;br /&gt;
        Linux:&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            sudo python setup.py install&lt;br /&gt;
&lt;br /&gt;
        Windows:&lt;br /&gt;
            Install MinGW: http://www.mingw.org/wiki/Getting_Started&lt;br /&gt;
            Install Python 2.7: http://www.python.org/getit/&lt;br /&gt;
&lt;br /&gt;
            cd litecoin_scrypt&lt;br /&gt;
            C:\Python27\python.exe setup.py build --compile=mingw32 install&lt;br /&gt;
&lt;br /&gt;
            If you run into an error with unrecognized command line option &#039;-mno-cygwin&#039;, see this:&lt;br /&gt;
                http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o&lt;br /&gt;
    &lt;br /&gt;
    Running P2Pool:&lt;br /&gt;
        Run P2Pool with the &amp;quot;--net litecoin&amp;quot; option.&lt;br /&gt;
        Run your miner program, connecting to 127.0.0.1 on port 9327.&lt;br /&gt;
        Forward port 9338 to the host running P2Pool.&lt;br /&gt;
        &lt;br /&gt;
        Litecoin&#039;s use of ports 9332 and 9332 conflicts with P2Pool running on&lt;br /&gt;
        the Bitcoin network. To avoid problems, add these lines to litecoin.conf&lt;br /&gt;
        and restart litecoind:&lt;br /&gt;
            rpcport=10332&lt;br /&gt;
            port=10333&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://p2pool.info/ p2pool.info] stats page&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=24411</id>
		<title>BIP 0022</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=BIP_0022&amp;diff=24411"/>
		<updated>2012-03-03T17:14:47Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: reason share was accepted -&amp;gt; reason share was rejected&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
  BIP: TBD&lt;br /&gt;
  Title: getmemorypool&lt;br /&gt;
  Author: Luke Dashjr &amp;lt;luke+bipgmp@dashjr.org&amp;gt;&lt;br /&gt;
  Status: Draft&lt;br /&gt;
  Type: Standards Track&lt;br /&gt;
  Created: 28-02-2012&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Abstract==&lt;br /&gt;
&lt;br /&gt;
This BIP describes a new JSON-RPC method for &amp;quot;smart&amp;quot; Bitcoin miners and proxies.&lt;br /&gt;
Instead of sending a simple block header for hashing, the entire block structure is sent, and left to the miner to (optionally) customize and assemble.&lt;br /&gt;
&lt;br /&gt;
==Specification==&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: getmemorypool===&lt;br /&gt;
&lt;br /&gt;
A new JSON-RPC method is defined, called &amp;quot;getmemorypool&amp;quot;.&lt;br /&gt;
It takes no arguments.&lt;br /&gt;
If arguments are provided, it may wrap the &amp;quot;submitblock&amp;quot; JSON-RPC method (described later), cast to a Boolean return value (true = share accepted).&lt;br /&gt;
&lt;br /&gt;
getmemorypool MUST return a JSON Object containing at least the following keys, all of which relate to the block header:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Key !! Required !! Type !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bits || {{Yes}} || String || the big-endian compressed difficulty in hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| previousblockhash || {{Yes}} || String || the hash of the previous block, in little endian converted to hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| time || {{Yes}} || Number || the recommended time&lt;br /&gt;
|-&lt;br /&gt;
| transactions || {{Yes|Should}} || Array of Strings || Bitcoin transactions encoded in hexadecimal (byte-for-byte), not including coinbase&lt;br /&gt;
|-&lt;br /&gt;
| version || {{Yes}} || Number || always 1 (at least for bitcoin)&lt;br /&gt;
|-&lt;br /&gt;
| coinbasetxn || {{Patch|or ↓}} || String || hexadecimal byte-for-byte coinbase transaction&lt;br /&gt;
|-&lt;br /&gt;
| coinbasevalue || {{Patch|or ↑}} || Number || total funds available for the coinbase&lt;br /&gt;
|-&lt;br /&gt;
| coinbaseaux || {{No}} || Object || data that SHOULD or MUST (depending on mutable flags) be included in the coinbase&#039;s scriptSig content. Only the values (hexadecimal byte-for-byte) in this Object should be included, not the keys.&lt;br /&gt;
|-&lt;br /&gt;
| curtime || {{No}} || Number || TODO?&lt;br /&gt;
|-&lt;br /&gt;
| expires || {{No}} || Number || how many seconds (beginning from when the server sent the response) this work is valid for, at most&lt;br /&gt;
|-&lt;br /&gt;
| fulltarget || {{No}} || String || the number which full results should be less than, in little-endian hexadecimal (see [[#Mutations|&amp;quot;share/*&amp;quot; mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| longpoll || {{No}} || String || URI for [[#Long Polling|long polling]]&lt;br /&gt;
|-&lt;br /&gt;
| maxtime || {{No}} || Number || the maximum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| maxtimeoff || {{No}} || Number || the maximum time allowed (as a moving offset from &#039;time&#039; - every second, the actual maxtime is incremented by 1; for example, &amp;quot;maxtimeoff&amp;quot;:0 means &amp;quot;time&amp;quot; may be incremented by 1 every second)&lt;br /&gt;
|-&lt;br /&gt;
| mintime || {{No}} || Number || the minimum time allowed&lt;br /&gt;
|-&lt;br /&gt;
| mutable || {{No}} || Array of Strings || different manipulations that the server explicitly allows to be made (see [[#Mutations|Mutations]])&lt;br /&gt;
|-&lt;br /&gt;
| noncerange || {{No}} || String || two 32-bit integers, concatenated in big-endian hexadecimal, which represent the valid ranges of nonces the miner may scan&lt;br /&gt;
|-&lt;br /&gt;
| submitold || {{No}} || Boolean || only relevant for [[#Long Polling|long poll]] responses; indicates if work received prior to this response remains potentially valid (default) and should have its shares submitted; if false, the miner may wish to discard its share queue&lt;br /&gt;
|-&lt;br /&gt;
| target || {{No}} || String || the number which valid results must be less than, in little-endian hexadecimal&lt;br /&gt;
|-&lt;br /&gt;
| txrequired || {{No}} || Number || this many of the first transactions provided must be present in the final block, even if the &amp;quot;transactions/remove&amp;quot; mutation is allowed&lt;br /&gt;
|-&lt;br /&gt;
| workid || {{No}} || String or Number || if provided, this value must be returned with results (see [[#JSON-RPC Method: submitblock|&amp;quot;submitblock&amp;quot;]])&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
====Mutations====&lt;br /&gt;
&lt;br /&gt;
Any of these may be listed in the &amp;quot;mutable&amp;quot; key to signify modifications the miner is allowed to make:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Value !! Significance&lt;br /&gt;
|-&lt;br /&gt;
| coinbase/append&lt;br /&gt;
| append the provided coinbase scriptSig&lt;br /&gt;
|-&lt;br /&gt;
| coinbase&lt;br /&gt;
| provide their own coinbase; if one is provided, it may be replaced or modified (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| generation&lt;br /&gt;
| add or remove outputs from the coinbase/generation transaction (implied if &amp;quot;coinbasetxn&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| share/merkle&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header, coinbase transaction, and merkle tree connecting that transaction to the root (in the form of repeated right-side SHA256 hashes) in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| share/truncate&lt;br /&gt;
| if the block hash is less than &amp;quot;target&amp;quot;, but not less than &amp;quot;fulltarget&amp;quot;, only return the block header in &amp;quot;submitblock&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
| time/increment&lt;br /&gt;
| change the time header to a value after &amp;quot;time&amp;quot; (implied if &amp;quot;maxtime&amp;quot; or &amp;quot;maxtimeoff&amp;quot; are provided)&lt;br /&gt;
|-&lt;br /&gt;
| time/decrement&lt;br /&gt;
| change the time header to a value before &amp;quot;time&amp;quot; (implied if &amp;quot;mintime&amp;quot; is provided)&lt;br /&gt;
|-&lt;br /&gt;
| time&lt;br /&gt;
| modify the time header of the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/add&lt;br /&gt;
| add other valid transactions to the block&lt;br /&gt;
|-&lt;br /&gt;
| transactions/remove&lt;br /&gt;
| remove transactions provided by the server&lt;br /&gt;
|-&lt;br /&gt;
| transactions&lt;br /&gt;
| add or remove transactions (both of the above; default if &amp;quot;transactions&amp;quot; omitted)&lt;br /&gt;
|-&lt;br /&gt;
| prevblock&lt;br /&gt;
| use the work with other previous-blocks; this implicitly allows removing transactions that are no longer valid, unless they are part of the &amp;quot;transactionsrequired&amp;quot; count&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Note that miners are NOT required to implement any of these mutations.&lt;br /&gt;
&lt;br /&gt;
==== Long Polling ====&lt;br /&gt;
If the server supports long polling, it SHOULD include the &amp;quot;longpoll&amp;quot; key with a relative or absolute URI.&lt;br /&gt;
The absolute URI MAY specify a different port than the original connection.&lt;br /&gt;
Miners MAY start a request to this long polling URI with a standard JSON-RPC request (POST with data) and same basic authorization.&lt;br /&gt;
This request SHOULD NOT be processed nor answered by the server until it wishes to replace the current block data.&lt;br /&gt;
Clients SHOULD make this request with a very long request timeout and MUST accept the server sending response headers with &amp;quot;chunked&amp;quot; Transfer-Encoding delaying the completion of the final JSON response.&lt;br /&gt;
&lt;br /&gt;
Upon receiving a completed response:&lt;br /&gt;
* Only if &amp;quot;submitold&amp;quot; is provided and false, the client MAY discard the results of past operations and MUST begin working on the new work immediately.&lt;br /&gt;
* The client SHOULD begin working on the new work received as soon as possible, if not immediately.&lt;br /&gt;
* The client SHOULD make a new request to the same long polling URI.&lt;br /&gt;
&lt;br /&gt;
If a client receives an incomplete or invalid response, it SHOULD retry the request with an exponential backoff.&lt;br /&gt;
Clients MAY implement this backoff with limitations (such as maximum backoff time) or any algorithm as deemed suitable.&lt;br /&gt;
It is however forbidden to simply retry immediately with no delay after more than one failure.&lt;br /&gt;
In the case of a &amp;quot;Forbidden&amp;quot; response (for example, HTTP 403), a client SHOULD NOT attempt to retry without user intervention.&lt;br /&gt;
&lt;br /&gt;
===JSON-RPC Method: submitblock===&lt;br /&gt;
A new JSON-RPC method is defined, called &amp;quot;submitblock&amp;quot;.&lt;br /&gt;
It takes one to two arguments.&lt;br /&gt;
The first argument is the block data; this may be truncated or merkle-ified depending on the &amp;quot;share/truncate&amp;quot; or &amp;quot;share/merkle&amp;quot; mutations, respectively.&lt;br /&gt;
The second argument, if provided, is an Object.&lt;br /&gt;
The only defined key of this Object is the &amp;quot;workid&amp;quot; provided by the server:&lt;br /&gt;
if a &amp;quot;workid&amp;quot; was specified, it must be submitted with the share/block.&lt;br /&gt;
&lt;br /&gt;
This method MUST return either null (when a share is accepted), a String describing briefly the reason the share was rejected, or an Object of these with a key for each merged-mining chain the share was submitted to.&lt;br /&gt;
&lt;br /&gt;
Possible reasons a share may be rejected include, but are not limited to:&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Reason !! Description&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-flag || the server detected a feature-signifying flag that it does not allow&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-length || the coinbase was too long (bitcoin limit is 100 bytes)&lt;br /&gt;
|-&lt;br /&gt;
| bad-cb-prefix || the server only allows appending to the coinbase, but it was modified beyond that&lt;br /&gt;
|-&lt;br /&gt;
| bad-diffbits || &amp;quot;bits&amp;quot; were changed&lt;br /&gt;
|-&lt;br /&gt;
| bad-prevblk || the previous-block is not the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| bad-txnmrklroot || the block header&#039;s merkle root did not match the transaction merkle tree&lt;br /&gt;
|-&lt;br /&gt;
| bad-txns || the server didn&#039;t like something about the transactions in the block&lt;br /&gt;
|-&lt;br /&gt;
| bad-version || the version was wrong&lt;br /&gt;
|-&lt;br /&gt;
| duplicate || the server already processed this block data&lt;br /&gt;
|-&lt;br /&gt;
| high-hash || the block header did not hash to a value lower than the specified target&lt;br /&gt;
|-&lt;br /&gt;
| rejected || a generic rejection without details&lt;br /&gt;
|-&lt;br /&gt;
| stale-prevblk || the previous-block is no longer the one the server intends to build on&lt;br /&gt;
|-&lt;br /&gt;
| stale-work || the work this block was based on is no longer accepted&lt;br /&gt;
|-&lt;br /&gt;
| time-invalid || the time was not acceptable&lt;br /&gt;
|-&lt;br /&gt;
| time-too-new || the time was too far in the future&lt;br /&gt;
|-&lt;br /&gt;
| time-too-old || the time was too far in the past&lt;br /&gt;
|-&lt;br /&gt;
| unknown-user || the user submitting the block was not recognized&lt;br /&gt;
|-&lt;br /&gt;
| unknown-work || the template or workid could not be identified&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
==Motivation==&lt;br /&gt;
&lt;br /&gt;
There is reasonable concerns about mining currently being too centralized on pools, and the amount of control these pools hold.&lt;br /&gt;
By exposing the details of the block proposals to the miners, they are enabled to audit and possibly modify the block before hashing it.&lt;br /&gt;
&lt;br /&gt;
There is also a very minor load reduction on the pool server, since it does not need to calculate SHA256 for the block&#039;s merkle tree.&lt;br /&gt;
&lt;br /&gt;
==Reference Implementation==&lt;br /&gt;
&lt;br /&gt;
* [https://gitorious.org/bitcoin/eloipool Eloipool]&lt;br /&gt;
* [http://luke.dashjr.org/programs/bitcoin/w/bitcoind/luke-jr.git/blobdiff/722d9387be4b267b689d7b7d78daeb7157bd12d8..gmp_bip:/src/bitcoinrpc.cpp bitcoind]&lt;br /&gt;
&lt;br /&gt;
[[Category:BIP|D]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24102</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24102"/>
		<updated>2012-02-19T20:57:21Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added line breaks&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting any shares with my NVIDIA after waiting a whole 5 minutes?!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on normal pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. They are split among P2Pool miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://btcstats.net/p2pool/ P2Pool Stats Page]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24101</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24101"/>
		<updated>2012-02-19T20:56:27Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added to faq&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What is PPLNS?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Pay-Per-Last-N-Shares is a payout method that is completely resistant to pool hoppers.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I not getting any shares with my NVIDIA after waiting a whole 5 minutes?!&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; The P2Pool difficulty is hundreds of times higher than on normal pools. It can take time to get a share. P2Pool displays an estimate of how long you have to wait in the console output.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why am I getting so many rejects?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; You&#039;re using an incompatible miner. See the miners section here, increase your FPS on the miner, decrease the intensity, upgrade your miner, or try a different miner.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What stops the pool operator or the block finder from stealing a block?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; A block solution is only worth anything because its hash matches Bitcoin&#039;s target. Altering anything within the block will change its hash and make it worthless.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Why does it say &amp;quot;Generated?&amp;quot; I want to spend my coins now!&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; P2Pool includes payouts in generation transactions, which must mature (taking 120 blocks or 20 hours) before they can be spent. The reason for this is that a block could be orphaned, which would make its payout invalid and could reverse transactions.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I get paid transaction fees?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What are these payments I&#039;m getting that aren&#039;t generated?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; These are subsidies that people who support the idea of P2Pool send to miners.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Cool Subsidies sound like an awesome idea! How do I send some BTC to these awesome miners?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; See end of this page.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; Do I really need the WHOLE blockchain?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Yes. Your node needs to be able to independently make decisions about what transactions to mine.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; How do merged mining payments work?&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; Merged mining is handled entirely by namecoind, so you&#039;re solo mining and payouts will go into namecoind&#039;s wallet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://btcstats.net/p2pool/ P2Pool Stats Page]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24015</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=24015"/>
		<updated>2012-02-17T23:57:19Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: typo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 95% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
For example, a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
Note that the amount you donate will be allocated to recent miners in proportion to the amount of work they&#039;ve done in the last 24 hours or so, but all the miner whose shares of the donated amount are less than 0.01 BTC will have their shares combined into a single amount which is awarded to one of them at random, with the chance of winning this &#039;lottery&#039; weighted by the miner&#039;s recent amount of work done.  You can change this 0.01 BTC threshold like this, for example, which says to pay 10 BTC, but to share it amongst more miners that the default, cutting off at 0.001 BTC instead of at 0.01 BTC.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10/0.001)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
* [http://btcstats.net/p2pool/ P2Pool Stats Page]&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23747</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23747"/>
		<updated>2012-02-12T16:25:24Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added web interface docs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 5% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Web interface ===&lt;br /&gt;
&lt;br /&gt;
Lots of data and useful tools are available at http://127.0.0.1:9332/something:&lt;br /&gt;
* /graphs - RRD graphs of past hash rates for pool and local miners. Look for &amp;quot;VIP password&amp;quot; in P2Pool&#039;s output when it starts and use that for your miners to get graphs for individual miners.&lt;br /&gt;
* /rate&lt;br /&gt;
* /users&lt;br /&gt;
* /fee&lt;br /&gt;
* /current_payouts&lt;br /&gt;
* /patron_sendmany - Gives sendmany outputs for fair donations to P2Pool&lt;br /&gt;
* /global_stats&lt;br /&gt;
* /local_stats&lt;br /&gt;
* /peer_addresses&lt;br /&gt;
* /payout_addr&lt;br /&gt;
* /recent_blocks&lt;br /&gt;
* /uptime&lt;br /&gt;
* /chain_img - Visualization of sharechain&lt;br /&gt;
* /web/log - Some different stats collected over the last day&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23717</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23717"/>
		<updated>2012-02-11T23:41:37Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added bitcoin address as miner username info&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 5% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
* Setting the username of your miner connecting to P2Pool to a Bitcoin address will make it mine to that address instead of the one requested from bitcoind or set by -a&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23640</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23640"/>
		<updated>2012-02-09T21:50:38Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated help text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 5% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--datadir DATADIR]&lt;br /&gt;
                     [--logfile LOGFILE] [--merged MERGED_URLS]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version 28a1948)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --datadir DATADIR     store data in this directory (default: &amp;lt;directory&lt;br /&gt;
                        run_p2pool.py is in&amp;gt;/data)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged MERGED_URLS  call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example:&lt;br /&gt;
                        http://ncuser:ncpass@127.0.0.1:10332/)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        DEPRECATED, use --merged&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23639</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23639"/>
		<updated>2012-02-09T21:49:50Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added configuration file usage&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 5% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
* You can make P2Pool use a configuration file by running run_p2pool.py @FILENAME, with FILENAME being the path to a file containing the command-line arguments (newlines are ignored) Example:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
--net litecoin&lt;br /&gt;
-n 1.2.3.4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23601</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23601"/>
		<updated>2012-02-08T22:19:42Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added FAQ&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Frequently Asked Questions ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Why does cgminer report so many longpoll events when mining on p2pool? - P4Man&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; &amp;quot;Once every ~10 seconds is normal. That is how often p2pool shares are generated (as opposed to ~10 min for bitcoin blocks) - cabin&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;Do the &#039;orphan&#039; and &#039;dead&#039; shares in P2Pool&#039;s status display hurt me?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; They shouldn&#039;t - It&#039;s normal for some fraction of everyone&#039;s shares to end up orphaned or dead. Because payouts are calculated by counting how many shares you have relative to others, everyone with normal configurations is equally &amp;quot;hurt&amp;quot; by this. However, if you have a large proportion of stales, your payout will be hurt. You can see how well you&#039;re doing by looking at P2Pool&#039;s &amp;quot;Efficiency&amp;quot; (ex: &#039;&#039;Efficiency: ~110.6% (40-111%)&#039;&#039;). If 100% doesn&#039;t lie within the [http://en.wikipedia.org/wiki/Confidence_interval confidence interval] at the end, something is probably wrong (with 5% confidence).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; &amp;quot;What do I do if my efficiency is low?&amp;quot;&amp;lt;br /&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; If you have a lot of dead shares or the &amp;quot;Local dead on arrival&amp;quot; number is higher than a few percent, that means that something is wrong with your miner. Check to make sure that it is one of the working versions in the &#039;&#039;Miners&#039;&#039; section on this page. Make sure the computers you&#039;re running P2Pool and the miner on have enough memory and CPU time. Lower the intensity or raise the FPS of your miner. If you have a lot of orphan shares, something is wrong with P2Pool&#039;s P2P connection. Don&#039;t overload your internet connection or enable QoS (Quality of Service) on your router.&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23453</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23453"/>
		<updated>2012-02-06T17:25:22Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;blockquote&amp;gt;P2Pool creates a new block chain in which the difficulty is adjusted so a new block is found every 10 seconds. The blocks that get into the P2Pool block chain (called the &amp;quot;share chain&amp;quot;) are the same blocks that would get into the Bitcoin block chain, only they have a lower difficulty target. Whenever a peer announces a new share found (new block in the P2Pool block chain), it is received by the other peers, and the other peers verify that this block contains payouts for all the previous miners who found a share (and announced it) that made it into the P2Pool share chain. This continues until some peer finds a block that has a difficulty that meets the Bitcoin network&#039;s difficulty target. This peer announces this block to the Bitcoin network and miners who have submitted shares for this block are paid in the generation transaction, proportionally to how many shares they have found in the last while. - Unknown author&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if it isn&#039;t on the same computer as the miner) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23371</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23371"/>
		<updated>2012-02-04T17:06:38Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated instructions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe&lt;br /&gt;
** Source: python run_p2pool.py&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/ --submit-stales&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23352</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23352"/>
		<updated>2012-02-04T05:01:31Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: changed default donation from 10BTC to 1BTC.. don&amp;#039;t want people complaining if they copy/paste it as is accidentally&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
** Source: python run_p2pool.py USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=1)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23350</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23350"/>
		<updated>2012-02-04T05:00:04Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: undid potentially malicious donation address change by Drag&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it, or use a brute force attack in order to find it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
** Source: python run_p2pool.py USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23300</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23300"/>
		<updated>2012-02-02T21:35:53Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: added &amp;quot;useful features&amp;quot; section - needs more expansion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
** Source: python run_p2pool.py USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Useful features ===&lt;br /&gt;
&lt;br /&gt;
* If upgrading P2Pool or changing its configuration, you can start another instance of P2Pool in parallel with the first. It will start normally, but realize that the worker and P2P listening ports are busy and keep trying to bind to them in the background. Thus, you can do almost-completely-seemless upgrades of P2Pool.&lt;br /&gt;
* If you run multiple P2Pool nodes or have trusted friends that run P2Pool, you can use &#039;&#039;-n&#039;&#039; to establish a constant extra P2P connection to them.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the following bitcoin address:&lt;br /&gt;
&lt;br /&gt;
16TgDchkexj3nVoN8akinrNDiMqpqPQdwc&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23151</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=23151"/>
		<updated>2012-01-31T17:33:54Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated --help text&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
** Source: python run_p2pool.py USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin}] [--testnet]&lt;br /&gt;
                     [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--irc-announce]&lt;br /&gt;
                     [--p2pool-port PORT] [-n ADDR[:PORT]] [--disable-upnp]&lt;br /&gt;
                     [-w PORT] [-f FEE_PERCENTAGE]&lt;br /&gt;
                     [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSERPASS [BITCOIND_RPCUSERPASS ...]]&lt;br /&gt;
&lt;br /&gt;
p2pool (version a7d3ae4)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --irc-announce        announce any blocks found on&lt;br /&gt;
                        irc://irc.freenode.net/#p2pool&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333 &amp;lt;read from bitcoin.conf if&lt;br /&gt;
                        password not provided&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCUSERPASS  bitcoind RPC interface username, then password, space-&lt;br /&gt;
                        separated (only one being provided will cause the&lt;br /&gt;
                        username to default to being empty, and none will&lt;br /&gt;
                        cause P2Pool to read them from bitcoin.conf)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the following bitcoin address:&lt;br /&gt;
&lt;br /&gt;
16TgDchkexj3nVoN8akinrNDiMqpqPQdwc&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22908</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22908"/>
		<updated>2012-01-28T19:45:13Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated miners&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node; this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is [[Comparison_of_mining_pools|PPLNS]] only your stale rate relative to other nodes is relevant; the absolute rate is not.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=LONG_RANDOM_SECRET_VALUE, and server=1 in bitcoin.conf (on separate lines)&lt;br /&gt;
**&#039;&#039;&#039;Replace LONG_RANDOM_SECRET_VALUE with something long and random like the output of smashing your keyboard for a bit like fju4M78yAj3ds39pak92raK&#039;&#039;&#039;. You don&#039;t need to be able to remember it. If your RPC port becomes exposed to the internet a thief could steal your bitcoin if they could guess it.&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
** Source: python run_p2pool.py USER LONG_RANDOM_SECRET_VALUE&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. &lt;br /&gt;
&lt;br /&gt;
With all miners, using a HIGH FPS target (100?) or a LOW intensity (8 for cgminer?) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
* cgminer works perfectly without any extra options. However, using multiple pools might cause problems, because long polling is only done for one pool.&lt;br /&gt;
* ufasoft works perfectly.&lt;br /&gt;
* DiabloMiner works fine after commit 3b731b9.&lt;br /&gt;
* Phoenix works fine after commit a658ef2.&lt;br /&gt;
* Poclbm works fine after commit 5e994e7.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the following bitcoin address:&lt;br /&gt;
&lt;br /&gt;
16TgDchkexj3nVoN8akinrNDiMqpqPQdwc&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22643</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22643"/>
		<updated>2012-01-23T13:04:57Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updates&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 17000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
(Works fine after commit 8263f65!)&lt;br /&gt;
&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;shares&#039;&#039;&#039; - broadcast message of the contents of shares - contains (&#039;&#039;shares&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22642</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22642"/>
		<updated>2012-01-23T13:02:34Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: some cleanup&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a peer-to-peer network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of hard to detect theft by pool operators, and has better fundamental resistance to DoS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself, which can also result in a share if it meets P2Pool&#039;s difficulty.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a Merkle branch linking that generation transaction to the block header&#039;s Merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds, just as Bitcoin regulates it to generate one block every ten minutes.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays to the previous &#039;&#039;n&#039;&#039; shares, where &#039;&#039;n&#039;&#039; is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve, which is proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 17000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share0s&#039;&#039;&#039; - broadcast message of the hashes of shares - contains (&#039;&#039;hashes&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1as&#039;&#039;&#039; - broadcast message of the contents of shares that do not qualify as bitcoin blocks - contains (&#039;&#039;share1as&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1bs&#039;&#039;&#039; - broadcast message of the contents of shares that qualify as bitcoin blocks - contains (&#039;&#039;share1bs&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;mode&#039;&#039; is 0 for low-bandwidth mode, which sends the hash of a share first before sending the entire share, or 1 for low-latency (default) mode, which forwards the entire (~170 byte) share always. The two nodes on either side of a connection use the minimum of their two preferences for that connection.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22382</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22382"/>
		<updated>2012-01-17T01:49:19Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: removed sqlite mention&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a P2P network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of difficult to detect theft by pool operators, and has better fundamental resistance to DOS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a merkle branch linking that generation transaction to the block header&#039;s merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays out to the previous n shares, where n is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve - proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher&lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 17000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share0s&#039;&#039;&#039; - broadcast message of the hashes of shares - contains (&#039;&#039;hashes&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1as&#039;&#039;&#039; - broadcast message of the contents of shares that do not qualify as bitcoin blocks - contains (&#039;&#039;share1as&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1bs&#039;&#039;&#039; - broadcast message of the contents of shares that qualify as bitcoin blocks - contains (&#039;&#039;share1bs&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;mode&#039;&#039; is 0 for low-bandwidth mode, which sends the hash of a share first before sending the entire share, or 1 for low-latency (default) mode, which forwards the entire (~170 byte) share always. The two nodes on either side of a connection use the minimum of their two preferences for that connection.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22379</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22379"/>
		<updated>2012-01-16T23:44:11Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated share counts&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a P2P network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of difficult to detect theft by pool operators, and has better fundamental resistance to DOS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a merkle branch linking that generation transaction to the block header&#039;s merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 8640 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays out to the previous n shares, where n is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 8640, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve - proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher - with sqlite support &lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 17000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share0s&#039;&#039;&#039; - broadcast message of the hashes of shares - contains (&#039;&#039;hashes&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1as&#039;&#039;&#039; - broadcast message of the contents of shares that do not qualify as bitcoin blocks - contains (&#039;&#039;share1as&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1bs&#039;&#039;&#039; - broadcast message of the contents of shares that qualify as bitcoin blocks - contains (&#039;&#039;share1bs&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;mode&#039;&#039; is 0 for low-bandwidth mode, which sends the hash of a share first before sending the entire share, or 1 for low-latency (default) mode, which forwards the entire (~170 byte) share always. The two nodes on either side of a connection use the minimum of their two preferences for that connection.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22284</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22284"/>
		<updated>2012-01-16T03:48:10Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: moved section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a P2P network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of difficult to detect theft by pool operators, and has better fundamental resistance to DOS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a merkle branch linking that generation transaction to the block header&#039;s merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 17280 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays out to the previous n shares, where n is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 17280, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve - proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher - with sqlite support &lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 35000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share0s&#039;&#039;&#039; - broadcast message of the hashes of shares - contains (&#039;&#039;hashes&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1as&#039;&#039;&#039; - broadcast message of the contents of shares that do not qualify as bitcoin blocks - contains (&#039;&#039;share1as&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1bs&#039;&#039;&#039; - broadcast message of the contents of shares that qualify as bitcoin blocks - contains (&#039;&#039;share1bs&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;mode&#039;&#039; is 0 for low-bandwidth mode, which sends the hash of a share first before sending the entire share, or 1 for low-latency (default) mode, which forwards the entire (~170 byte) share always. The two nodes on either side of a connection use the minimum of their two preferences for that connection.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
	<entry>
		<id>https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22283</id>
		<title>P2Pool</title>
		<link rel="alternate" type="text/html" href="https://en.bitcoin.it/w/index.php?title=P2Pool&amp;diff=22283"/>
		<updated>2012-01-16T03:47:53Z</updated>

		<summary type="html">&lt;p&gt;Forrestv: updated diablominer section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:P2pool_chain.png‎|thumb|350px|right|Visualization of the P2Pool share chain]]&lt;br /&gt;
P2Pool is a decentralized [[Bitcoin]] [[Bitcoin Pool|mining pool]] that works by creating a P2P network of miner nodes.&lt;br /&gt;
&lt;br /&gt;
Decentralized payout pooling solves the problem of centralized mining pools degrading the decentralization of Bitcoin, avoids the risk of difficult to detect theft by pool operators, and has better fundamental resistance to DOS attacks than centralized pools.&lt;br /&gt;
&lt;br /&gt;
Miners are configured to connect to a P2Pool node that can be run locally, alongside the miner. P2Pool users must run a full Bitcoin node which serves the purpose of the purpose of independently validating transactions and the Bitcoin blockchain. P2Pool also supports merged mining and several alternative blockchains.&lt;br /&gt;
&lt;br /&gt;
P2Pool nodes work on a chain of shares similar to Bitcoin&#039;s blockchain. Each node works on a block that includes payouts to the previous shares&#039; owners and the node itself.&lt;br /&gt;
&lt;br /&gt;
Because of the importance of strengthening Bitcoin&#039;s decentralization some Bitcoin supporters donate to P2Pool miners, resulting in returns above 100% of the expected reward.  &lt;br /&gt;
&lt;br /&gt;
== Overview ==&lt;br /&gt;
&lt;br /&gt;
P2Pool shares form a &amp;quot;sharechain&amp;quot; with each share referencing the previous share&#039;s hash. Each share contains a standard Bitcoin block header, some P2Pool-specific data that is used to compute the generation transaction (total subsidy, payout script of this share, a nonce, the previous share&#039;s hash, and the current target for shares), and a merkle branch linking that generation transaction to the block header&#039;s merkle hash.&lt;br /&gt;
&lt;br /&gt;
The chain continuously regulates its target to keep generation around one share every ten seconds.&lt;br /&gt;
&lt;br /&gt;
Unlike Bitcoin, nodes do not know the entire chain - instead they only hold the last 17280 shares (the last day&#039;s worth). In order to prevent an attacker from working on a chain in secret and then releasing it, overriding the existing chain, chains are judged by how much work they have since a point in the past. To ascertain that the work has been done since that point, nodes look at the Bitcoin blocks that the shares reference, establishing a provable timestamp. (If a share points to a block, it was definitely made after that block was made.)&lt;br /&gt;
&lt;br /&gt;
=== Payout logic ===&lt;br /&gt;
&lt;br /&gt;
Each share contains a generation transaction that pays out to the previous n shares, where n is the number of shares whose total work is equal to 3 times the average work required to solve a block, or 17280, whichever is smaller. Payouts are weighted based on the amount of work each share took to solve - proportional to the p2pool difficulty at that time.&lt;br /&gt;
&lt;br /&gt;
The block reward (currently 50BTC) and the transaction fees are combined and apportioned according to these rules:&lt;br /&gt;
&lt;br /&gt;
A subsidy of 0.5% is sent to the node that solved the block in order to discourage not sharing solutions that qualify as a block. (A miner with the aim to harm others could withhold the block, thereby preventing anybody from getting paid. He can NOT redirect the payout to himself.) The remaining 99.5% is distributed evenly to miners based on work done recently.&lt;br /&gt;
&lt;br /&gt;
In the event that a share qualifies as a block, this generation transaction is exposed to the Bitcoin network and takes effect, transferring each node its payout.&lt;br /&gt;
&lt;br /&gt;
=== Stales ===&lt;br /&gt;
&lt;br /&gt;
P2Pool stales don&#039;t work the same way as stales on centralized pools. On a centralized pool a stale is work which is too old to be accepted by the pool&#039;s Bitcoin node, this kind of stale is very rare in P2Pool because each user runs their own local bitcoind.&lt;br /&gt;
&lt;br /&gt;
On P2Pool stales refer to shares which can&#039;t make it into the sharechain.  Because the sharechain is 60 times faster than the Bitcoin chain many stales are common and expected. However, because the payout is PPLNS the absolute amount of of stales is irrelevant, only your stale rate relative to other nodes.&lt;br /&gt;
&lt;br /&gt;
There are two reported kinds of stales in P2Pool: &amp;quot;DEAD ON ARRIVAL&amp;quot; shares and orphan shares. Dead shares were too old by the time they arrived at your local P2Pool. Very high dead rates can indicate miner misconfiguration. Orphan shares are shares which were not extended by the rest of the P2Pool network, because some other miner&#039;s share was accepted first. Very high orphan rates may indicate network connectivity problems. &lt;br /&gt;
&lt;br /&gt;
The P2Pool console output shows your relative stale rate compared to other P2Pool miners in the &#039;Own efficiency&#039; column:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
2012-01-07 20:57:51.797420 Pool stales: 13% Own: 13±2% Own efficiency: 100±2%&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When you first start P2Pool claimed efficiency will be low and the error bounds on this estimate will be large, but as it runs the numbers will converge to their correct values.&lt;br /&gt;
&lt;br /&gt;
If your efficiency is unusually low, make sure your network connection isn&#039;t overloaded, that your miners support long polling and are not set to work for excessive amounts of time, and that your bitcoind has multiple connections.&lt;br /&gt;
&lt;br /&gt;
== Joining the pool ==&lt;br /&gt;
&lt;br /&gt;
Follow these steps to join the pool:&lt;br /&gt;
&lt;br /&gt;
* Run Bitcoin with the RPC interface enabled: put rpcuser=USER, rpcpassword=PASS, and server=1 in bitcoin.conf&lt;br /&gt;
** Bitcoin 0.5 or later is required&lt;br /&gt;
** It&#039;s important that your Bitcoin client be fully synchronized before starting. It&#039;s also better if you have the Bitcoin port forwarded&lt;br /&gt;
* Download p2pool:&lt;br /&gt;
** Windows binary: See http://forum.bitcoin.org/index.php?topic=18313.0&lt;br /&gt;
** Source download: https://github.com/forrestv/p2pool/tags&lt;br /&gt;
** git: git clone git://github.com/forrestv/p2pool.git&lt;br /&gt;
* Run p2pool: (See below for additional options.)&lt;br /&gt;
** Windows py2exe: run_p2pool.exe USER PASS&lt;br /&gt;
** Source: python run_p2pool.py USER PASS&lt;br /&gt;
* Run a miner daemon with long polling connecting to 127.0.0.1 (or the IP of the host running p2pool if you&#039;re mining remotely) on port 9332 with any username and password&lt;br /&gt;
** cgminer -O u:p -o http://127.0.0.1:9332/&lt;br /&gt;
&lt;br /&gt;
Dependencies if running from source:&lt;br /&gt;
* Python 2.6 or higher - with sqlite support &lt;br /&gt;
* python-argparse for Python 2.6 and lower&lt;br /&gt;
* Twisted (Ubuntu package python-twisted)&lt;br /&gt;
&lt;br /&gt;
=== Miners ===&lt;br /&gt;
&lt;br /&gt;
This is all for the latest p2pool version, as it includes several new workarounds. With all miners, using a high FPS target (100?) or a low aggression, and waiting for p2pool to completely start (line shows &amp;gt; 35000 shares) helps a lot with reducing stales.&lt;br /&gt;
&lt;br /&gt;
P2Pool uses higher difficulty shares than most centralized pools, so you&#039;ll see fewer shares reported. This is normal and doesn&#039;t reduce your payments.  It&#039;s also normal to see longpoll messages once per every ten seconds on average.&lt;br /&gt;
&lt;br /&gt;
==== Works as-is ====&lt;br /&gt;
&lt;br /&gt;
===== cgminer =====&lt;br /&gt;
Works very well as is.&lt;br /&gt;
&lt;br /&gt;
===== ufasoft ===== &lt;br /&gt;
Works as is.&lt;br /&gt;
&lt;br /&gt;
==== Needs patch to reduce stales ====&lt;br /&gt;
&lt;br /&gt;
===== DiabloMiner =====&lt;br /&gt;
Works fine after commit 3b731b9b54.&lt;br /&gt;
&lt;br /&gt;
===== Poclbm =====&lt;br /&gt;
Waits a full second between long polls.&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/poclbm&lt;br /&gt;
Pull request: https://github.com/m0mchil/poclbm/pull/41&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone git://github.com/forrestv/poclbm.git&lt;br /&gt;
cd poclbm&lt;br /&gt;
git checkout fast_long_polling&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/wodukkea/p2pool-poclbm_win32_5590e7c.zip&lt;br /&gt;
&lt;br /&gt;
===== Phoenix =====&lt;br /&gt;
Has a similar bug (waiting a full second).&lt;br /&gt;
&lt;br /&gt;
GitHub fork: https://github.com/forrestv/phoenix-miner&lt;br /&gt;
&lt;br /&gt;
Windows binary: http://u.forre.st/u/ycvzejfm/phoenix-miner-fba48d2-5.zip&lt;br /&gt;
&lt;br /&gt;
==== Not-compatible ====&lt;br /&gt;
&lt;br /&gt;
===== puddinpop&#039;s RPC Miners =====&lt;br /&gt;
Does not have long polling so will not work at all.&lt;br /&gt;
&lt;br /&gt;
=== Option Reference ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
usage: run_p2pool.py [-h] [--version] [--net {bitcoin, litecoin, namecoin}]&lt;br /&gt;
                     [--testnet] [--debug] [-a ADDRESS] [--logfile LOGFILE]&lt;br /&gt;
                     [--merged-url MERGED_URL]&lt;br /&gt;
                     [--merged-userpass MERGED_USERPASS]&lt;br /&gt;
                     [--give-author DONATION_PERCENTAGE] [--p2pool-port PORT]&lt;br /&gt;
                     [-n ADDR[:PORT]] [--disable-upnp] [-w PORT]&lt;br /&gt;
                     [-f FEE_PERCENTAGE] [--bitcoind-address BITCOIND_ADDRESS]&lt;br /&gt;
                     [--bitcoind-rpc-port BITCOIND_RPC_PORT]&lt;br /&gt;
                     [--bitcoind-p2p-port BITCOIND_P2P_PORT]&lt;br /&gt;
                     [BITCOIND_RPCUSER] BITCOIND_RPCPASSWORD&lt;br /&gt;
&lt;br /&gt;
p2pool (version 31cbeea)&lt;br /&gt;
&lt;br /&gt;
optional arguments:&lt;br /&gt;
  -h, --help            show this help message and exit&lt;br /&gt;
  --version             show program&#039;s version number and exit&lt;br /&gt;
  --net {bitcoin, litecoin, namecoin}&lt;br /&gt;
                        use specified network (default: bitcoin)&lt;br /&gt;
  --testnet             use the network&#039;s testnet&lt;br /&gt;
  --debug               enable debugging mode&lt;br /&gt;
  -a ADDRESS, --address ADDRESS&lt;br /&gt;
                        generate payouts to this address (default: &amp;lt;address&lt;br /&gt;
                        requested from bitcoind&amp;gt;)&lt;br /&gt;
  --logfile LOGFILE     log to this file (default: data/&amp;lt;NET&amp;gt;/log)&lt;br /&gt;
  --merged-url MERGED_URL&lt;br /&gt;
                        call getauxblock on this url to get work for merged&lt;br /&gt;
                        mining (example: http://127.0.0.1:10332/)&lt;br /&gt;
  --merged-userpass MERGED_USERPASS&lt;br /&gt;
                        use this user and password when requesting merged&lt;br /&gt;
                        mining work (example: ncuser:ncpass)&lt;br /&gt;
  --give-author DONATION_PERCENTAGE&lt;br /&gt;
                        donate this percentage of work to author of p2pool&lt;br /&gt;
                        (default: 0.5)&lt;br /&gt;
  --disable-upnp        don&#039;t attempt to use UPnP to forward p2pool&#039;s P2P port&lt;br /&gt;
                        from the Internet to this computer&lt;br /&gt;
&lt;br /&gt;
p2pool interface:&lt;br /&gt;
  --p2pool-port PORT    use port PORT to listen for connections (forward this&lt;br /&gt;
                        port from your router!) (default: bitcoin:9333,&lt;br /&gt;
                        litecoin:9338, namecoin:9334)&lt;br /&gt;
  -n ADDR[:PORT], --p2pool-node ADDR[:PORT]&lt;br /&gt;
                        connect to existing p2pool node at ADDR listening on&lt;br /&gt;
                        port PORT (defaults to default p2pool P2P port) in&lt;br /&gt;
                        addition to builtin addresses&lt;br /&gt;
&lt;br /&gt;
worker interface:&lt;br /&gt;
  -w PORT, --worker-port PORT&lt;br /&gt;
                        listen on PORT for RPC connections from miners&lt;br /&gt;
                        (default: bitcoin:9332, litecoin:9327, namecoin:9331)&lt;br /&gt;
  -f FEE_PERCENTAGE, --fee FEE_PERCENTAGE&lt;br /&gt;
                        charge workers mining to their own bitcoin address (by&lt;br /&gt;
                        setting their miner&#039;s username to a bitcoin address)&lt;br /&gt;
                        this percentage fee to mine on your p2pool instance.&lt;br /&gt;
                        Amount displayed at http://127.0.0.1:WORKER_PORT/fee&lt;br /&gt;
                        (default: 0)&lt;br /&gt;
&lt;br /&gt;
bitcoind interface:&lt;br /&gt;
  --bitcoind-address BITCOIND_ADDRESS&lt;br /&gt;
                        connect to this address (default: 127.0.0.1)&lt;br /&gt;
  --bitcoind-rpc-port BITCOIND_RPC_PORT&lt;br /&gt;
                        connect to JSON-RPC interface at this port (default:&lt;br /&gt;
                        bitcoin:8332, litecoin:9332, namecoin:8332)&lt;br /&gt;
  --bitcoind-p2p-port BITCOIND_P2P_PORT&lt;br /&gt;
                        connect to P2P interface at this port (default:&lt;br /&gt;
                        bitcoin:8333, litecoin:9333, namecoin:8334)&lt;br /&gt;
  BITCOIND_RPCUSER      bitcoind RPC interface username (default: &amp;lt;empty&amp;gt;)&lt;br /&gt;
  BITCOIND_RPCPASSWORD  bitcoind RPC interface password&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Protocol description ==&lt;br /&gt;
&lt;br /&gt;
P2Pool&#039;s protocol mirrors Bitcoin&#039;s P2P protocol in many ways. It uses the same framing (prefix, command, length, checksum, payload) and similar commands:&lt;br /&gt;
&lt;br /&gt;
* &#039;&#039;&#039;version&#039;&#039;&#039; - sent to establish a connection - contains (&#039;&#039;version&#039;&#039;, &#039;&#039;services&#039;&#039;, &#039;&#039;addr_to&#039;&#039;, &#039;&#039;addr_from&#039;&#039;, &#039;&#039;nonce&#039;&#039;, &#039;&#039;sub_version&#039;&#039;, &#039;&#039;mode&#039;&#039;, &#039;&#039;best_share_hash&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;setmode&#039;&#039;&#039; - sent to update the &#039;&#039;mode&#039;&#039; sent in the &#039;&#039;&#039;version&#039;&#039;&#039; message - contains (&#039;&#039;mode&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;ping&#039;&#039;&#039; - sent to keep connection alive - contains ()&lt;br /&gt;
* &#039;&#039;&#039;addrme&#039;&#039;&#039; - request that the receiving node send out an addr for the sending node - contains (&#039;&#039;port&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;addrs&#039;&#039;&#039; - broadcast list of nodes&#039; addresses - contains (&#039;&#039;addrs&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getaddrs&#039;&#039;&#039; - request that the receiving node send &#039;&#039;count&#039;&#039; addrs - contains (&#039;&#039;count&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;getshares&#039;&#039;&#039; - request that the receiving node send the shares referenced by &#039;&#039;hashes&#039;&#039; and &#039;&#039;parents&#039;&#039; of their parents, stopping at any share referenced by &#039;&#039;stops&#039;&#039; - contains (&#039;&#039;hashes&#039;&#039;, &#039;&#039;parents&#039;&#039;, &#039;&#039;stops&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share0s&#039;&#039;&#039; - broadcast message of the hashes of shares - contains (&#039;&#039;hashes&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1as&#039;&#039;&#039; - broadcast message of the contents of shares that do not qualify as bitcoin blocks - contains (&#039;&#039;share1as&#039;&#039;)&lt;br /&gt;
* &#039;&#039;&#039;share1bs&#039;&#039;&#039; - broadcast message of the contents of shares that qualify as bitcoin blocks - contains (&#039;&#039;share1bs&#039;&#039;)&lt;br /&gt;
&lt;br /&gt;
The &#039;&#039;mode&#039;&#039; is 0 for low-bandwidth mode, which sends the hash of a share first before sending the entire share, or 1 for low-latency (default) mode, which forwards the entire (~170 byte) share always. The two nodes on either side of a connection use the minimum of their two preferences for that connection.&lt;br /&gt;
&lt;br /&gt;
==History==&lt;br /&gt;
&lt;br /&gt;
This project was announced on June 17, 2011 by Forrest Voight&amp;lt;ref&amp;gt;[https://forum.bitcoin.org/index.php?topic=18313.0 p2pool: Decentralized, DoS-resistant, Hop-Proof - Now active on mainnet!]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The began testing against mainnet in mid-July, 2011.  The pool was reviewed on a [[Bitcoin Miner]] post on July 26, 2011&amp;lt;ref&amp;gt;[http://www.bitcoinminer.com/post/8101660461 P2Pool Decentralized Pool Nearly Ready For Prime-Time]&amp;lt;/ref&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The software author&#039;s address for donations can be found in the signature section of his [http://forum.bitcoin.org/index.php?action=profile;u=6447 forum profile].&lt;br /&gt;
&lt;br /&gt;
==Donating to P2Pool miners==&lt;br /&gt;
In order to encourage people to mine to P2Pool you can donate to the recent miners in proportion using a sendmany:&lt;br /&gt;
&lt;br /&gt;
E.g. a bash script to donate 10 btc is:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
~/src/bitcoin/src/bitcoind sendmany &amp;quot;&amp;quot; &amp;quot;$(GET http://forre.st:9332/patron_sendmany?total=10.0)&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can replace &amp;quot;&amp;quot; with &amp;quot;accountname&amp;quot; if you want to pay from some specific bitcoind account, and you can replace forre.st with 127.0.0.1 if you&#039;re running a P2Pool node locally, so you don&#039;t have to trust that the URL gives accurate figures.&lt;br /&gt;
&lt;br /&gt;
If you decide to donate you should announce it on the forums so that your donations provide the most incentive possible.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
* [[Comparison of mining pools]]&lt;br /&gt;
* [[Pooled Mining]]&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
* [http://forum.bitcoin.org/index.php?topic=18313.0 P2Pool forum]&lt;br /&gt;
* [https://github.com/forrestv/p2pool p2pool] project on GitHub&lt;br /&gt;
* {{Freenode IRC|p2pool}} discussion and support&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Pool Operators]]&lt;/div&gt;</summary>
		<author><name>Forrestv</name></author>
	</entry>
</feed>