Skip to content
This repository has been archived by the owner on Apr 24, 2022. It is now read-only.

Please, consider re-enabling CPU mining for ethminer. (How to do Ethash CPU mine using ethminer?) #382

Closed
avatar-lavventura opened this issue Nov 14, 2017 · 31 comments

Comments

@avatar-lavventura
Copy link

avatar-lavventura commented Nov 14, 2017

Same issue is on the ethereum.stackoverflow and have some demand for a solution: https://ethereum.stackexchange.com/questions/28062/how-to-do-ethash-cpu-mine-using-ethminer

We have tried to reach on following issue but we couldn't reach anyone related to it: #50 (comment)

Overall: "Please, consider re-enabling CPU mining for ethminer."


I have a Private Ethereum Network. I just want to do Ethash CPU mining using ethminer. I know that to have a smaller foot-print it is recommended to use GPU or openCL but for private networks, I only have few nodes on the network and all are CPU nodes. I just want my CPU node able to mine.

  • For small private networks, I believe mining with CPU nodes, where all nodes are also CPU nodes in the network, will be no problem.

With the current model, if we have a Parity node there is no way for us to mine using a CPU node. And I am not sure why Parity forces users to mine with only GPU node. Since I do not have any GPU machine on my small private network, I am unable to use Parity node to do mining, it forces me to switch to geth node to do mining.

I have followed https://github.com/ethereum/cpp-ethereum .

Install:

git clone --recursive https://github.com/ethereum/cpp-ethereum.git
cd cpp-ethereum

Build:

cmake -H. -Bbuild
cmake --build build

After the build; ethminer used to exist under build folder on older versions git-tag:(untagged-1d50efdb2f43825a1810).

After I build, ethminer does not exist under build. So I was not able to find ethminer binary.

[$]~/cpp-ethereum/build$ ls
_3rdParty            deps     libdevcore     libethereum     libwhisper
CMakeCache.txt       eth      libdevcrypto   libevm          Makefile
CMakeFiles           ethkey   libethash      libp2p          rlp
cmake_install.cmake  ethvm    libethashseal  libweb3jsonrpc  test
CTestTestfile.cmake  include  libethcore     libwebthree     utils

So I have followed https://github.com/ethereum-mining/ethminer to install ethminer.

This line to work for CPU mining: ./ethminer -F http://localhost:8545

The error I am facing with the current/latest ethminer:

./ethminer
  ✘  11:20:06|ethminer  No OpenCL platforms found

[Q] Is there any way to prevent this error and force ethminer to mine on CPU platform? I guess we have find an older ethminer client that accepts -C/CPU flag.

I have also tried: Genoil/cpp-ethereum and it says.

./ethminer
CPU mining is no longer supported in this miner. Use -G (opencl) or -U (cuda) flag to select GPU platform.

Thank you for your valuable time and help.

@avatar-lavventura avatar-lavventura changed the title How to do Ethash CPU mine using ethminer? Please, consider re-enabling CPU mining for ethminer. Nov 14, 2017
@avatar-lavventura avatar-lavventura changed the title Please, consider re-enabling CPU mining for ethminer. Please, consider re-enabling CPU mining for ethminer. (How to do Ethash CPU mine using ethminer?) Nov 14, 2017
@MariusVanDerWijden
Copy link
Collaborator

Have you considered using geth? The go implementation has CPU-mining built in

@avatar-lavventura
Copy link
Author

geth does not have warp sync and a GUI like Parity. I guess only solution is to use both based on my needs :(@MariusVanDerWijden

@MariusVanDerWijden
Copy link
Collaborator

MariusVanDerWijden commented Nov 25, 2017

Ah ok, yes I can see your problem...
If you don't really care about performance you can look into https://github.com/sgminer-dev/sgminer afaik they have a CPU-Mining version. But I don't know whether they support warp sync, but its compatible with parity

Oh i missread Sgminer is only for scrypt-based cryptocurrencies

@avatar-lavventura
Copy link
Author

avatar-lavventura commented Nov 25, 2017

Another solution would be: I can use geth for mining and use parity whenever I won't do any mining. It might be inefficient that will require to store same blockchain for parity and geth nodes.

I wish ethminer allow CPU mining for private networks, I really don't know why they removed it.

@5chdn
Copy link

5chdn commented Nov 27, 2017

Parity never had this feature.

@avatar-lavventura
Copy link
Author

Which feature? @5chdn . The problem is on the ethminer side right?

@bmatthewshea
Copy link
Contributor

bmatthewshea commented Dec 4, 2017

Have you considered a different coin/hash?
Maybe CryptoNight/Note? Your CPU would actually count for (a little) something still. Is a waste of your time on ethash as previously mentioned in feature requests here..

@5chdn
Copy link

5chdn commented Dec 4, 2017

This is about mining private chains or testnets.

@avatar-lavventura
Copy link
Author

As @5chdn mention this issue was about mining private chains or testnets, that may have a small network only having few miners, which are CPU-node. @bmatthewshea

@bmatthewshea
Copy link
Contributor

bmatthewshea commented Dec 4, 2017

Same point. Better off with a different hash/algo. But, if you can find an ethash that uses CPU - good luck.

@5chdn
Copy link

5chdn commented Dec 6, 2017

The way to go for new networks if obviously Proof-of-Authority. But this is about existing networks. 🙄

@5chdn
Copy link

5chdn commented Feb 4, 2018

Is this a wont-fix?

@MariusVanDerWijden
Copy link
Collaborator

no, this was never a feature, and it seems it won't be one in the future

@5chdn
Copy link

5chdn commented Feb 5, 2018

I remember mining with ethminer on CPU several years ago, so it used to be a feature. I was surprised when I found out it was removed :)

