Ether Mining 101
Conor Svensson
@conors10
What
• Ether is the fuel of the Ethereum blockchain
• Pays for smart contract execution in the
Ethereum Virtual Machine (EVM)
• Also a stand alone crypto currency (Gemini
recently licensed for trading it by NY regulators)
Why?
• Speculation
• Where will Ether be in a year?
• Fun
• Combines DIY, computer hardware assembly,
operating system installation/management,
scripting + Ethereum
Price Performance
• Highly Volatile (68–95–99.7 rule)
• Annualised standard deviation (volatility)
119.63%
• ASX volatility during this period 21.95%
USD/ETH Price History
How does it work?
• Miners continually trying to verify blocks for the blockchain
• 5 ether reward for each solution
• Based on Cryptographic hash function
hash(<block>) =>
a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82
d80a4b80f8434a
• Miners applying hash function millions (mega) of times/sec = MH/s
• Single GPU generates 5-30 MH/s
• CPU ~ 0.25 MH/s
Ethash Algorithm
• Ethash Proof of Work algorithm (formerly Dagger
Hashimoto)
• SHA3-256 variant hashing function
• Memory-hard computation
• Memory-easy validation
• Can’t use ASICs (Application Specific Integrated Circuits)
• Uses 4GB directed acyclic graph file (DAG) regenerated
every 30000 blocks by miner
Proof of Work Difficulty
• Hashing blocks
• Difficulty - dynamically adjusts parameter defined originally in genesis block
(one block produced every 12s)
• Started at 0x400000000 (0.017 TH)
• Now at 0x3205AF767000 (55 TH)
• Simplified example:
nonce = random int
while hashimoto(block, nonce) * difficulty > threshold
increment nonce
return nonce
Fetches bytes from DAG +
combine with block
Returns SHA3-256 hash
Solution
Genesis Block
{
"nonce": "0x0000000000000042",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x0",
"gasLimit": "0x8000000",
"difficulty": "0x400000000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x3333333333333333333333333333333333333333",
"alloc": {
}
}
Set to a low value in test networks
Getting Started…
Profitability
Ether mined * ETH price
-
(Hardware + software + power + hosting + your
time)
= Profit
Hardware
Parts:
• 4-6 x GPUs - Radeon series (better OpenCL support), avoid Nvidia
• Motherboard - lots of PCIe slots
• PCI Risers (try fitting > 2 GPUs on a single board)
• Decent power supply ~ 1000W for 3 GPUs
• Cheap CPU
• 4-8GB RAM
• Power switch - to avoid this
Motherboard
PCIe slots
(ASRock H81 Pro BTC)
Motherboard quirks
• Some boards require jumper cables in their PCIe
slots
Risers
Motherboards can only hold 1-2 GPU cards
Case
• Build or buy?
• Considerations
• Budget
• How comfortable are you with DIY?
Case - Wood*
Cost ~$25 AUD
* Combusts at ~300°C
Case - Wood & Metal
Cost ~$50 AUD
Or even milk crates…
Case - Buy
$200 USD from GPU Shack
Software - OS
• Linux
• Ubuntu 14/15 with fglx AMD GPU driver
• Avoid Ubuntu 16 (http://www.omgubuntu.co.uk/
2016/03/ubuntu-drops-amd-catalyst-fglrx-driver-16-04)
• Windows
• EthOS ($40 USD)
• Ether mining Linux OS from GPU Shack
Software - Ethereum
• Geth/Eth
• Run full Ethereum node
• Or
• Connect to a mining pool (see next slide)
• ethminer
• C++ mining client
• Connects to Geth/eth
Mining Pools
• Block reward is 5 ether
• For small rigs => long wait (weeks)
• Steady stream of income (pool splits block reward between
contributing members)
• ~1% fee of all ether mined
• Provide UI for monitoring workers
• Usually go via a proxy (eth-proxy/qtMiner)
• Provides automatic failover in event of pool failure
Begin Mining w/Pool
• Start proxy:
$ python eth-proxy.py
• Start the miner
$ ethminer --farm-recheck 200 -G -F http://
127.0.0.1:8080/<node-name>
Mining
Hashrate
Submit proof of work
http://ethermine.org/
Other Considerations
Power is Expensive in
Australia
Source:
https://www.ovoenergy.com/
guides/energy-guides/
average-electricity-prices-
kwh.html
Power
How much are you paying per kWh?
• Australian plans often have an advertised rate
cap - e.g. quarterly cap of 4000 kWh
• 1 x 1000W PSU (3-4 GPU rig) running 24/7:
1 * 24 * 30 = 720 kWh per month
Power Meters
Measures:
• Current
consumption (W)
• Consumption used
(kWh)
Costs ~$30
Managing Failure
Multiple points of rig failure
• Hardware - GPU x 4-6, risers x 2-5,
motherboard PCI slots => lots of variables
• Software - problematic device drivers
• Time consuming trial and error to isolate
issues - e.g. jumper cables required on some
model PCIe slots
Monitoring
Various components:
• Node or Pool connectivity
• ethminer
• it occasionally falls over
• GPU temperature
• On Linux requires X Server to be running
• CPU temperature
• OS crash
Monitoring
• You’ll need to write various scripts (or use
EthOS)
• Take action
• Send alerts - email/SMS
• Restart component
• Power off rig
What about the cloud?
You’ll need lots of AWS credit…
AWS Spot Instances
• g2.8xlarge instance contains 4 x Nvidia GPUs
• Hashrate of 24 MH/s
• 0.0077 Ether/hour ~ $0.10 USD/hour
• Low spot instance price $2.66 USD/hour
Proof of Stake
• Nodes with greater stake (e.g. total # of ether,
duration of holdings) more likely to generate
valid block
• No longer possible to profitably mine ether (if it
ever was…)
• Expected early 2017
Location
• Do you have space?
• Make sure you get partner/spouse approval…
Thanks
conor10@gmail.com
@conors10
Resources• Mining algorithm
• https://github.com/ethereum/wiki/blob/master/Dagger-Hashimoto.md
• https://github.com/ethereum/wiki/wiki/Ethash
• Costs
• http://etherchain.org/api/statistics/price - Ether price history
• https://etherscan.io/ether-mining-calculator - Mining calculator
• Parts
• Ebay
• http://gpushack.com/collections/gpushack - ready made rigs (US based)
• Pools
• https://github.com/Atrides/eth-proxy
• http://ethpool.org/
• Rig building
• https://www.youtube.com/watch?v=Jnp9Ka8WVpA - metal/wood rig
• http://highoncoins.com/litecoin-rig/how-to-make-diy-wooden-frame-for-litecoindogecoin-rig/ - wooden rig
• web3j
• https://github.com/web3j/web3j - Java library for working with Ethereum nodes

