Stellar Lumens (XLM) Forum with for newcomers and contributor's rewarded Check here




"INFO -  Mining
  • 17 Vote(s) - 2.53 Average
  • 1
  • 2
  • 3
  • 4
  • 5

#1

[/url]CPU Mining with Geth
At Frontier, the first release of Ethereum, you'll just need a) a GPU and b) an Ethereum client, Geth. CPU mining will be possible but too inefficient to hold any value.
At the moment, Geth only includes a CPU miner, and the team is testing a 
GPU miner branch, but this won't be part of Frontier.
The C++ implementation of Ethereum also offers a GPU miner, both as part of Eth (its CLI), AlethZero (its GUI) and EthMiner (the standalone miner).
NOTE: Ensure your blockchain is fully synchronised with the main chain before starting to mine, otherwise you will not be mining on the main chain.
When you start up your ethereum node with 

[code]geth[/code]
[size=undefined]
 it is not mining by default. To start it in mining mode, you use the [/size]

[code]--mine[/code]
[size=undefined]
 command line option. The [/size]

[code]-minerthreads[/code]
[size=undefined]
 parameter can be used to set the number parallel mining threads (defaulting to the total number of processor cores).[/size]

[code]geth --mine --minerthreads=4[/code]
[size=undefined]
You can also start and stop CPU mining at runtime using the console. [/size]

[code]miner.start[/code]
[size=undefined]
 takes an optional parameter for the number of miner threads.[/size]

[code]> miner.start(8)
true
> miner.stop()
true
[/code]
[size=undefined]
Note that mining for real ether only makes sense if you are in sync with the network (since you mine on top of the consensus block). Therefore the eth blockchain downloader/synchroniser will delay mining until syncing is complete, and after that mining automatically starts unless you cancel your intention with [/size]

[code]miner.stop()[/code]
[size=undefined]
.
In order to earn ether you must have your etherbase (or coinbase) address set. This etherbase defaults to your primary account. If you don't have an etherbase address, then [/size]

[code]geth --mine[/code]
[size=undefined]
 will not start up.
You can set your etherbase on the command line:[/size]

[code]geth --etherbase 1 --mine  2>> geth.log // 1 is index: second account by creation order OR
geth --etherbase '0xa4d8e9cae4d04b093aac82e6cd355b6b963fb7ff' --mine 2>> geth.log
[/code]
[size=undefined]
You can reset your etherbase on the console too:[/size]

[code]miner.setEtherbase(eth.accounts[2])
[/code]
[size=undefined]
Note that your etherbase does not need to be an address of a local account, just an existing one.
There is an option to add extra Data (32 bytes only) to your mined blocks. By convention this is interpreted as a unicode string, so you can set your short vanity tag.[/size]

