Mining Job
A mining job is a work unit assigned by a pool to a miner, containing the data needed to search for a valid block.
Key Takeaways
- A mining job is the bundle of data a mining pool sends to a miner: it includes the previous block hash, coinbase transaction template, Merkle branches, block version, difficulty target, and timestamp, giving the miner everything needed to search for a valid block hash.
- Each job carries a unique ID that miners reference when submitting shares. When a new block appears on the network, the pool issues a fresh job and invalidates old ones, making any work on stale jobs wasted hashrate.
- The structure of a mining job differs between Stratum v1 (pool constructs the full template) and Stratum v2 (miners can build their own block template via the Job Declaration Protocol).
What Is a Mining Job?
A mining job is a unit of work that a mining pool assigns to a miner. It contains all the information the miner needs to construct a candidate block header and begin searching for a nonce that produces a hash below the current difficulty target. Without a valid job, a miner has nothing to hash against.
In pool-based mining, the pool operates a full node, selects transactions from the mempool, and packages them into a block template. It then distills that template into a compact job message and distributes it to every connected miner. The miner's role is to iterate over nonce values as fast as possible, submitting any results that meet the pool's share difficulty as proof of work performed.
How It Works
The lifecycle of a mining job follows a request-response pattern between pool and miner. Under the widely deployed Stratum v1 protocol, the pool pushes jobs to miners via the mining.notify message.
Job Fields
A Stratum v1 mining.notify message contains nine parameters that together define a complete job:
{
"method": "mining.notify",
"params": [
"job_id", // Unique identifier for this job
"prevhash", // Previous block hash (hex, word-reversed)
"coinb1", // Coinbase transaction prefix (before extranonce)
"coinb2", // Coinbase transaction suffix (after extranonce)
"merkle_branch", // Array of Merkle tree hashes
"version", // Block version (big-endian hex)
"nbits", // Encoded difficulty target
"ntime", // Current block timestamp
true // clean_jobs: discard previous jobs?
]
}The prevhash field tells the miner which chain tip to build on. The coinb1 and coinb2 fields are the two halves of the coinbase transaction, split around a slot where the miner inserts its extranonce values. The merkle_branch array lets the miner compute the Merkle root without needing the full transaction list. Finally, nbits encodes the difficulty target that determines whether a hash qualifies as a valid block.
Constructing a Block Header
Once a miner receives a job, it assembles a candidate block header through the following steps:
- Concatenate
coinb1+extranonce1(assigned at session start) +extranonce2(miner-chosen) +coinb2to form the complete coinbase transaction - Double-SHA-256 hash the coinbase transaction to get the coinbase hash
- Iteratively hash the coinbase hash with each entry in
merkle_branchto compute the Merkle root - Assemble the 80-byte block header:
version+prevhash+ Merkle root +ntime+nbits+ nonce - Hash the header with double-SHA-256 and check if the result is below the share difficulty target
If the nonce space (2^32 values) is exhausted without finding a valid share, the miner increments extranonce2 and rebuilds the Merkle root, effectively creating a new search space without waiting for a new job from the pool.
Submitting Shares
When a miner finds a nonce that produces a hash meeting the pool's share difficulty, it sends a mining.submit message referencing the job:
{
"method": "mining.submit",
"params": [
"worker_name", // Authorized worker identity
"job_id", // Links this share to a specific job
"extranonce2", // The extranonce2 value used
"ntime", // Timestamp used in the header
"nonce" // The winning nonce value
]
}The job_id field is critical: it tells the pool exactly which job produced this share. The pool reconstructs the block header from the submitted parameters and its own stored job data, then verifies the hash independently. If the hash also meets the network difficulty, the pool broadcasts the block to the Bitcoin network.
The clean_jobs Flag
The boolean clean_jobs parameter in mining.notify controls whether the miner should discard all previous jobs. When set to true, the pool signals that a new block has been found on the network and the previous chain tip is no longer valid. Any shares submitted against old job IDs will be rejected.
When clean_jobs is false, the new job is simply an updated template (perhaps with new transactions or an adjusted timestamp), and miners may continue working on prior jobs as well. This distinction matters for miners managing multiple ASIC devices: a clean_jobs=true notification triggers an immediate flush of all in-progress work across every device.
Stratum v1 vs. Stratum v2 Jobs
The structure and control flow of mining jobs changed significantly with Stratum v2. Under v1, the pool has full control: it selects transactions, builds the block template, and the miner is a pure hash-grinding machine. This creates a centralization concern because a small number of pool operators decide which transactions enter blocks.
Stratum v1 Jobs
- Pool constructs the entire block template and sends a compact job via JSON-RPC over unencrypted TCP
- Miner can only vary the nonce, extranonce2, ntime, and (with BIP 310) version bits
- Miner has no visibility into which transactions the pool selected
- Job updates require polling or waiting for
mining.notifypushes
Stratum v2 Jobs
- Uses compact binary encoding instead of JSON-RPC, with mandatory encryption via the Noise Protocol Framework
- Splits the v1
mining.notifyinto two messages:NewExtendedMiningJobandSetNewPrevHash, allowing template data and block tip updates to arrive independently - Introduces the Job Declaration Protocol, which lets miners run their own node, select transactions, and declare custom templates to the pool
- Pool validates the coinbase output but cannot censor individual transactions chosen by the miner
This shift has major implications for mining centralization. When miners can construct their own jobs, no single pool operator controls transaction selection for a large share of network hashrate. For a deeper analysis, see the research article on Stratum v2 and mining decentralization.
Use Cases
Pool-Based Mining
The most common use of mining jobs is standard pool mining. A mining pool distributes jobs to thousands of connected ASIC miners, collects shares, and distributes rewards proportionally. The job abstraction lets the pool coordinate work across miners with different hashrates and hardware capabilities while ensuring no two miners search the same nonce space (each gets a unique extranonce1).
Solo Mining via Pool Software
Solo miners running pool software (such as getblocktemplate or a local Stratum proxy) also use mining jobs internally. The software fetches a block template from the local node, converts it into a Stratum job, and feeds it to the miner hardware. If the miner finds a hash meeting the full network difficulty, the software broadcasts the block directly.
Firmware and Hashboard Optimization
Modern ASIC firmware uses job parameters to optimize chip utilization. Features like AsicBoost manipulate the version field within the job to reduce the number of SHA-256 computations per hash, improving energy efficiency. The job structure must support version rolling for these optimizations to work.
Risks and Considerations
Stale Jobs and Wasted Hashrate
The time between a new block being found and the miner receiving an updated job is a window of wasted work. Any shares computed against an outdated prevhash are stale and earn no credit. Network latency, pool processing time, and miner firmware response time all contribute to this stale rate.
Large mining operations invest heavily in low-latency connections to pools and fast job-switching firmware to minimize stale shares. Even fractions of a percent in stale rate translate to significant revenue loss at scale. The introduction of compact blocks and improved block propagation techniques has reduced network-wide stale rates to below 0.1%.
Template Centralization
Under Stratum v1, the pool decides which transactions go into every job it distributes. Because a handful of pools control the majority of network hashrate, this means a small number of operators effectively control block space allocation. This creates risks around transaction censorship and regulatory pressure on pool operators. The block template centralization research article explores this issue in depth.
Job Complexity and Firmware Bugs
Edge cases in job handling can cause problems. When a mining.set_difficulty message arrives between two mining.notify messages, some firmware implementations mishandle the transition, submitting shares at the wrong difficulty or silently dropping the new job. Interleaved clean_jobs=false updates with difficulty changes are a known source of rejected shares on certain ASIC models.
Extranonce Exhaustion
The extranonce2 field has a fixed size (typically 4 bytes, giving 2^32 possible values). Combined with the 4-byte nonce, this yields 2^64 possible hashes per job before the search space is fully exhausted. At extremely high hashrates, miners may need new jobs more frequently to avoid re-searching the same space. Pools handle this by adjusting extranonce sizes or pushing fresh jobs at regular intervals.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.