 ([image source](https://www.pexels.com/photo/pen-technology-computer-pc-40879/)) The vanilla steemd (built as described [here](https://steemit.com/steem-help/@letc/building-steem-with-gcc-6-1-on-fedora-24)) mines at 8646 hps* on my humble double core Pentium. Let's see what can be improved, starting from the simplest things. First, recompile steemd with `-march=native` to enable optimizations specific to your CPUs architecture (Intel Haswell in my case): $ cmake \ -DCMAKE_C_FLAGS="-march=native" -DCMAKE_CXX_FLAGS="-march=native" \ -DBOOST_ROOT="$HOME/opt/boost-1.60.0" \ -DENABLE_CONTENT_PATCHING=OFF -DLOW_MEMORY_NODE=ON \ -DCMAKE_BUILD_TYPE=Release . (I described the building process in [this post](https://steemit.com/steem-help/@letc/building-steem-with-gcc-6-1-on-fedora-24), just replace the cmake command used there with the variant above) Hash rate is now 8738 hps (+1%). YMMV depending on the CPU architecture and compiler version. The next thing to do is to enable GMP. Install [GMP](https://gmplib.org/) and apply [this simple patch](https://ipfs.io/ipfs/QmSv8VL2y3f6umhnqoFbs8NRhVJqj4efE596Z6PqqkPKvR/steem-gmp.patch): $ curl https://ipfs.io/ipfs/QmVA3QACfkH33bjhTqD5268hHV7kWQSroYFGgJDxzGAXBR |\ patch -p1 You may need to fix the path to libgmp.a in `libraries/fc/CMakeLists.txt` After recompiling with GMP, I got 9301 hps (+8% to the initial rate). Now we'll try something more interesting. The EC cryptography functions used in POW algorithm are implemented in the secp256k1 library that is bundled with Steem. Naturally, this implementation puts security before performance, so there is a lot of overhead added due to measures taken to protect secret key (namely, constant-time calculations and excessive memory cleaning). There is a [fast unsafe variant](https://github.com/llamasoft/secp256k1_fast_unsafe) of the library, but it is not directly compatible with the version used in Steem. So I ported back the changes from the fast unsafe version. Here is [the patch](https://ipfs.io/ipfs/QmSv8VL2y3f6umhnqoFbs8NRhVJqj4efE596Z6PqqkPKvR/steem-fast-unsafe.patch), **use it at your own risk**. You can apply it with the following command: $ curl https://ipfs.io/ipfs/QmZMy6kD2rG9Fyw6sax461qu4fK811CynYECrjsyMfzXxV |\ patch -p1 Hash rate is now 13884 (+61% to the initial rate)! Note that this patch is most efficient when GMP is enabled. Ideally, we would need two different ECC implementations — a fast unsafe one for mining (since the POW algorithm does not use the accounts active key after HF13, key security is irrelevant there) and a secure one for signing transactions. But the patch above modifies the common ECC implementation used in Steem. **Again: use it at your own risk!** Probably, it would be possible to improve the hash rate even more by creating a different separate miner-specific ECC implementation that disregards security and generality to achieve the maximum performance. BTW, that's what GPU miners probably have, so running on GPU per se is not their only advantage. CPU miners might still have a chance to compete. I'm not hoping to profit from mining with the humble hardware I have, I was just curious to experiment. The only mining reward I can hope for is the reward for my posts about mining, so I'm sharing the patches. (*) Hash rates are average of top 5 measurements (I exclude lower measurements that are likely influenced by other processes running on my PC) taken while mining for about 1 minute.
author | letc |
---|---|
permlink | steem-mining-how-to-increase-hash-rate-by-60-patches-included |
category | mining |
json_metadata | {"tags":["mining","steem","steemit"],"image":["https://ipfs.io/ipfs/Qmbru6b6okFwQLgbAVLeu3atkQQUJorcfnQyySffy8cg7F"],"links":["https://www.pexels.com/photo/pen-technology-computer-pc-40879/","https://steemit.com/steem-help/@letc/building-steem-with-gcc-6-1-on-fedora-24","https://gmplib.org/","https://ipfs.io/ipfs/QmSv8VL2y3f6umhnqoFbs8NRhVJqj4efE596Z6PqqkPKvR/steem-gmp.patch","https://github.com/llamasoft/secp256k1_fast_unsafe","https://ipfs.io/ipfs/QmSv8VL2y3f6umhnqoFbs8NRhVJqj4efE596Z6PqqkPKvR/steem-fast-unsafe.patch"]} |
created | 2016-08-31 18:16:54 |
last_update | 2016-08-31 22:57:36 |
depth | 0 |
children | 3 |
last_payout | 2016-10-01 19:12:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 2.134 HBD |
curator_payout_value | 0.033 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 3,614 |
author_reputation | 4,908,604,636,880 |
root_title | "Steem mining: how to increase hash rate by 60% (patches included)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 1,074,043 |
net_rshares | 5,779,789,610,497 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
abit | 0 | 5,347,720,974,927 | 80% | ||
theoretical | 0 | 298,765,780,324 | 100% | ||
boy | 0 | 3,100,500,565 | 100% | ||
bue-witness | 0 | 3,764,152,760 | 100% | ||
bunny | 0 | 690,495,538 | 100% | ||
bue | 0 | 54,228,051,517 | 100% | ||
mini | 0 | 1,661,570,177 | 100% | ||
moon | 0 | 213,702,396 | 100% | ||
healthcare | 0 | 622,921,236 | 100% | ||
daniel.pan | 0 | 967,525,073 | 100% | ||
helen.tan | 0 | 288,200,426 | 100% | ||
cryptohead | 0 | 2,771,996,934 | 100% | ||
alenevaa | 0 | 2,319,917,000 | 100% | ||
murh | 0 | 1,419,076,415 | 33.01% | ||
djm34 | 0 | 506,922,025 | 0% | ||
arcange | 0 | 2,034,607,886 | 100% | ||
all-of-us | 0 | 13,737,439,547 | 100% | ||
remlaps | 0 | 1,551,949,046 | 100% | ||
letc | 0 | 1,031,420,029 | 100% | ||
kalimor | 0 | 2,352,599,306 | 100% | ||
sillygoon | 0 | 238,353,830 | 100% | ||
ottodv | 0 | 8,701,394,532 | 100% | ||
mrosenquist | 0 | 27,918,903,194 | 100% | ||
grm | 0 | 1,689,296,525 | 100% | ||
ola1 | 0 | 107,171,970 | 100% | ||
kolin.evans | 0 | 1,384,687,319 | 100% |
Nice post. I will try it. Thanks for sharing !
author | arcange |
---|---|
permlink | re-letc-steem-mining-how-to-increase-hash-rate-by-60-patches-included-20160831t215842942z |
category | mining |
json_metadata | {"tags":["mining"]} |
created | 2016-08-31 21:58:42 |
last_update | 2016-08-31 21:58:42 |
depth | 1 |
children | 0 |
last_payout | 2016-10-01 19:12:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 46 |
author_reputation | 1,146,633,779,972,293 |
root_title | "Steem mining: how to increase hash rate by 60% (patches included)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 1,076,814 |
net_rshares | 0 |
Thanks for the valuable tips!
author | cryptohead |
---|---|
permlink | re-letc-steem-mining-how-to-increase-hash-rate-by-60-patches-included-20160901t055230549z |
category | mining |
json_metadata | {"tags":["mining"]} |
created | 2016-09-01 05:52:33 |
last_update | 2016-09-01 05:52:33 |
depth | 1 |
children | 0 |
last_payout | 2016-10-01 19:12:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 29 |
author_reputation | 607,929,583,052 |
root_title | "Steem mining: how to increase hash rate by 60% (patches included)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 1,080,849 |
net_rshares | 0 |
Nicely done optimizations. I like the fact you explained the dangers of the insecure variant. Informs the readers and gives them a good choice. Well done!
author | mrosenquist |
---|---|
permlink | re-letc-steem-mining-how-to-increase-hash-rate-by-60-patches-included-20160831t190719723z |
category | mining |
json_metadata | {"tags":["mining"]} |
created | 2016-08-31 19:07:24 |
last_update | 2016-08-31 19:07:24 |
depth | 1 |
children | 0 |
last_payout | 2016-10-01 19:12:27 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 157 |
author_reputation | 178,495,942,506,925 |
root_title | "Steem mining: how to increase hash rate by 60% (patches included)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 1,074,756 |
net_rshares | 1,551,949,046 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
remlaps | 0 | 1,551,949,046 | 100% |