Ether mining 101 v2

  • 1.
    Ether Mining 101 ConorSvensson @conors10
  • 2.
    What • Ether isthe fuel of the Ethereum blockchain • Pays for smart contract execution in the Ethereum Virtual Machine (EVM) • Also a stand alone crypto currency (Gemini recently licensed for trading it by NY regulators)
  • 3.
    Why? • Speculation • Wherewill Ether be in a year? • Fun • Combines DIY, computer hardware assembly, operating system installation/management, scripting + Ethereum
  • 4.
    Price Performance • HighlyVolatile (68–95–99.7 rule) • Annualised standard deviation (volatility) 119.63% • ASX volatility during this period 21.95%
  • 5.
  • 6.
    How does itwork? • Miners continually trying to verify blocks for the blockchain • 5 ether reward for each solution • Based on Cryptographic hash function hash(<block>) => a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82 d80a4b80f8434a • Miners applying hash function millions (mega) of times/sec = MH/s • Single GPU generates 5-30 MH/s • CPU ~ 0.25 MH/s
  • 7.
    Ethash Algorithm • EthashProof of Work algorithm (formerly Dagger Hashimoto) • SHA3-256 variant hashing function • Memory-hard computation • Memory-easy validation • Can’t use ASICs (Application Specific Integrated Circuits) • Uses 4GB directed acyclic graph file (DAG) regenerated every 30000 blocks by miner
  • 8.
    Proof of WorkDifficulty • Hashing blocks • Difficulty - dynamically adjusts parameter defined originally in genesis block (one block produced every 12s) • Started at 0x400000000 (0.017 TH) • Now at 0x3205AF767000 (55 TH) • Simplified example: nonce = random int while hashimoto(block, nonce) * difficulty > threshold increment nonce return nonce Fetches bytes from DAG + combine with block Returns SHA3-256 hash Solution
  • 9.
    Genesis Block { "nonce": "0x0000000000000042", "timestamp":"0x0", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x0", "gasLimit": "0x8000000", "difficulty": "0x400000000", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333", "alloc": { } } Set to a low value in test networks
  • 10.
  • 11.
    Profitability Ether mined *ETH price - (Hardware + software + power + hosting + your time) = Profit
  • 12.
    Hardware Parts: • 4-6 xGPUs - Radeon series (better OpenCL support), avoid Nvidia • Motherboard - lots of PCIe slots • PCI Risers (try fitting > 2 GPUs on a single board) • Decent power supply ~ 1000W for 3 GPUs • Cheap CPU • 4-8GB RAM • Power switch - to avoid this
  • 13.
  • 14.
    Motherboard quirks • Someboards require jumper cables in their PCIe slots
  • 15.
    Risers Motherboards can onlyhold 1-2 GPU cards
  • 16.
    Case • Build orbuy? • Considerations • Budget • How comfortable are you with DIY?
  • 17.
    Case - Wood* Cost~$25 AUD * Combusts at ~300°C
  • 18.
    Case - Wood& Metal Cost ~$50 AUD
  • 19.
    Or even milkcrates…
  • 20.
    Case - Buy $200USD from GPU Shack
  • 21.
    Software - OS •Linux • Ubuntu 14/15 with fglx AMD GPU driver • Avoid Ubuntu 16 (http://www.omgubuntu.co.uk/ 2016/03/ubuntu-drops-amd-catalyst-fglrx-driver-16-04) • Windows • EthOS ($40 USD) • Ether mining Linux OS from GPU Shack
  • 22.
    Software - Ethereum •Geth/Eth • Run full Ethereum node • Or • Connect to a mining pool (see next slide) • ethminer • C++ mining client • Connects to Geth/eth
  • 23.
    Mining Pools • Blockreward is 5 ether • For small rigs => long wait (weeks) • Steady stream of income (pool splits block reward between contributing members) • ~1% fee of all ether mined • Provide UI for monitoring workers • Usually go via a proxy (eth-proxy/qtMiner) • Provides automatic failover in event of pool failure
  • 24.
    Begin Mining w/Pool •Start proxy: $ python eth-proxy.py • Start the miner $ ethminer --farm-recheck 200 -G -F http:// 127.0.0.1:8080/<node-name>
  • 25.
  • 26.
  • 27.
  • 28.
    Power is Expensivein Australia Source: https://www.ovoenergy.com/ guides/energy-guides/ average-electricity-prices- kwh.html
  • 29.
    Power How much areyou paying per kWh? • Australian plans often have an advertised rate cap - e.g. quarterly cap of 4000 kWh • 1 x 1000W PSU (3-4 GPU rig) running 24/7: 1 * 24 * 30 = 720 kWh per month
  • 30.
    Power Meters Measures: • Current consumption(W) • Consumption used (kWh) Costs ~$30
  • 31.
    Managing Failure Multiple pointsof rig failure • Hardware - GPU x 4-6, risers x 2-5, motherboard PCI slots => lots of variables • Software - problematic device drivers • Time consuming trial and error to isolate issues - e.g. jumper cables required on some model PCIe slots
  • 32.
    Monitoring Various components: • Nodeor Pool connectivity • ethminer • it occasionally falls over • GPU temperature • On Linux requires X Server to be running • CPU temperature • OS crash
  • 33.
    Monitoring • You’ll needto write various scripts (or use EthOS) • Take action • Send alerts - email/SMS • Restart component • Power off rig
  • 34.
    What about thecloud? You’ll need lots of AWS credit… AWS Spot Instances • g2.8xlarge instance contains 4 x Nvidia GPUs • Hashrate of 24 MH/s • 0.0077 Ether/hour ~ $0.10 USD/hour • Low spot instance price $2.66 USD/hour
  • 35.
    Proof of Stake •Nodes with greater stake (e.g. total # of ether, duration of holdings) more likely to generate valid block • No longer possible to profitably mine ether (if it ever was…) • Expected early 2017
  • 36.
    Location • Do youhave space? • Make sure you get partner/spouse approval…
  • 37.
  • 38.
    Resources• Mining algorithm •https://github.com/ethereum/wiki/blob/master/Dagger-Hashimoto.md • https://github.com/ethereum/wiki/wiki/Ethash • Costs • http://etherchain.org/api/statistics/price - Ether price history • https://etherscan.io/ether-mining-calculator - Mining calculator • Parts • Ebay • http://gpushack.com/collections/gpushack - ready made rigs (US based) • Pools • https://github.com/Atrides/eth-proxy • http://ethpool.org/ • Rig building • https://www.youtube.com/watch?v=Jnp9Ka8WVpA - metal/wood rig • http://highoncoins.com/litecoin-rig/how-to-make-diy-wooden-frame-for-litecoindogecoin-rig/ - wooden rig • web3j • https://github.com/web3j/web3j - Java library for working with Ethereum nodes