[code]miner.setExtra("ΞTHΞЯSPHΞЯΞ")
...
debug.printBlock(131805)
BLOCK(be465b020fdbedc4063756f0912b5a89bbb4735bd1d1df84363e05ade0195cb1): Size: 531.00 B TD: 643485290485 {
NoNonce: ee48752c3a0bfe3d85339451a5f3f411c21c8170353e450985e1faab0a9ac4cc
Header:
[
...
       Coinbase:           a4d8e9cae4d04b093aac82e6cd355b6b963fb7ff
       Number:             131805
       Extra:              ΞTHΞЯSPHΞЯΞ
...
}
[/code]
[size=undefined]
See also this proposal
You can check your hashrate with miner.hashrate, the result is in H/s (Hash operations per second).[/size]

[code]> miner.hashrate
712000
[/code]
[size=undefined]
After you successfully mined some blocks, you can check the ether balance of your etherbase account. Now assuming your etherbase is a local account:[/size]

[code]> eth.getBalance(eth.coinbase).toNumber();
'34698870000000'
[/code]
[size=undefined]
In order to spend your earnings you will need to have this account unlocked.[/size]

[code]> personal.unlockAccount(eth.coinbase)
Password
true
[/code]
[size=undefined]
You can check which blocks are mined by a particular miner (address) with the following code snippet on the console:[/size]

[code]function minedBlocks(lastn, addr) {
 addrs = [];
 if (!addr) {
   addr = eth.coinbase
 }
 limit = eth.blockNumber - lastn
 for (i = eth.blockNumber; i >= limit; i--) {
   if (eth.getBlock(i).miner == addr) {
     addrs.push(i)
   }
 }
 return addrs
}
// scans the last 1000 blocks and returns the blocknumbers of blocks mined by your coinbase
// (more precisely blocks the mining reward for which is sent to your coinbase).  
minedBlocks(1000, eth.coinbase);
//[352708, 352655, 352559]
[/code]
[size=undefined]
Note that it will happen often that you find a block yet it never makes it to the canonical chain. This means when you locally include your mined block, the current state will show the mining reward credited to your account, however, after a while, the better chain is discovered and we switch to a chain in which your block is not included and therefore no mining reward is credited. Therefore it is quite possible that as a miner monitoring their coinbase balance will find that it may fluctuate quite a bit.
The logs show locally mined blocks confirmed after 5 blocks. At the moment you may find it easier and faster to generate the list of your mined blocks from these logs.
Mining success depends on the set block difficulty. Block difficulty dynamically adjusts each block in order to regulate the network hashing power to produce a 12 second blocktime. Your chances of finding a block therefore follows from your hashrate relative to difficulty. The time you need to wait you are expected to find a block can be estimated with the following code:
INCORRECT...CHECKING[/size]

[code]etm = eth.getBlock("latest").difficulty/miner.hashrate; // estimated time in seconds
Math.floor(etm / 3600.) + "h " + Math.floor((etm % 3600)/60) + "m " +  Math.floor(etm % 60) + "s";
// 1h 3m 30s
[/code]
[size=undefined]
Given a difficulty of 3 billion, a typical CPU with 800KH/s is expected to find a block every ....?
GPU mining[/size]


[size=undefined]
Hardware
The algorithm is memory hard and in order to fit the DAG into memory, it needs 1-2GB of RAM on each GPU. If you get [/size]

[code]Error GPU mining. GPU memory fragmentation?[/code]
[size=undefined]
 you havent got enough memory.
The GPU miner is implemented in OpenCL, so AMD GPUs will be 'faster' than same-category NVIDIA GPUs.
ASICs and FPGAs are relatively inefficient and therefore discouraged.
To get openCL for your chipset and platform, try:[/size]
[size=undefined]
On Ubuntu
AMD[/size]
[size=undefined]
download: [/size]

[code]ADL_SDK8.zip[/code]
[size=undefined]
 and [/size]

[code]AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh[/code]

[code]./AMD-APP-SDK-v2.9-1.599.381-GA-linux64.sh
ln -s /opt/AMDAPPSDK-2.9-1 /opt/AMDAPP
ln -s /opt/AMDAPP/include/CL /usr/include
ln -s /opt/AMDAPP/lib/x86_64/* /usr/lib/
ldconfig
reboot
[/code]

[code]apt-get install fglrx-updates
// wget, tar, opencl
sudo aticonfig --adapter=all --initial
sudo aticonfig --list-adapters
* 0. 01:00.0 AMD Radeon R9 200 Series

* - Default adapter
[/code]
[size=undefined]
Nvidia
The following instructions are, for the most part, relevant to any system with Ubuntu 14.04 and a Nvidia GPU. Setting up an EC2 instance for mining
On MacOSx[/size]

[code]wget http://developer.download.nvidia.com/com...29_mac.pkg
sudo installer -pkg ~/Desktop/cuda_7.0.29_mac.pkg -target /
brew update
brew tap ethereum/ethereum
brew reinstall cpp-ethereum --with-gpu-mining --devel --headless --build-from-source
[/code]
[size=undefined]
You check your cooling status:[/size]

[code]aticonfig --adapter=0 --od-gettemperature
[/code]
[size=undefined]
Mining Software
The official Frontier release of [/size]

[code]geth[/code]
[size=undefined]
 only supports a CPU miner natively. We are working on a GPU miner, but it may not be available for the Frontier release. Geth however can be used in conjunction with [/size]

[code]ethminer[/code]
[size=undefined]
, using the standalone miner as workers and [/size]

[code]geth[/code]
[size=undefined]
 as scheduler communicating via JSON-RPC.
The C++ implementation of Ethereum (not officially released) however has a GPU miner. It can be used from [/size]

[code]eth[/code]
[size=undefined]
, [/size]

[code]AlethZero[/code]
[size=undefined]
 (GUI) and [/size]

[code]ethMiner[/code]
[size=undefined]
 (the standalone miner).
You can install this via ppa on linux, brew tap on MacOS or from source.
On MacOS:[/size]

[code]brew install cpp-ethereum --with-gpu-mining --devel --build-from-source
[/code]
[size=undefined]
On Linux:[/size]

[code]apt-get install cpp-ethereum
[/code]
[size=undefined]
On Windows: https://github.com/ethereum/cpp-ethereum/wiki/Building-on-Windows
GPU mining with ethminer
To mine with [/size]

[code]eth[/code]
[size=undefined]
:[/size]

[code]eth -m on -G -a <coinbase> -i -v 8 //
[/code]
[size=undefined]
To install [/size]

[code]ethminer[/code]
[size=undefined]
 from source:[/size]

[code]cd cpp-ethereum
cmake -DETHASHCL=1 -DGUI=0
make -j4
make install
[/code]
[size=undefined]
To set up GPU mining you need a coinbase account. It can be an account created locally or remotely.
Using ethminer with geth[/size]

[code]geth account new
geth --rpc --rpccorsdomain localhost 2>> geth.log &
ethminer -G  // -G for GPU, -M for benchmark
tail -f geth.log
[/code]

[code]ethminer[/code]
[size=undefined]
 communicates with geth on port 8545 (the default RPC port in geth). You can change this by giving the [/size]

[code]--rpcport[/code]
[size=undefined]
 option to [/size]

[code]geth[/code]
[size=undefined]
. Ethminer will find get on any port. Note that you need to set the CORS header with [/size]

[code]--rpccorsdomain localhost[/code]
[size=undefined]
. You can also set port on [/size]

[code]ethminer[/code]
[size=undefined]
with [/size]

[code]-F http://127.0.0.1:3301[/code]
[size=undefined]
. Setting the ports is necessary if you want several instances mining on the same computer, although this is somewhat pointless. If you are testing on a private cluster, we recommend you use CPU mining instead.
Also note that you do not need to give [/size]

[code]geth[/code]
[size=undefined]
 the [/size]

[code]--mine[/code]
[size=undefined]
 option or start the miner in the console unless you want to do CPU mining on TOP of GPU mining.
If the default for [/size]

[code]ethminer[/code]
[size=undefined]
 does not work try to specify the OpenCL device with: [/size]

[code]--opencl-device X[/code]
[size=undefined]
 where X is 0, 1, 2, etc. When running [/size]

[code]ethminer[/code]
[size=undefined]
 with [/size]

[code]-M[/code]
[size=undefined]
 (benchmark), you should see something like:[/size]

[code]Benchmarking on platform: { "platform": "NVIDIA CUDA", "device": "GeForce GTX 750 Ti", "version": "OpenCL 1.1 CUDA" }


Benchmarking on platform: { "platform": "Apple", "device": "Intel(R) Xeon(R) CPU E5-1620 v2 @ 3.70GHz", "version": "OpenCL 1.2 " }
[/code]
[size=undefined]
To debug [/size]

[code]geth[/code]
[size=undefined]
:[/size]

[code]geth  --rpccorsdomain "localhost" --verbosity 6 2>> geth.log
[/code]
[size=undefined]
To debug the miner:[/size]

[code]make -DCMAKE_BUILD_TYPE=Debug -DETHASHCL=1 -DGUI=0
gdb --args ethminer -G -M
[/code]
[size=undefined]
Note hashrate info is not available in [/size]

[code]geth[/code]
[size=undefined]
 when GPU mining. Check your hashrate with [/size]

[code]ethminer[/code]
[size=undefined]
, [/size]

[code]miner.hashrate[/code]
[size=undefined]
 will always report 0.
ethminer and eth[/size]

[code]ethminer[/code]
[size=undefined]
 can be used in conjunction with [/size]

[code]eth[/code]
[size=undefined]
 via rpc[/size]

[code]eth -i -v 8 -j // -j for rpc
ethminer -G -M // -G for GPU, -M for benchmark
tail -f geth.log
[/code]
[size=undefined]
or you can use [/size]

[code]eth[/code]
[size=undefined]
 to GPU mine by itself:[/size]

[code]eth -m on -G -a <coinbase> -i -v 8 //
[/code]
[size=undefined]
[url=https://github.com/ethereum/go-ethereum/wiki/Mining#further-resources]Further Resources:[/size]
[code]golang <3[/code]

Quote:
GCJFEF4D5EZEF3GLFMPM6IGF6G76TKWIOGVCVV55ZFILZYX6AQVT4AGV
Reply
#2
If you copy something just try copy just proper text without additional HTML signs or just paste direct link. Your post is unreadable!!!
Reply
#3
Tried to read it, on 15th lines I give up. LOL

Please tidy it up before post so others can read it.
XLM ADDRESS:

GCY7GD32QDWAHXWDZLRHH4EM4JKXBXAKJDVWBY2QEVLKMGSCK22NZGF6
Reply
#4
I've read all your information that you shares and I really love it. Thank you for sharing this post. I appreciate it.
Reply
#5
I don't get it. What is the main idea of this post?
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  ASKING How to Mining XLM? dollycamp 25 13,843 29-06-2018, 09:36 PM
Last Post: xcitchx
  Tutorial WHATS MEAN MINING IN FULL EXPLAIN Relano 4 1,435 18-01-2018, 09:10 AM
Last Post: Jaybiano
  INFO - Mining Ethereum Guides cryptosrus 0 701 19-10-2017, 11:57 AM
Last Post: cryptosrus



Users browsing this thread: 1 Guest(s)