使用服务器空闲的 CPU 资源挖矿
这里介绍一下门罗币的挖矿方法。
门罗币钱包
首先你需要一个钱包用来保存你挖矿所得的币值,这里推荐使用门罗币官方钱包:https://mymonero.com
注册方式非常简单,点击首页的 Create an Account 进入到注册页面,然后将 Private Login Key 妥善保存,并且复制粘贴到下方的输入框中确认。
这个 Private Login Key 非常的重要,相当于你的账号密码,建议电子档纸质档各保存一份。以后登录钱包就是通过这个 Private Login Key 来的。
登录进自己账号,就可以看到自己的钱包地址了,这个地址在接下来配置挖矿程序的时候有用。
选择矿池
我个人试用过的矿池 xmr.nanopool.org
和 coinfoundry.org/pool/xmr
都还行。nanopool 最低需要 0.3 XMR 才能支付,而 coinfoundry 只需要 0.1 XMR,如果你只是要用闲置的服务器运算资源挖矿,建议选择最低支付额较小的矿池,这样能够更频繁的收获。但是我试过一段时间的 coinfoundry,XMR 一直显示为零,所以又换回了 nanopool。还有一点就是因为几乎所有的矿池最低的支付额度至少是 0.1 XMR,也就是说,如果你的算力只有 100~300 H/s,那么很难真正的得到收益,毕竟这样的算力需要维持服务器运行大半年才能达到最低支付额度。
当然其他也有很多的矿池,自己选择咯。
最开始网上找教程的时候,看到有一篇文章推荐 MinerGate 这个站,然后扒了扒 SEO,据说这家会偷部分用户的运算成果,所以进入我的黑名单了。
矿池使用需要,一般矿池的网页上都有 About 、Support 或者 FAQ 之类的页面,点进去看看找到相应的 pool_address,比如 nanopool 的地址:
挖矿程序
我选用的是 xmr-stak 这个开源程序。
手动编译
这里简单讲一下 Ubuntu 16.04 的编译方法,其他系统在这个页面 https://github.com/fireice-uk/xmr-stak/blob/master/doc/compile.md 有详细的说明。
# 安装依赖
sudo apt install libmicrohttpd-dev libssl-dev cmake build-essential libhwloc-dev
git clone https://github.com/fireice-uk/xmr-stak.git
mkdir xmr-stak/build
cd xmr-stak/build
cmake ..
# 如果没有Nvidia或者AMD或者Intel显卡的机器,用下面的命令关掉 CUDA 和 OpenCL 加速支持
# cmake .. -DCUDA_ENABLE=OFF -DOpenCL_ENABLE=OFF
make -j8
# make install
编译完成之后,直接运行 xmr-stak 程序,会有引导环节来帮助你创建配置文件。
- Do you want to use the HTTP interface? // 如果你需要web界面查看挖矿的数据,这里输入一个端口号
- Please enter the currency that you want to mine // monero7
- Pool address: e.g. pool.usxmrpool.com:3333 // 矿池地址,比如 stratum+tcp://xmr.coinfoundry.org:3132
- Username (wallet address or pool login) // 不同矿池的配置有点不一样,比如 coinfoundry 可以
WALLET_ADDRESS.WorkerName
这样的方式来定义,WorkerName 用来定义每一个挖矿程序的名字,如果你有多个服务器多个挖矿程序同时在运行,这样有助于区分 - Password (mostly empty or x) // 为空不用输入
- Rig identifier for pool-side statistics (needs pool support). Can be empty
- Does this pool port support TLS/SSL? Use no if unknown. (y/N) // 有些矿池支持 tls/ssl 有些不支持,具体情况具体来配置
- Do you want to use nicehash on this pool? (y/n) // 是否使用 nicehash
- Do you want to use multiple pools? (y/n) // 是否使用多个矿池
如果出现 MEMORY ALLOC FAILED: mlock failed
这样的错误,可以运行这一条命令解决 sudo sysctl -w vm.nr_hugepages=128
。另外,请使用 root 权限运行程序。
捐助支持 animeloop.org
最近开始尝试跑挖矿程序是因为,近半年来运行 Animeloop 这个网站,租用了一个独立服务器,但是大部分时间 CPU 使用都是处于空闲状态,所以干脆挖点币回点血。
如果你有空闲的 cpu 资源,不妨帮助我一起挖门罗币,用来支持 animeloop.org 网站的运行。
你可以使用 cpulimit 来限制挖矿程序的 cpu 使用率,或者是修改 cpu.txt 配置文件,只用部分 CPU 核心挖矿。比如限制程序只占用大约 50% CPU, cpulimit -l 50 ./bin/xmr-stak
。
修改 pools.txt 文件帮助我们加快挖矿速度:
/*
* pool_address - Pool address should be in the form "pool.supportxmr.com:3333". Only stratum pools are supported.
* wallet_address - Your wallet, or pool login.
* rig_id - Rig identifier for pool-side statistics (needs pool support).
* pool_password - Can be empty in most cases or "x".
* use_nicehash - Limit the nonce to 3 bytes as required by nicehash.
* use_tls - This option will make us connect using Transport Layer Security.
* tls_fingerprint - Server's SHA256 fingerprint. If this string is non-empty then we will check the server's cert against it.
* pool_weight - Pool weight is a number telling the miner how important the pool is. Miner will mine mostly at the pool
* with the highest weight, unless the pool fails. Weight must be an integer larger than 0.
*
* We feature pools up to 1MH/s. For a more complete list see M5M400's pool list at www.moneropools.com
*/
"pool_list" :
[
{"pool_address" : "xmr-us-west1.nanopool.org:14433", "wallet_address" : "49HF9McSSsY3w93VuTgY3TPX8EUCeB8HgAdpvgfqnfiS15VV9jFaBhhBpfDciaFbcdCRBw5S3GjNv8LFP1JCXLF15fUg1zf.<DonationWorker>/shincurryyang@gmail.com", "rig_id" : "", "pool_password" : "", "use_nicehash" : false, "use_tls" : true, "tls_fingerprint" : "", "pool_weight" : 1 },
],
/*
* Currency to mine. Supported values:
*
* aeon7 (use this for Aeon's new PoW)
* bbscoin (automatic switch with block version 3 to cryptonight_v7)
* croat
* edollar
* electroneum
* graft
* haven
* intense
* karbo
* monero7 (use this for Monero's new PoW)
* sumokoin (automatic switch with block version 3 to cryptonight_heavy)
*
* Native algorithms which not depends on any block versions:
*
* # 1MiB scratchpad memory
* cryptonight_lite
* cryptonight_lite_v7
* # 2MiB scratchpad memory
* cryptonight
* cryptonight_v7
* # 4MiB scratchpad memory
* cryptonight_heavy
*/
"currency" : "monero7",
注意修改一下配置文件里的 <DonationWorker>
变量,改为能辨识你身份的名字。