@avatar-lavventura
Copy link
Author

avatar-lavventura commented Feb 5, 2018

There was a future and I used it, please double check the features that were implemented before. @MariusVanDerWijden

Please see following guide (https://ethereum.stackexchange.com/a/33722/4575):
Please note the the github code I am sharing is forked from https://github.com/ethereum/cpp-ethereum and Version 1.3.0 of etherminer that actually can do CPU mining, which is implemented around 1 year ago. I did some small changes to build the project.

First, since it will create new DAG do on the home directory: cd && rm -rf .ethash/

Dependencies:

Linux-based:

sudo apt-get install libleveldb-dev libcurl4-openssl-dev libmicrohttpd-dev libudev-dev cmake

macOS:

brew install leveldb libmicrohttpd

Install:

git clone --depth=1 https://github.com/avatar-lavventura/ethminer.git 
cd cpp-ethereum
./scripts/install_deps.sh

Build:

cmake -H. -Bbuild
cd build/ethminer
make

$ pwd   #binary of etherminer is located under /Users/user/cpp-ethereum/build/ethminer
/Users/user/cpp-ethereum/build/ethminer   
$./ethminer --version
ethminer version 1.3.0 | Build: ETH_BUILD_PLATFORM/ETH_BUILD_TYPE

To Mine with your private Ethereum-chain:

Please note that geth or Parity should work on the background as connected to your private ethereum network.

This line will use full horse power:

sudo ./ethminer -F http://localhost:8545

-t, --mining-threads Limit number of CPU/GPU miners to n (default: use everything available on selected platform)

[~/cpp-ethereum]$ cd build/ethminer
[~/cpp-ethereum/build/ethminer]$ sudo ./ethminer -F http://localhost:8545 --mining-threads 2

@bmatthewshea
Copy link
Contributor

bmatthewshea commented Feb 5, 2018

Why not just use geth since it appears you already have it running on http://localhost:8545 ?
https://github.com/ethereum/go-ethereum/wiki/Mining
Or maybe you already are?

@5chdn
Copy link

5chdn commented Feb 6, 2018

@bmatthewshea we are moving in circles here. please, scroll up :)

@bmatthewshea
Copy link
Contributor

bmatthewshea commented Feb 6, 2018

@5chdn
My apologies ( I see..^^ ) - swear I searched entire thread for 'geth'/etc last night and didn't see it. lol

@coreyog
Copy link

coreyog commented Feb 8, 2018

I would also appreciate this as I'm working with a private network and a stratum pool. It doesn't seem geth works with stratum so using it is not an option.

@Whisperd130
Copy link

How to init the private chain with this solution? I have create that by "eth --private "customChain" --genesis-json genesis.json --db-path data" this command.
And I got ethconsole, but it shows Current block number is 0, protocols shows null.
I think the private chain would need to init, but I do not know how.

@rodneymo
Copy link

@avatar-lavventura, I was looking for a CPU-based miner - to use with private chains - and found yours. Thanks, great job. One question though, if you fork does not include stratum support, right?

@avatar-lavventura
Copy link
Author

avatar-lavventura commented Sep 10, 2018

@rodneymo : Unfortunetly Parity does not support CPU mining any more. I have forked their CPU supporting code almost a year ago, I am not sure does it support for stratum.

I am using private chain as well, but I completely switch to geth. I highly encourage you to use geth if you setup a POW chain, which supports CPU mining.

