> For the complete documentation index, see [llms.txt](https://protocol.bsvblockchain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://protocol.bsvblockchain.org/node-operations/mining-software.md).

# Mining Software

Mining performs the proof-of-work search and is largely decoupled from the rest of the node software. The [block assembler](/node-operations/block-assembler.md) supplies a mining candidate — the candidate block and its header — and the mining process searches for a solution.

<figure><img src="/files/JSmbocpNmhDXmdWWyLHr" alt=""><figcaption></figcaption></figure>

The 80-byte block header is hashed with double SHA-256 (SHA256D) and the result is compared against the target. If the hash is less than or equal to the target, a solution is found. Otherwise the nonce is incremented and the header is hashed again; when the nonce space is exhausted, the extra-nonce field in the coinbase is changed to alter the header. This repeats until a solution is found.

<figure><img src="/files/inZFmeCYHTgfmKkbr4YX" alt=""><figcaption></figcaption></figure>

When a solution is found it is passed back to the block assembler, which informs [ChainTracker](/node-operations/chaintracker.md) and [BSN](/node-operations/bitcoin-server-network-bsn.md) so the new block is propagated. Other nodes validate it and, on success, extend it as the new tip. See [blocks.md](/bsv-blockchain/blocks.md).

## Invalid Blocks

A node rejects a block that fails validation. Reasons include:

* The block violates a consensus rule (e.g. exceeds the size limit).
* The coinbase awards more than the allowed subsidy plus fees.
* The block contains an invalid transaction.
* The block has an invalid proof-of-work.
* The block has an invalid timestamp.

## Orphan Blocks

When two nodes find a solution at nearly the same time, the network briefly holds more than one candidate tip. The fork resolves when the next block is found on one of them, making it the longest valid chain. The block on the abandoned tip is orphaned. Nodes always build on the longest valid chain, so each node must stay aware of what the network has accepted.
