A mining algorithm is the specific computation that miners on a proof-of-work blockchain must perform to create new blocks. It usually consists of a cryptographic hash function, applied repeatedly to a block's contents with a changing number until the output falls below a target, plus rules about how the work is checked. The algorithm determines what kind of hardware is efficient for mining, how much energy and memory it uses, and how easily the network's security could be concentrated in a few hands.
Each proof-of-work coin chooses its own algorithm. Bitcoin uses SHA-256, applied twice; Litecoin and Dogecoin use Scrypt; Monero uses RandomX; and Ethereum used Ethash until it switched to proof of stake in 2022. The choice is a design decision about security, fairness and the kind of mining community a project wants.
Mining algorithm in plain terms
Imagine a lottery in which tickets are earned by solving a puzzle that has no shortcut: the only way to win is to try answer after answer until one fits. The mining algorithm is the puzzle. Everyone uses the same puzzle, and anyone can check a winning answer in a moment, but finding one takes enormous numbers of guesses.
Different puzzles suit different tools. Some can be solved fastest with a machine built only for that one puzzle; others are designed to need lots of memory, so ordinary home computers stay competitive. Choosing the puzzle therefore shapes who can take part.
How a mining algorithm works
- A miner assembles a candidate block containing pending transactions and a block header that summarises them.
- The miner runs the header through the mining algorithm, producing a fixed-length output called a hash.
- If the hash is numerically below the current target, the block is valid. If not, the miner changes a small field called the nonce, or other data, and tries again.
- Other nodes verify the winning block with a single calculation, which is fast regardless of how much work it took to find.
- The network regularly adjusts the target through its mining difficulty rule, so blocks keep arriving at a steady pace however much computing power joins.
The total rate of guesses across the network is its hashrate, measured in units such as megahashes or terahashes per second.
Some algorithms add steps beyond a single hash. Memory-hard designs force each guess to read and write large blocks of data, so that the speed of memory rather than raw calculation limits performance. Others, such as RandomX, generate a small random program for each attempt, which general-purpose processors handle well and fixed-function chips do not. A few coins have combined several hash functions in sequence, hoping to make specialised hardware uneconomic.
Main types
| Algorithm | Example coins | Typical hardware |
|---|---|---|
| SHA-256 | Bitcoin, Bitcoin Cash | Specialised ASIC machines |
| Scrypt | Litecoin, Dogecoin | ASICs, although designed to be memory-intensive |
| Ethash and Etchash | Ethereum until 2022; Ethereum Classic | Graphics cards, later also ASICs |
| RandomX | Monero | General-purpose processors (CPUs) |
| Equihash | Zcash | ASICs, originally GPUs |
ASIC resistance and its trade-offs
An application-specific integrated circuit (ASIC) is a chip built for one task, and for a simple algorithm such as SHA-256 it can be thousands of times more efficient than a general computer. That pushes mining towards professional operators with access to the newest chips and cheap power. Some projects therefore choose algorithms designed to be ASIC resistant, usually by requiring large amounts of memory or by randomising the work, so that consumer graphics cards or processors remain competitive.
The approach is contested. ASIC resistance has often proved temporary, as manufacturers eventually build specialised machines, and some projects have changed algorithms repeatedly to stay ahead, which itself requires coordinated network upgrades. Critics also argue that algorithms mined on consumer hardware are easier to attack, because an attacker can rent large amounts of general-purpose computing power, whereas a network secured by dedicated ASICs is protected by miners' investment in equipment that has no other use.
Security and design considerations
- Cryptographic strength. The hash function must be hard to predict or shortcut, or miners who find a shortcut could dominate the network.
- Fast verification. Checking a solution must be cheap so that all nodes, including small ones, can verify blocks.
- Shared hashrate. Smaller coins using the same algorithm as a larger one can be attacked by miners redirecting power from the bigger network, a risk behind several majority attacks on minor coins.
- Energy use. All proof-of-work algorithms turn electricity into security; the algorithm affects which hardware is used, not whether energy is consumed.
Changing a coin's mining algorithm requires a hard fork and the agreement of its community, so established networks rarely do it.