Eth: 0x00cce8E2e56a543abc084920eee3f88eFD0921ea

Friday, November 27, 2015

Ethereum GPU Mining with Ubuntu 14.04 from Scratch

_________________
UPDATED 3/20/2016 - qtminer install instructions for pool mining and GPU_SINGLE_ALLOC_PERCENT=100 for 2GB GPUs
__________________

As the codebase developed, we now have a much simpler way to install and run a GPU miner for Ethereum.

Install Ubuntu
A quick note here for newbies, it'll be easier to manage your system in the long run if you install Ubuntu in headless mode. (Headless means it won't output anything to a monitor on bootup and you'll have to loginto the computer remotely via SSH). 

Install Graphics Drivers (AMD)
1) At the command line type:

 sudo apt-get -y update   
 sudo apt-get -y upgrade -f   
 sudo apt-get install fglrx-updates  
 sudo amdconfig --adapter=all --initial  

2) Reboot the machine.
3) You should now be able to see all the video cards installed on your system using the command:
 aticonfig --list-adapters   
The item with the star (*) next to it is the default graphics output of the computer. In our case we have set this to the integrated graphics card and we will use the GPUs installed in the PICe slots only for mining.

3) Trouble: If you're having trouble getting the system to display anything on the screen after boot, you are probably plugged into the wrong graphics card and you may have to change the defaults in BIOS as well as changing the default card the ubuntu uses for it's output. You can force use of the integrated graphics card by entering the following at the terminal:
 sudo aticonfig --pxl-igpu  

Install Geth
Note: If you have a different wallet software like MIST, you don't need to install geth to mine with a pool (non-solo mining).
1) Make a new directory for the latest version of geth
mkdir go-eth135
cd go-eth135

2) Download the master branch for github
git clone https://github.com/ethereum/go-ethereum
cd go-ethereum

3) Enable OPENCL and Build

  export GO_OPENCL=true   
  export GPU_MAX_ALLOC_PERCENT=100   
  export GPU_SINGLE_ALLOC_PERCENT=100  
  make geth   

4) Make a new coinbase account (where your Ether will be deposited)
 build/bin/geth account new  

(enter in a password 2x)


Install QT Miner

We use qt miner as are pool mining software. Several mining pools use qt miner.
1) Download the qtminer software for 14.04 or 15.04 from EthPool.org.

 tar zxvf qtminer.tgz  
 cd ./qtminer  
 chmod +x qtminer.sh  

Start Mining (Solo)
1) To start GPU Mining, go back to your go-eth directory

build/bin/geth -maxpeers '100' -mine -minergpus '0' -autodag console

2) Mine with Multiple GPUs
build/bin/geth -maxpeers '100' -mine -minergpus '0,1,2' -autodag console

Where '0,1,2' means mine with GPUs zero, one and two. You should change this to list however many GPUs you have. Thus if you have only 2 GPUs and they are devices 2 and 4 you would type : '2,4' instead of '0,1,2'. To see which devices your GPUs are listed as use the command:

aticonfig --list-adapters  

NOTE: All the rest of the commands are typed inside the go-ethereum console:

3) Ensure your rig is mining to your address
web3.eth.coinbase
 (This should be set to the same address that you just created when you made your coinbase account)
If this returns '0x0' that means you're mining rewards will get sent into a big black hole. Fix this by typing the following inside the geth java scrypt console:
 web3.miner.setEtherbase(web3.eth.accounts[0])

4) Check Profits
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
 This will return how much ether you have in your account

5) Check Hash Rate
miner.hashrate


Start Mining (Pool)
1) Mining with ethermine.org, they have several servers throughout the world:
US East : us1.ethermine.org:4444
US West: us2.ethermine.org:4444
Asia       : asia1.ethermine.org:4444
Europe  : eu1.ethermine.org:4444

They use a PPLNS 1% fee system. I have used their companion service ethpool.org successfully for months.

Below, you should replace the address with your own wallet address given to you by geth when you made your account. I mine with US East so to start mining I type the following:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig1 -G

The command above will attempt to start all your video cards mining. In my case, this doesn't work because I have an AMD integrated graphics card as my first device (device '0' in the image below).


2) Troubleshooting: If you have a an issue like me where you have an integrated graphics card, that you can't mine on, or you just want to specify the cards to mine on, modify the above qtminer command as follows:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig1 -G --opencl-device '1'

