[Ethereum] How to do Ethash CPU mine using ethminer

cpuethminermining

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.


Note: Two bounties did not return any answer. I opened an issue under github's ethereum-mining/ethminer hoping it will reach someone. You can follow from https://github.com/ethereum-mining/ethminer/issues/382.

Best Answer

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, please see https://github.com/avatar-lavventura/ethminer.

First, since it will create new DAG do on the home directory: 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 ethminer
./scripts/install_deps.sh

Build:

cmake -H. -Bbuild
cd build/ethminer
make -j $(nproc)

$ pwd   #binary of etherminer is located under /Users/user/ethminer/build/ethminer
/Users/user/ethminer/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:

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

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

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

Helpful comments:

Related Topic