P2Pool linux下安装运行

来源:互联网 发布:广州linux运维培训 编辑:程序博客网 时间:2024/05/21 02:48

logo

P2Pool

DownloadGetting startedFAQLinks

What is P2Pool?

P2Pool is a decentralized Bitcoin mining pool that works by creating a peer-to-peer network of miner nodes.


As opposed to usual pools, P2Pool helps to secure Bitcoin against double-spending and 51% attacks. P2Pool's initial setup requires a little more effort but provides equivalent payouts with a higher variance and no need for trust in a pool operator.
P2Pool是种分布式的矿池,其机制是维护一个p2p的矿机节点网络。
相较于常用的矿池,P2Pool更有助于防止double-spending和51%攻击。P2Pool安装需要费点事儿,但是提供了更多种形式的分成模式,也不再受制于矿池运营人员是否可信赖。

Download P2Pool

Windows Windows


Download the newest version from the Windows binaries: p2pool_win32_13.4.zip .sig
You can also download the source as tar/zipballs on GitHub.
windows用户下载 p2pool_win32_13.4.zip .sig
源码下载tar/zipballs on GitHub.
windows下安装比较容易,可以百度下,有很多教程。

Linux Linux


Using git is preferable, but you can also download tar/zipballs on GitHub.
推荐使用git下载,当然也可以在GitHub上下载tar或zip包。tar/zipballs on GitHub.

sudo apt-get install git # if git is not installedgit clone https://github.com/forrestv/p2pool.gitcd p2poolmake

The following packages are required, and will be automatically installed when you run 'make':
安装p2pool的依赖:需要先安装如下应用,执行上边的命令的'make'会自动下载并安装依赖的应用程序。

  • Python >=2.6
  • Twisted >=10.0.0
  • python-argparse (for Python =2.6)

If for whatever reason you need to install them manually:
你也可以手工一个个安装依赖的应用程序
重点说下linux下的安装:
1:安装python 2.7

wget https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
tar -zxvf Python-2.7.8.tgz
cd Python-2.7.8./configure --prefix=/opt/python2.7 --enable-shared --enable-unicodemake allmake install
修改lib环境变量vi /etc/ld.so.conf.d/python.conf增加:/opt/python2.7/lib生效:ldconfig查看安装的新版本信息 /opt/python2.7/bin/python2 -VPython 2.7.7
2:安装python twisted(依赖zope)
wget https://pypi.python.org/packages/source/z/zope.interface/zope.interface-4.1.1.tar.gz#md5=edcd5f719c5eb2e18894c4d06e29b6c6
安装zope.interface-4.1.1.tar.gztar -zxvf zope.interface-4.1.1.tar.gzcd zope.interface-4.1.1python2.7 setup.py install
wget https://pypi.python.org/packages/source/T/Twisted/Twisted-14.0.0.tar.bz2#md5=9625c094e0a18da77faa4627b98c9815
安装Twisted-14.0.0.tar.bz2export LDFLAGS="-L/opt/python2.7/lib"tar -xvf Twisted-14.0.0.tar.bz2cd Twisted-14.0.0python2.7 setup.py install
3:P2Pool下载安装
wget https://github.com/forrestv/p2pool/archive/13.4.tar.gz
tar -zxvf p2pool-13.4.tar.gz
cd p2pool
make
4:运行p2pool
先在~/.bitcoin/下创建个bitcoin.conf文件
vi ~/.bitcoin/bitcoin.conf
内容如下
server=1rpcuser=bitcoinrpcrpcpassword=bitcoin客户端配置的连接密码(在bitcoin data目录下bitcoin.conf)
python2.7 run_p2pool.py
查看日志是否正常
sudo apt-get install python-twisted python-argparse # should work on Ubuntu

Mac OS X Mac OS X

Using git is preferable, but you can also download tar/zipballs on GitHub.


You can download git for OS X from the official Git site, or install it with Homebrew:
OS X用户可以通过Homebrew安装。

brew install git

Then download and install p2pool:下载并安装p2pool

git clone https://github.com/forrestv/p2pool.gitcd p2poolmake

The following packages are required, and will be automatically installed when you run 'make':

  • Python >=2.6
  • Twisted >=10.0.0
  • python-argparse (for Python =2.6)

Getting started


Setting up a working P2Pool mostly consists of:
配置p2pool包含如下几个部分:

  • Running a Bitcoin node (Bitcoin-Qt or bitcoind).
  • Running P2Pool on the same machine (will fetch blocks data from bitcoind).
  • Running Bitcoin miners (will fetch work from P2Pool).
  • 运行bitcoin节点(Bitcoin-Qt or bitcoind)
  • bitcoind所在的主机上运行p2pool(通过bitcoind取block数据)

1. Setup Bitcoin-Qt or bitcoind

Download and install Bitcoin-Qt or bitcoind. Initial synchronization will likely take more than a day to complete. For this reason, it is generally a good idea to complete this step in advance.


Insert the following text into bitcoin.conf and restart Bitcoin-Qt or bitcoind:
下载并安装Bitcoin-Qt or bitcoind.然后block同步可能需要几天才能完成。因此最好提前安装好bitcoind.