If you do not want to deal with CPU-mining, you can freely use my on going Proof-of-Authorithy chain please see (https://github.com/ebloc/eblocPOA) for the setup.

@rodneymo
Copy link

rodneymo commented Sep 10, 2018

@avatar-lavventura , thanks! Geth won't work for me as I am doing pool development and need a miner to talk to the pool via stratum. Probably need to find an older version of ethminer that has both CPU and stratum enabled.

@avatar-lavventura
Copy link
Author

Have a look to one I have shared. Hope it has a support for stratum.

@rodneymo
Copy link

Where did you share it?

@avatar-lavventura
Copy link
Author

avatar-lavventura commented Sep 10, 2018

Check out my following command: #382 (comment)

Repository:

git clone --depth=1 https://github.com/avatar-lavventura/ethminer.git

@rodneymo
Copy link

rodneymo commented Sep 10, 2018

I am currently using that one ;-)
It works great but only supports http (-F). There's no stratum support in it.

@rodneymo
Copy link

I found a stratum proxy, which together with your ethminer fork, solved my issue. I leave the link here in case others have similar needs: https://github.com/Atrides/eth-proxy

@avatar-lavventura
Copy link
Author

@rodneymo: Great! I'm glad I could help.

@soc1c
Copy link

soc1c commented Jun 15, 2019

I keep coming back here every year it seems. Is this still considered a won't-fix? 😞

