MiningViewprofitability
MiningView/Miner's handbook/SHA-256 in Bitcoin: a complete technical guide from hash function to ASIC
Bitcoin and Blockchain·24 min·updated November 13, 2026

SHA-256 in Bitcoin: a complete technical guide from hash function to ASIC

SHA-256 is not encryption and it is not a puzzle that a miner decrypts. It is a deterministic cryptographic hash function that turns any input into a 256-bit fingerprint. In Bitcoin, that fingerprint is the basis of Proof of Work, which is why an ASIC tests billions of block-header candidates every second.

#SHA-256#Bitcoin#ASIC#Proof of Work#hashrate
7 views
SHA-256 in Bitcoin: a complete technical guide from hash function to ASIC

SHA-256: what a hash function actually does

A hash function accepts data of arbitrary length and returns a fixed-length string. SHA-256 produces 256 bits, or 32 bytes; in the familiar hexadecimal form that is 64 characters. The same input always produces the same result, but changing one character can change the whole fingerprint.

Hashing must not be confused with encryption. Encryption is designed to be reversed with a key, while SHA-256 is one-way: given a digest, recovering the original input is computationally infeasible. It is also impractical to find another input with the same hash, which is what makes it useful for checking block and transaction integrity.

  • fixed 256-bit output
  • deterministic for the same input
  • avalanche effect after a small change
  • hashing hides nothing and is not encryption

How SHA-256 processes a message internally

Before computation, the algorithm pads a message with a 1 bit, zeros and the original length. The stream is then divided into 512-bit blocks. Each block passes through a message schedule and 64 rounds of bitwise operations, rotations, modular addition and algorithm constants.

This explains two practical facts. SHA-256 is suitable for checking enormous numbers of candidates, and hardware can be optimized for one function. Instead of a general-purpose processor, an ASIC repeats precisely the operations needed by SHA-256 with minimal overhead.

  • messages are padded into 512-bit blocks
  • processing is a sequence of rounds, not key search
  • the output remains 256 bits for every input length
  • an ASIC trades flexibility for efficiency

Why Bitcoin uses double SHA-256

For Bitcoin Proof of Work, a miner does not compute one hash but two in sequence: SHA256(SHA256(block header)). This is called double-SHA-256. It does not make Bitcoin twice encrypted or simply double the difficulty; it is a protocol rule used by every validating node.

A related construction is used for transaction identifiers and Merkle trees. A block can therefore represent a large transaction set with one Merkle root, while a node can prove that a transaction belongs to the block without rereading every other transaction.

  • Proof of Work hashes the block header twice
  • transaction IDs historically use double-SHA-256
  • a Merkle root compresses the transaction set
  • protocol rules matter more than the visual number of zeros

What a miner actually iterates

A miner does not hash the full block from scratch on every attempt. It works with the 80-byte header containing version, the previous-block hash, the Merkle root, timestamp, nBits and nonce. The ASIC changes the nonce, computes double-SHA-256 and compares the result with the target.

When the nonce space is exhausted, the extraNonce in the coinbase transaction is changed. That changes the Merkle root and creates a new search space. A pool distributes different jobs so machines do not repeat each other's work.

  • nonce is a fast counter inside the header
  • extraNonce in coinbase changes the Merkle root
  • time and version can also change in a new template
  • the miner searches the header while the node validates the full block

Target, difficulty and why leading zeros are only shorthand

The success rule is numerical: the resulting hash must be less than or equal to the target. Block explorers often show a long string of leading zeros, but that is only a visual consequence of comparing large numbers. Difficulty describes how small the permitted target is relative to a reference level.

When the network raises difficulty, one hash does not become slower; a SHA-256 ASIC still computes at the same rate. The fraction of successful hashes simply becomes smaller. That is why an individual machine can earn less even when its hashrate and power draw have not changed.

  • target is the maximum accepted numeric hash
  • difficulty changes success probability, not single-hash speed
  • periodic retargeting maintains the target block interval
  • compare J/TH and network conditions, not only TH/s

From CPU to ASIC: why specialization won

Bitcoin mining moved from CPU to GPU, FPGA and finally ASIC. Each transition increased hashes per watt while reducing general-purpose flexibility. A SHA-256 ASIC contains specialized pipelines, a controller, a power system, fans or a liquid loop and a network interface.