server=1rpcuser=bitcoinrpcrpcpassword=TzYuyH10pJWXnKqXs8ehkX5DQ7jGx0PD1kjaJY7HUtKAKGOaXyN3wVNZGFLLWlR8q8jNYnZVAoB8hCHOCJ1MwSxIzW2tGDhZplct

Example for Windows

Example for Linux

2. Run P2Pool

Download P2Pool and execute run_p2pool.exe (Windows) or 'make run' (Linux/OS X/source).


P2Pool will start downloading the sharechain, displaying sections like this occasionally:
windows下执行run_p2pool.exe  (Linux/OS X/source)下执行'make run' 
P2Pool 然后会开始下载sharechain,运行日志里会不间断打印如下类似信息。

2014-01-09 17:15:45.075550 P2Pool: 0 shares in chain (0 verified/3133 total) Peers: 5 (0 incoming)2014-01-09 17:15:45.075662  Local: 0H/s in last 0.0 seconds Local dead on arrival: ??? Expected time to share: ???

Within a few minutes, it should start showing sections like this (notice the pool hashrate - Pool: 115TH/s - is now shown), indicating that the sharechain has finished downloading. As you can see from the timestamps, here it took about one and a half minutes. It will vary depending on your CPU speed and Internet bandwidth.
几分钟后会打印如下类似信息( Pool: 115TH/s),这表明p2pool已经完成下载sharechain 。从时间戳来看,大概花费了一分半。当然实际情况取决于你的CPU和网络带宽。

2014-01-09 17:16:49.525335 P2Pool: 8698 shares in chain (57 verified/8698 total) Peers: 5 (0 incoming)2014-01-09 17:16:49.525422  Local: 0H/s in last 0.0 seconds Local dead on arrival: ??? Expected time to share: ???2014-01-09 17:16:49.525476  Shares: 0 (0 orphan, 0 dead) Stale rate: ??? Efficiency: ??? Current payout: 0.0000 BTC2014-01-09 17:16:49.525510  Pool: 115TH/s Stale rate: 12.4% Expected time to block: 14.7 hours

3. Run miners


Just point miners to http://HOST:9332/ with HOST being the IP address of the computer running P2Pool. The username can be your payout Bitcoin address or anything that describes the miner if you prefer to mine into your Bitcoin-Qt/bitcoind wallet. Use any password; it is ignored by P2Pool. When mining on the same machine, you can use 127.0.0.1 as the P2Pool host.
将矿机配置连接到http://HOST:9332/,HOST 代表运行P2Pool的主机IP。username 指的是你的bitcoin收款地址,或者类似的钱包信息。password随意填写,P2Pool不检查。如果矿机和p2pool在同一主机上,host可以填写127.0.0.1

ButterflyLabs EasyMiner

bfgminer

cgminer

Avalon

Bitfury / Megabigpower

4. Watch


Unless your miners have Bitcoin addresses as usernames, payouts will go to Bitcoin-Qt/bitcoind's wallet. You can look at P2Pool's web interface, which has statistics and graphs, by going to http://YOUR_P2POOL_HOST:9332/ in a browser - http://127.0.0.1:9332/ if you're looking at this tutorial on the same host that P2Pool is running.
除非你已经设置了usernames为bitcoin收款地址,否则挖矿分成将会打到 Bitcoin-Qt钱包里。你可以通过p2pool提供的web页面查看矿池运行的数据和图表,地址是http://YOUR_P2POOL_HOST:9332/

FAQ

What are the requirements to run P2Pool?

  • A PC with enough memory to run Bitcoin-Qt
  • A good Internet connection with low latency greatly helps to increase efficiency
  • A miner supporting getwork or Stratum interfaces (more than 40GH/s advised)

What are P2Pool's fees?

By default, P2Pool receives 1% to fund P2Pool's development. This fee is optional, but very welcome and useful.

How good are P2Pool payouts?

Payouts should be the same as other pools with a higher variance (payouts are inconsistently smaller or larger days after days). Payouts can even be slightly higher because blocks propagation time is sometime faster on P2Pool. It also happens that people are sending bitcoins to P2Pool miners to encourage miners to support P2Pool.

What are the advantages of using P2Pool?

  • Small statistical advantages increasing income
  • Control over your own pool node
  • No need to trust a pool operator
  • Immediate payments
  • Helps to protect and keep the Bitcoin network decentralized

What are the disadvantages of using P2Pool?

  • Initial setup is a little more complicated
  • More CPU / RAM / Internet bandwidth required
  • Higher payout variance
  • Small transaction fees when spending if you receive many small payouts

Why does P2Pool have so many orphaned / dead / rejected shares?

Miners' payouts are not affected so long as they have a proportional number of rejected shares to other miners. A new share is found every 30 seconds on average with P2Pool's sharechain. This means reorganizations happen more often and miners must have a good network connection in order to receive last shares within a short time.

How to mine with Litecoin?

You should go through the same steps as if you were mining with Bitcoin, except that you should:

  • Install Litecoin instead of Bitcoin.
  • Provide the "--net litecoin" option to run_p2pool.
  • Use port 9327 with your miner.

Useful links

Bitcoin wiki page

Bitcoin forum thread

GitHub page

Pool statistics

Sponsors

Thanks to the Bitcoin Foundation for its generous support of P2Pool.

Thanks to the Litecoin Project for its generous donations to P2Pool.


0 0
原创粉丝点击