@avatar-lavventura your fork no longer compiles on Arch Linux :(

~/.opt/ethminer/build/ethminer master*
❯ make -j $(nproc)
Scanning dependencies of target scrypt
Scanning dependencies of target cryptopp
Scanning dependencies of target secp256k1
Scanning dependencies of target boost
[  0%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/b64.c.o
[  0%] Creating directories for 'secp256k1'
[  0%] Creating directories for 'cryptopp'
[  0%] Creating directories for 'boost'
[  1%] Performing download step (download, verify and extract) for 'cryptopp'
[  1%] Performing download step (download, verify and extract) for 'secp256k1'
[  3%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto-mcf.c.o
[  4%] Performing download step (download, verify and extract) for 'boost'
-- Downloading...
   dst='/home/user/.opt/ethminer/deps/src/secp256k1-ac8ccf29.tar.gz'
   timeout='none'
-- Using src='https://github.com/chfast/secp256k1/archive/ac8ccf29b8c6b2b793bc734661ce43d1f952977a.tar.gz'
-- Downloading...
   dst='/home/user/.opt/ethminer/deps/src/cryptopp_bccc6443.tar.gz'
   timeout='none'
-- Using src='https://github.com/weidai11/cryptopp/archive/bccc6443c4d4d611066c2de4c17109380cf97704.tar.gz'
-- Downloading...
   dst='/home/user/.opt/ethminer/deps/src/boost_1_63_0.tar.gz'
   timeout='none'
-- Using src='https://github.com/ethereum/cpp-dependencies/releases/download/cache/boost_1_63_0.tar.gz'
[  4%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto-scrypt-saltgen.c.o
[  6%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto_scrypt-check.c.o
[  6%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto_scrypt-hash.c.o
[  6%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto_scrypt-hexconvert.c.o
[  8%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/crypto_scrypt-nosse.c.o
[  8%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/sha256.c.o
[  8%] Building C object utils/libscrypt/CMakeFiles/scrypt.dir/slowequals.c.o
-- verifying file...
       file='/home/user/.opt/ethminer/deps/src/secp256k1-ac8ccf29.tar.gz'
-- Downloading... done
[  9%] Linking C static library libscrypt.a
-- extracting...
     src='/home/user/.opt/ethminer/deps/src/secp256k1-ac8ccf29.tar.gz'
     dst='/home/user/.opt/ethminer/deps/src/secp256k1'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[  9%] Performing patch step for 'secp256k1'
[ 11%] No update step for 'secp256k1'
[ 11%] Performing configure step for 'secp256k1'
[ 11%] Built target scrypt
Scanning dependencies of target jsoncpp
[ 13%] Creating directories for 'jsoncpp'
[ 13%] Performing download step (download, verify and extract) for 'jsoncpp'
-- Downloading...
   dst='/home/user/.opt/ethminer/deps/src/jsoncpp-1.7.7.tar.gz'
   timeout='none'
-- Using src='https://github.com/open-source-parsers/jsoncpp/archive/1.7.7.tar.gz'
-- secp256k1 configure command succeeded.  See also /home/user/.opt/ethminer/deps/src/secp256k1-stamp/secp256k1-configure-*.log
[ 14%] No build step for 'secp256k1'
[ 16%] Performing install step for 'secp256k1'
-- verifying file...
       file='/home/user/.opt/ethminer/deps/src/jsoncpp-1.7.7.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/user/.opt/ethminer/deps/src/jsoncpp-1.7.7.tar.gz'
     dst='/home/user/.opt/ethminer/deps/src/jsoncpp'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 18%] No patch step for 'jsoncpp'
[ 18%] No update step for 'jsoncpp'
[ 18%] Performing configure step for 'jsoncpp'
-- secp256k1 install command succeeded.  See also /home/user/.opt/ethminer/deps/src/secp256k1-stamp/secp256k1-install-*.log
[ 18%] Completed 'secp256k1'
[ 18%] Built target secp256k1
Scanning dependencies of target BuildInfo.h
[ 18%] Built target BuildInfo.h
Scanning dependencies of target ethash
[ 18%] Building C object libethash/CMakeFiles/ethash.dir/io.c.o
[ 19%] Building C object libethash/CMakeFiles/ethash.dir/internal.c.o
/home/user/.opt/ethminer/libethash/internal.c: In function ‘ethash_full_new_internal’:
/home/user/.opt/ethminer/libethash/internal.c:472:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
   if (ethash_io_prepare(dirname, seed_hash, &f, (size_t)full_size, true) != ETHASH_IO_MEMO_MISMATCH) {
      ^
/home/user/.opt/ethminer/libethash/internal.c:477:2: note: here
  case ETHASH_IO_MEMO_MISMATCH:
  ^~~~
-- jsoncpp configure command succeeded.  See also /home/user/.opt/ethminer/deps/src/jsoncpp-stamp/jsoncpp-configure-*.log
[ 19%] No build step for 'jsoncpp'
[ 19%] Performing install step for 'jsoncpp'
cc1: all warnings being treated as errors
make[2]: *** [libethash/CMakeFiles/ethash.dir/build.make:76: libethash/CMakeFiles/ethash.dir/internal.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:500: libethash/CMakeFiles/ethash.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
-- verifying file...
       file='/home/user/.opt/ethminer/deps/src/cryptopp_bccc6443.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/user/.opt/ethminer/deps/src/cryptopp_bccc6443.tar.gz'
     dst='/home/user/.opt/ethminer/deps/src/cryptopp'
-- extracting... [tar xfz]
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 19%] Performing patch step for 'cryptopp'
[ 19%] No update step for 'cryptopp'
[ 21%] Performing configure step for 'cryptopp'
-- jsoncpp install command succeeded.  See also /home/user/.opt/ethminer/deps/src/jsoncpp-stamp/jsoncpp-install-*.log
[ 22%] Completed 'jsoncpp'
[ 22%] Built target jsoncpp
-- cryptopp configure command succeeded.  See also /home/user/.opt/ethminer/deps/src/cryptopp-stamp/cryptopp-configure-*.log
[ 22%] Performing build step for 'cryptopp'
make[3]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
Scanning dependencies of target cryptopp-object
[  2%] Building CXX object CMakeFiles/cryptopp-object.dir/cryptlib.cpp.o
[  5%] Building CXX object CMakeFiles/cryptopp-object.dir/cpu.cpp.o
[  7%] Building CXX object CMakeFiles/cryptopp-object.dir/integer.cpp.o
[ 10%] Building CXX object CMakeFiles/cryptopp-object.dir/algebra.cpp.o
[ 13%] Building CXX object CMakeFiles/cryptopp-object.dir/algparam.cpp.o
[ 15%] Building CXX object CMakeFiles/cryptopp-object.dir/asn.cpp.o
[ 18%] Building CXX object CMakeFiles/cryptopp-object.dir/basecode.cpp.o
[ 21%] Building CXX object CMakeFiles/cryptopp-object.dir/dll.cpp.o
[ 23%] Building CXX object CMakeFiles/cryptopp-object.dir/dsa.cpp.o
-- verifying file...
       file='/home/user/.opt/ethminer/deps/src/boost_1_63_0.tar.gz'
-- Downloading... done
-- extracting...
     src='/home/user/.opt/ethminer/deps/src/boost_1_63_0.tar.gz'
     dst='/home/user/.opt/ethminer/deps/src/boost'
-- extracting... [tar xfz]
[ 26%] Building CXX object CMakeFiles/cryptopp-object.dir/ec2n.cpp.o
[ 28%] Building CXX object CMakeFiles/cryptopp-object.dir/eccrypto.cpp.o
[ 31%] Building CXX object CMakeFiles/cryptopp-object.dir/ecp.cpp.o
-- extracting... [analysis]
-- extracting... [rename]
-- extracting... [clean up]
-- extracting... done
[ 22%] No patch step for 'boost'
[ 22%] No update step for 'boost'
[ 24%] Performing configure step for 'boost'
[ 34%] Building CXX object CMakeFiles/cryptopp-object.dir/eprecomp.cpp.o
[ 36%] Building CXX object CMakeFiles/cryptopp-object.dir/filters.cpp.o
[ 39%] Building CXX object CMakeFiles/cryptopp-object.dir/fips140.cpp.o
[ 42%] Building CXX object CMakeFiles/cryptopp-object.dir/gf2n.cpp.o
[ 44%] Building CXX object CMakeFiles/cryptopp-object.dir/gfpcrypt.cpp.o
-- boost configure command succeeded.  See also /home/user/.opt/ethminer/deps/src/boost-stamp/boost-configure-*.log
[ 24%] Performing build step for 'boost'
[ 47%] Building CXX object CMakeFiles/cryptopp-object.dir/hex.cpp.o
[ 50%] Building CXX object CMakeFiles/cryptopp-object.dir/hmac.cpp.o
[ 52%] Building CXX object CMakeFiles/cryptopp-object.dir/hrtimer.cpp.o
[ 55%] Building CXX object CMakeFiles/cryptopp-object.dir/iterhash.cpp.o
[ 57%] Building CXX object CMakeFiles/cryptopp-object.dir/keccak.cpp.o
[ 60%] Building CXX object CMakeFiles/cryptopp-object.dir/misc.cpp.o
[ 63%] Building CXX object CMakeFiles/cryptopp-object.dir/modes.cpp.o
[ 65%] Building CXX object CMakeFiles/cryptopp-object.dir/mqueue.cpp.o
[ 68%] Building CXX object CMakeFiles/cryptopp-object.dir/nbtheory.cpp.o
[ 71%] Building CXX object CMakeFiles/cryptopp-object.dir/oaep.cpp.o
[ 73%] Building CXX object CMakeFiles/cryptopp-object.dir/osrng.cpp.o
[ 76%] Building CXX object CMakeFiles/cryptopp-object.dir/polynomi.cpp.o
[ 78%] Building CXX object CMakeFiles/cryptopp-object.dir/pubkey.cpp.o
[ 81%] Building CXX object CMakeFiles/cryptopp-object.dir/queue.cpp.o
[ 84%] Building CXX object CMakeFiles/cryptopp-object.dir/randpool.cpp.o
[ 86%] Building CXX object CMakeFiles/cryptopp-object.dir/rdtables.cpp.o
[ 89%] Building CXX object CMakeFiles/cryptopp-object.dir/rijndael.cpp.o
[ 92%] Building CXX object CMakeFiles/cryptopp-object.dir/rng.cpp.o
[ 94%] Building CXX object CMakeFiles/cryptopp-object.dir/sha.cpp.o
[ 97%] Building CXX object CMakeFiles/cryptopp-object.dir/strciphr.cpp.o
[ 97%] Built target cryptopp-object
Scanning dependencies of target cryptopp-static
[100%] Linking CXX static library libcryptopp.a
[100%] Built target cryptopp-static
[ 24%] Performing install step for 'cryptopp'
-- cryptopp install command succeeded.  See also /home/user/.opt/ethminer/deps/src/cryptopp-stamp/cryptopp-install-*.log
[ 26%] Completed 'cryptopp'
[ 26%] Built target cryptopp
-- boost build command succeeded.  See also /home/user/.opt/ethminer/deps/src/boost-stamp/boost-build-*.log
[ 26%] No install step for 'boost'
[ 27%] Completed 'boost'
[ 27%] Built target boost
make: *** [Makefile:141: all] Error 2

@Spudz76
Copy link

Spudz76 commented Jun 20, 2019

I want to mine on my Sega Dreamcast.</sarcasm>

Whats the point though?
Sub-10Mh/s devices seem deprecated and not worth any development time (GTX970 does 9Mh at same as GTX1060 watts, which does 23Mh - why bother with any Kepler at that point? watt-hash ratio is 2x or more on the newer same price Pascal card).
Also why blow watts into an unpaid chain?
Also why run devices with horrible watt-per-hash, even if they were still supported?

I guess with some answers to those problems the importance of supporting pointless-on-the-mainchain devices could be reprioritized.

Or do a bounty for it. There is no donation income from private chains or testnets either, so I doubt anyone but those who might benefit from (or even use) the feature maintaining any code for the feature...

Otherwise a feature that maybe 5 users want, out of some many thousands of 'normal' users, is not going to happen, for sure. That's like the definition of "wontfix"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants