ether mining 101 v2
TRANSCRIPT
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%
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>) => a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a
• 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 blockReturns 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
Profitability
Ether mined * ETH price
-
(Hardware + software + power + hosting + your time)
= Profit
HardwareParts:
• 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
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>
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
Managing FailureMultiple 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
MonitoringVarious 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
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