A machine's TH/s is not enough. J/TH measures joules per terahash; temperature, frequency, voltage, PSU quality and cooling determine whether the miner can hold its rated result in a real facility.

  • TH/s is computation speed
  • J/TH is energy efficiency
  • frequency and voltage affect stability and draw
  • cooling determines sustained rather than short-term output

How a SHA-256 ASIC works through a mining pool

In solo mining, a machine forms a block and receives the reward only if its block is accepted. In a pool, an operator distributes work through a protocol such as Stratum and miners submit shares, proofs that they are performing work. A share has an easier threshold than a network block and is used to measure contribution.

Pool fee, payout minimum, FPPS/PPS+/PPLNS rules, stale shares and downtime change the realized payout. A calculator must therefore subtract more than electricity: it should account for pool fees and a reserve for downtime. A pool smooths cash flow but does not remove market or technical risk.

  • a share is pool accounting evidence
  • a network block has a much harder target
  • payout scheme and fee change the result
  • stale or rejected shares reveal network or hardware problems

Turning SHA-256 into a real financial calculation

Bitcoin mining starts with expected satoshis for a period, determined by the machine's hashrate, network hashrate, block subsidy and transaction fees. That BTC output is converted using a current or scenario price. Electricity, pool fee, downtime, maintenance, taxes, delivery and capital recovery are then subtracted.

Two identical SHA-256 machines can therefore have different payback in different locations. Tariff, power limits, temperature, outage schedule, repair access and pool terms may matter more than a small difference in advertised hashrate. Check the result in the [MiningView calculator](yak-obraty-asic) and compare it with the guide to [mining electricity](elektryka-v-mayningu).

  • revenue depends on BTC, difficulty and reward
  • costs use actual rather than marketing power
  • 96% uptime materially changes the monthly forecast
  • ROI is a scenario estimate, not a promise

What SHA-256 protects, and what it does not

SHA-256 makes a data change visible: changing a transaction or header changes the hash and breaks the links to later blocks. But hashing alone does not prove that somebody may spend coins. Digital signatures and UTXO validation provide that part of the system.

Proof of Work does not create absolute immutability. It makes rewriting history expensive, while security also depends on network economics, hashrate distribution, full nodes and consensus rules. Understanding that separation helps distinguish technical protection, financial risk and ASIC marketing.

  • SHA-256 protects data-integrity representation
  • a signature proves key control, not profitability
  • Proof of Work raises attack cost
  • no hash guarantees income or eliminates human error

One SHA-256 miner work cycle

An ASIC repeats the same cycle until it finds a hash below target or receives a new job.

TemplateThe pool supplies a header, transactions and work range.
NonceChips change nonce and extraNonce to create candidates.
Double SHA-256The header is hashed twice by specialized pipelines.
CompareThe hash is compared with target and submitted.

The numerical rule the network checks

This is a threshold comparison, not decryption.

SHA256(SHA256(header)) ≤ target
header80 bytes: version, prev hash, Merkle root, time, nBits, nonce
targetThe accepted upper bound encoded by nBits
difficultyA relative measure of how small target is

What belongs to a Bitcoin block header

The miner iterates nonce in this header; the full node validates the complete block after a solution.

VersionRule version and signalling
Prev hashLink to the previous block
Merkle rootFingerprint of all transactions
TimeMiner-declared time
nBitsCompact target encoding
NonceASIC iteration counter
ConceptMeaningPractical effect
SHA-256256-bit cryptographic hash functionSame verification for nodes and ASICs
Double SHA-256SHA-256 applied twiceBitcoin block-header hashing rule
Nonce32-bit header counterFast search space
ExtraNonceCoinbase dataChanges the Merkle root when nonce runs out
TargetMaximum accepted numeric hashDetermines success probability
TH/sTerahashes per secondCandidate-search speed
J/THJoules per terahashASIC efficiency
SharePool proof of workPayout accounting

Real photos and source material

These photographs and diagrams are sourced from public archives. Open the source link to check the author and license.

ASICMINER USB Block Erupter
ASICMINER USB Block ErupterWikimedia Commons; historical ASIC hardware · Wikimedia Commons · View source ↗
Bitcoin block data diagram
Bitcoin block data diagramWikimedia Commons; public explanatory diagram · Wikimedia Commons · View source ↗
Proof-of-work illustration
Proof-of-work illustrationWikimedia Commons; public explanatory diagram · Wikimedia Commons · View source ↗

Want to check the numbers for your ASIC right away?

Open calculator →