This will start my first device. To start the rest of the non-integrated graphics mining I would then enter the following in separate terminals:

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig2 -G --opencl-device '2'

./qtminer.sh -s us1.ethermine.org:4444 -u 0x8e61bf5a2e46d15774172781cf100ed0962cbb63.rig3 -G --opencl-device '3'


The End & Other Problems
If you have enjoyed this post, please consider sending me a beer!

Having problems with PCIe Extenders? Check Here for common solutions.

Problems with 2GB GPU? Make sure that the following is set before starting qtminer:

  export GPU_MAX_ALLOC_PERCENT=100   
  export GPU_SINGLE_ALLOC_PERCENT=100  

Tuesday, July 28, 2015

Ethereum Profitability Basics

I've heard lots of you asking what does profitability look like for mining Ether and the first thing that comes to my mind is that it depends! Really it depends on the price of Ether, as well as the ratio of your hashing power to the total hashing power of the network. Not to mention, e- costs.

Now we could go into a whole bunch of mathyness but lets just skip to the pretty pictures and explain them later:

So what we are seeing here is there is a relationship between the network hash rate, your hash rate, and how many blocks you'll be able mine every month.

Now lets look at how much $ you'll be able to make at this game:
So here we're assuming that Ether is valued at $1/Ether, and that each time you mine a block you get 5 Ether. Additionally, we assume that it costs $15/20MH/s per month to run your GPU. A month is assumed to be 30 days. Thus a R9 280x that produces around 20MH/s for the whole month will cost around $15 to run (values are reasonable for the United States). Based on these assessments, we can see that there is a huge incentive for GPU miners to pile on the Ethereum train as a single R9 280x card (which produces 20MH/s) could potentially earn you $40/month in profits (or much more, or much less, depending on how fast people pile their GPUs onto the Ether train).

Now using this graph, we can get an idea of what value of Ether is required to support a given hash rate. Personally, if My R9 280x card, which is burning $15/month in e-, if it's making me $20/month in profits, I'm ok with that. This means it'll also pay for itself in less than a year. Thus, a 1TH/sec, I'll still be mining if Ether is work $1. And, if Ether is worth three times as much, I'll be able to mine until the network hash rate reaches 3GH/s.

I would roughly expect the hash rate to reflect 1 TH/s per $1 of Ether. So since Ethercoin is currently trading around $3, I would expect that at the Frontier launch we might get as high as 3TH/s mining on the Ethereum network. Network hash rates that exceed the 1 TH/s value of Ether indicate that the community believes Ether will be worth more in the future than it is now, and wold be a bullish indicator.

Lucky hashing!
-skithuno-

Wednesday, May 27, 2015

Ethereum GPU Mining: Ubuntu 14.04 LTS From Scratch


----------------------------
11/27/2015
This guide is now OUTDATED and has been updated: The New Guide  

-----------------------------
7/30/2015
Updated Multi-GPU commands
Updated instructions for building cpp-ethereum

7/29/2015 @ 11:46pm
Added instructions on transitioning from testnet to Frontier. 
-----------------------------

I tried for two days to install Ethereum for GPU mining and I was tired of reading the Ethereum.org posts and getting no where. I'm a novice when it comes to all this collaborative code development so I just needed a simple-stupid guide for me! I've collated everything in one place for those that are running Ubuntu. This works from a clean install of Ubuntu 14.04 LTS

Note: I found this works best if you don't have your GPU card in while doing the initial Ubuntu install (this caused issues for me as the on-board video and GPU were fighting for monitor control or I was hallucinating). 

Start Install:

at the command line type:

 sudo apt-get -y update  
 sudo apt-get -y upgrade -f  
go to system& settings>Software&Updates>Updates &click Pre-released updates (trusty proposed)shut down the computer
install the GPU and GPU power
boot up the computer
then go to system & settings > Additional Drivers & your GPU should be listed there, select Using video driver fror the AMD graphics accelerators from fglrx-updates (proprietary)
apply changes and close

back to the command line: 
 sudo apt-get -y install git  
 sudo apt-get -y install software-properties-common  
 sudo add-apt-repository ppa:ethereum/ethereum  
 sudo apt-get update  
 sudo apt-get install -y build-essential libgmp3-dev golang  
 sudo apt-get -y upgrade  
 git clone https://github.com/ethereum/go-ethereum  
 cd go-ethereum  

