Mining involves repeatedly
hashing block headers with different
nonce values until finding a
hash below the target
difficulty. The process follows these steps:
1.
Transaction Selection: Miners choose transactions from the
mempool, typically prioritizing those with higher
fees per byte
2.
Merkle Root Calculation: Transactions are arranged in a
Merkle tree, with the root included in the
block header
3.
Block Header Construction: Includes previous
block hash,
Merkle root,
timestamp,
difficulty target, and
nonce
4.
Hashing: Miners increment the
nonce and
hash the header using
SHA-256 (Bitcoin) or other algorithms (Scrypt for Litecoin, Ethash for
Ethereum pre-merge)
5.
Difficulty Verification: If
hash target, the
block is valid; otherwise, adjust
nonce/timestamp and repeat
Mining hardware evolution:
- CPU
Mining (2009-2010): General-purpose processors
- GPU
Mining (2010-2013): Graphics cards offering parallel processing
- FPGA
Mining (2011-2013): Programmable chips optimized for
hashing
- ASIC
Mining (2013-present): Application-specific chips designed solely for
mining
Mining pools aggregate hashpower from multiple miners to reduce variance in rewards. Popular protocols include:
- Stratum: Efficient communication between miners and pools
- GetBlockTemplate: Allows miners more control over
block construction
- Shares: Proof of work at lower
difficulty to track contribution
Network attacks and defenses:
- 51% Attack: Requires majority hashrate to double-spend or censor
-
Selfish Mining: Strategic
block withholding to gain advantage
-
Block Withholding: Pool members submitting shares but not solutions
-
Difficulty Adjustment Attacks: Exploiting
difficulty algorithms
Mining economics involve:
-
Hash Price: Revenue per unit of hashrate
- Break-even Analysis: Electricity costs vs.
mining revenue
- Hardware Depreciation: ASICs become obsolete as
difficulty rises
- Geographic Distribution: Miners migrate to regions with cheap electricity