backup your old key file (if you mined on test net):
 sudo cp -r ~/.ethereum/keystore ~/Desktop/  

Now lets continue with geth install and get the latest version of geth:
 git checkout master 


Clear out your old blockchain (only if you've run geth on test net previously)
 sudo rm -r ~/.ethereum/extra/  
 sudo rm -r ~/.ethereum/state/  
 sudo rm -r ~/.ethereum/blockchain/  


we need to do some last things to setup for Frontier:

 sudo apt-get install curl    
 cd ~    
 sudo apt-get install -y python-pip python-dev build-essential   
 sudo pip install --upgrade pip   
 sudo pip install --upgrade virtualenv   
 mkdir genfiles  
 cd genfiles  
 curl -O -k https://raw.githubusercontent.com/ethereum/genesis_block_generator/master/mk_genesis_block.py    
 curl -O -k https://bootstrap.pypa.io/get-pip.py    
 sudo python get-pip.py    
 sudo python -m pip install bitcoin  
 cd ..  
 cd go-ethereum   
 make geth    
(if you throw an error on make geth and you go back and try and fix things, make sure to delete the go-ethereum directory before trying to make geth again (error help me!))



now we make a new wallet for Ethereum:


 build/bin/geth account new  

(enter in a password 2x)


now we'll install ethminer

 cd ~  
 sudo apt-get -y install language-pack-en-base  
 sudo dpkg-reconfigure locales  
 wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -   
 sudo add-apt-repository "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty main"  
 sudo add-apt-repository ppa:ethereum/ethereum-qt  
 sudo add-apt-repository ppa:ethereum/ethereum-dev  
 sudo apt-get -y update  
 sudo apt-get -y upgrade  
 sudo apt-get -y install build-essential git cmake libboost-all-dev libgmp-dev libleveldb-dev libminiupnpc-dev libreadline-dev libncurses5-dev libcurl4-openssl-dev libcryptopp-dev libjson-rpc-cpp-dev libmicrohttpd-dev libjsoncpp-dev libargtable2-dev llvm-3.8-dev libedit-dev mesa-common-dev ocl-icd-libopencl1 opencl-headers libgoogle-perftools-dev qtbase5-dev qt5-default qtdeclarative5-dev libqt5webkit5-dev libqt5webengine5-dev ocl-icd-dev libv8-dev  
 git clone https://github.com/ethereum/cpp-ethereum  
 cd cpp-ethereum  
 git checkout master   
 mkdir build   
 cd build  
 cmake .. -DGUI=0 -DETHASHCL=1   
 make -j2  
 sudo make install  
 sudo apt-get install cpp-ethereum  #(Can someone confirm that skipping to this step still works)
 cd ~
 cd go-ethereum   

If cmake .. -DGUI=0 -DETHASHCL=1 fails for you, try this variant:
 cmake .. -DGUI=0 -DETHASHCL=1 -DEVMJIT=0  


 Once the genesis block is release do this: (No Longer Required in go-ethereum later than release/1.0.0)



 python ~/genfiles/mk_genesis_block.py --extradata 0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa > genesis_block.json  
 ./build/bin/geth --genesis ~/genfiles/genesis_block.json  


Sync with the Network & Benchmark:

at the command line type:


 cd go-ethereum  
 build/bin/geth -rpc console  
This will start syncing you up with the network. Once synced (you are only grabbing 1-2 blocks at a time) head back to the command line to benchmark. (Note: Personally I found the results of this benchmarking unreliable. Easier to just skip to the mining part):

Ctrl + C
 build/bin/geth --rpccorsdomain localhost 2>> geth.log &  
 ethminer -G -M --opencl-device 0  
 tail -f geth.log  

I initially had some trouble b/c I had an AMD embeded video card and an AMD GPU. Make sure you are targeting the right GPU card by changing the opencl-device # until you find the right card. Reference this list to see if you are targeting the right card.

 Once your are done benchmarking, post your results here.

Note: benchmarking using the code above causes geth to run in the background and thus if you try mining or running geth again, you might get an errors. Easiest thing to do at this point is close the terminal and open a new one. Or just restart the computer for good measure. Then you should have no problem going on to the mining step.

Mining:

Now we're done installing and benchmarking, lets start freaking MINING!

 build/bin/geth --rpc console 
 
I then open up a second terminal and type:

 ethminer -G --opencl-device X   

Where X is the value given by your benchmarking results. Keep doing the "etheminer -G --opencl-device X", one time for each GPU you have. It will take a few minutes for rpc console to sync up and get ready as well as a few more minutes for the miner to start hashing so be patient.

If you skipped the benchmarking part, at this point you should have a good idea of how fast your machine is mining so go and post the results of your average hashing here.  

If you're experiences errors eith Ethminer at this point check the reference posts below. 

Additionally, some GPUs may required an additional typed at the regular command console (not the geth console):

 export GPU_MAX_ALLOC_PERCENT=95  


One last check after you start mining, make sure your coinbase account (the account where your mining rewards will be deposited) is set. You can check this by typing the following inside the geth javascript console:
 web3.eth.coinbase  

If this returns '0x0' that means you're mining rewards will get sent into a big black hole. Fix this by typing the following inside the geth java scrypt console:
 web3.miner.setEtherbase(web3.eth.accounts[0])  

That will set your mining account to your primary account. 

Multi-GPU Mining: 

You can mine with multiple cards. Plug them both into your board and turn on geth "build/bin/geth -rpc console". Let the chain sync.
Then pop open a second terminal and type:

 ethminer -G -t X 
where X is the number of GPUs you have to mine on.
Cheers!

Updating:

Occasionally you will need to update your copy of geth and cpp by pulling down the latest release from github. You can perform this operation by:

 cd go-ethereum  
 git pull  
 make geth    
 cd ..  
 cd cpp-ethereum  
 git pull  
After pulling the latest revision of Geth, make sure to rebuild it using "make geth" as shown above. If you don't rebuild it, it causes major long-term problems. On rare occasion, you will need to completely wipe your blockchain and re-download it. Perform that operation as follows

 cd go-ethereum  
 build/bin/geth removedb   

References:

This post was put together by reading the following posts:
Mining FAQs Live Update
Frontier GPU guide 
Benchmark
Building on Ubuntu
Final Steps for Frontier 

Code formatting brought to you by codeformatter.

Tuesday, May 26, 2015

Motherboard Modifications

Recently purchase a new mother board and had an interesting experience where the mounting point for the CPU heat sink was incomplete. There are usually two mounting 'hooks' the hold the heat sink on the CPU and one of them was missing! The other one didn't have any screws. This was partially my fault because I purchased an Open Box from Microcenter.

As opposed to returning the board or waiting forever for replacements, I went ahead and worked out a solution that required two screws, a hack saw, a coat hanger, and some pliers. Start to finish pictures are shown below:

PC board with single mount installed with modified screws I found in the basement.
 Coat hanger strung under board with two ends poking out of holes for other plastic mounting location.
 Finished coat hanger pare twisted together and bent sideways to form the 'lip' for the heat sink to grab onto.
Side view of the same.

Sunday, January 25, 2015

Federal Government Bets on Bitcoin





In 2014, the IRS released a document outlining how they plan on taxing Bitcoin. The document, titled NOTICE 2014-21, lays out the foundation of their policy with treats Bitcoin like property. Choosing this method of taxation maximizes the revenues the governments receives from Bitcoin miners as long as the price of Bitcoin is rising (relative to USD). We will present a quick example to show the annual tax haul of the federal government in two scenarios, one in which the relative value of BTC to USD is falling, and the other in which BTC to USD is rising.

Scenario 1: Bitcoin loosing value against the dollar




Current Regulation:
INCOME TAX + CAP GAINS = $0

Potential Regulation:
CAP GAINS only =$360




Scenario 2: Bitcoin gaining value against the dollar



Current Regulation:
INCOME TAX + CAP GAINS = $1,365

Potential Regulation:
CAP GAINS only =$1,020




 

Why Should I Care?

  We all want to know yesterday exactly how Bitcoin is going to be regulated in the US and how it is treated for taxation can indicate if the federal government thinks Bitcoin will survive. In a market where the value of Bitcoin is spiraling down into oblivion, under current tax schemes, the federal government will tax miners basically nothing. However, if Bitcoin goes up in value instead, the taxes are 30% above what they would have been under a capital gains only rule. I think the federal government is on a spending binge and they are looking for revenue anywhere they can find it. And with the current tax regulation, they are betting on Bitcoin going up! Thus, for all the rhetoric about how Bitcoin is bad and helps people do bad things (ie. helping move money from conflict avocado sales south of the border), the federal government wants a slice of that sweet sweet Bitcoin Pie.

 Assumptions.

  Single household that has an income tax of 30% (fed+state) & capital gains of (20%), mining produce 0.5 BTC / month and cost 60 USD / month to operate. BTC are all exchanged for USD at the end of the year. Hardware deprecation effects are not included. BTC holds price steady after the end of the year and long term capital gains are applied to sales.

Friday, October 10, 2014

CFL vs. LED light bulb, Which is less expensive?

Problem Statement

As with all optimization problems, determining if you want to buy CFL bulbs to light your home, or the new LED bulbs, is a serious decision. (Especially now that the LED guys got the Nobel Prize!) I'm here to help. I've put together a few graphs of my findings. The long and the short if it is, it depends...

The total cost of CFL vs. LED is in some way related to the following factors:
  • Initial cost of the bulb ($)
  • Electricity consumption of the bulb (W/hr)
  • Average electricity costs in your area (kW/hr)
  • Return on Investment aka: ROI (%)
  • The number of bulbs you have in your house (#)
  • The average number of hours the bulbs are on during the day (hours on/day)
All of these variables are combined to come up with a unique profile of your costs. Our approach includes an assessment of the time value of money. To determine to total expenses of both products, we calculate total amount of money spent on the product including initial costs and reoccurring costs, as well as what that money would have been worth if it had been invested rather than spent. I will give you the rundown of a few scenarios.:

Scenario 1

15 bulbs are installed in a house that are on for an average of 5 hours / day. ROI is 3%. Electricity costs are 0.12$/(kW/hr), 800 Lumen CFL consumes 14W/hr and costs 1.66$ each, 800 Lumen LED consumes 9.5W/hr and costs $9.34 each.

So let's talk about what's happening here. On these graph, higher numbers on the Y axis is bad (we're looking to minimize expenses).  CFL beats out the LED option until year 14. However. Those shallow savings are soon wiped in year 15 as the LED bulbs have reached their 25,000 hour rating and must now be replaced. However, after this time, the values steadily diverge yielding a $200 savings after 30 years. That really isn't something to write home about.

Scenario 2

15 bulbs are installed in a house that are on for an average of 5 hours / day. ROI is 3%. Electricity costs are 0.12$/(kW/hr), 800 Lumen CFL consumes 14W/hr and costs 1.66$ each, 800 Lumen LED consumes 9.5W/hr and costs $5.00 each (only change).

This is a much more promising scenario where the price of LED bulbs has fallen by almost 1/2. Here we see it takes 4-5 years to break even and we have relatively steady savings from there on out to 30 years where our total savings is around $500. Not bad but still a long time to wait to save $500!.

Scenario 3

15 bulbs are installed in a house that are on for an average of 5 hours / day. ROI is 3%. Electricity costs are 0.20$/(kW/hr), 800 Lumen CFL consumes 14W/hr and costs 1.66$ each, 800 Lumen LED consumes 9.5W/hr and costs $5.00 each.

Here we have a scenario where the price of power has now also increased. This results in a pretty clear winner even in the short term. A $250 savings is realized within 5 years by switching to LED lights and over 30 years, a $2,500 savings is realized.

Conclusions

There are no simple answers here. It is hard to tell which solution will really save you a significant amount of cash in the near term. You might not want to rip out those CFLs till they burn out. What is clear from these studies is that no one can tell you for sure which one is less expensive unless they take a detailed look at your usage habits. One thing I would not do is just read the back of the package and assume that your usage profile fits theirs. (They are trying to get you to buy that box you're holding remember, so they have an incentive to paint it in a good light.) Any type of simple quick decision in this field is probably going to lead you down the path of spending more money.

Based on my usage profile, I'm expecting that once the bulbs hit $5.00 I'll slowly replace my CFLs with LEDs. I have to have something to show for 3 hours of work on a Friday :). And it'll insulate me against future price hikes by the electricity suppliers. $10.00 for the LED lights is just too expensive to make it worthwhile.

I've supplied the spreadsheet that I used for all the graphs included in this posting. I recommend that you check it out and plug in your own numbers. I hope it can help you figure out if CFL or LED is better for your application in less than the three hours it took me to put the analysis together!

Download Spreadsheet from Google Drive


Notes

Specs on the bulbs compared in this study can be found here:
CFL & LED

Disclosures

I am in no way affiliated with any light bulb manufacturers and I don't own any stock in them either and I have only purchased CFL bulbs in the last 5 years.