Coinbase Field (Arbitrary Data)
The input data field in a coinbase transaction that miners can fill with arbitrary content, used for block height, pool identification, and messages.
Key Takeaways
- The coinbase field is the scriptSig of the coinbase transaction's sole input, a 2-to-100-byte space that miners can fill with arbitrary data because the input does not reference any previous output.
- Since BIP-34, the coinbase field must begin with the encoded block height, but the remaining bytes are free for mining pool identification, extraNonce values, and even human-readable messages.
- The extraNonce stored in the coinbase field is critical for modern ASIC mining: because the 4-byte header nonce can be exhausted in under a millisecond, miners iterate the extraNonce to generate fresh hash search space.
What Is the Coinbase Field?
The coinbase field is the scriptSig (input script) of the coinbase transaction, the special first transaction in every Bitcoin block that creates new coins. Unlike regular transaction inputs that reference and unlock a previous output using a signature, the coinbase transaction's input has no previous output to spend. Its "previous transaction hash" is set to all zeros and its output index to 0xFFFFFFFF, leaving the scriptSig free for miners to fill with whatever data they choose.
This field must be between 2 and 100 bytes. Within that constraint, miners embed block height data (required by consensus since BIP-34), pool identification tags, extraNonce values for expanding the mining search space, and occasionally human-readable messages. The genesis block's coinbase field famously contained a newspaper headline: a tradition of embedding messages that continues to this day.
How It Works
Every Bitcoin block begins with exactly one coinbase transaction. That transaction has a single input whose scriptSig is the coinbase field. Because there is no previous output to satisfy, the usual script validation rules do not apply. Instead, the network enforces only two rules on this field:
- The scriptSig must be between 2 and 100 bytes in length
- The first bytes must encode the current block height as a serialized CScript number (required since BIP-34 activation at block 227,931)
Any bytes remaining after the block height are entirely at the miner's discretion. In practice, miners and pools divide this space among several purposes.
BIP-34: Block Height Encoding
Before BIP-34, coinbase transactions across different blocks could be identical, creating potential transaction ID collisions. BIP-34 (activated on mainnet in March 2013 at block 227,931) solved this by requiring the block height as the first item in the coinbase scriptSig.
The height is encoded as a CScript push: a length byte followed by the height in little-endian format. For current block heights (which fit in three bytes), the encoding starts with 0x03 followed by three bytes of height data. This format will accommodate blocks up to height 8,388,607: sufficient for approximately the next 150 years at current block intervals.
# Block height encoding example (block 840,000)
# 840,000 in hex = 0x0CD140
# Little-endian: 40 D1 0C
# CScript push: 03 40 D1 0C
scriptSig: 03 40 D1 0C [extraNonce] [pool tag] [optional data]ExtraNonce: Expanding the Search Space
The block header contains a 4-byte (32-bit) nonce field, providing roughly 4.3 billion possible values. Modern ASIC miners operating at tens or hundreds of terahashes per second exhaust this entire range in under one millisecond.
To continue searching for a valid block hash, miners modify an extraNonce value stored in the coinbase field. Changing even a single byte in the coinbase transaction alters its transaction ID, which cascades through the Merkle tree, producing an entirely new Merkle root in the block header. This gives the miner a fresh 232 nonce range to iterate. The process of cycling through extraNonce values effectively gives miners an unbounded search space.
Pool Mining and the Stratum Protocol
In pool mining via the Stratum protocol (v1), the pool operator constructs a coinbase transaction template and splits it into two halves around the extraNonce region:
coinbase1 | extraNonce1 | extraNonce2 | coinbase2
coinbase1: Pool-controlled prefix (block height, pool tag)
extraNonce1: Server-assigned, unique per connected miner
extraNonce2: Iterated locally by the miner's hardware
coinbase2: Pool-controlled suffix (output script, etc.)The server-assigned extraNonce1 partitions the search space so that no two miners in the pool duplicate work. Each miner independently iterates extraNonce2 and the header nonce, covering a large portion of the hash space before requesting new work. In Stratum v2, version rolling (BIP-320) combined with header nonce and nTime rolling provides additional search space, reducing reliance on frequent coinbase modifications.
Famous Coinbase Messages
Because the coinbase field accepts arbitrary data, it has become an indelible message board written into Bitcoin's blockchain. Several coinbase messages have become part of Bitcoin's cultural history.
The Genesis Block
The most famous coinbase message is Satoshi Nakamoto's inscription in the genesis block (block 0):
The Times 03/Jan/2009 Chancellor on brink of second bailout for banksThis headline from The Times of London served two purposes: it timestamped the genesis block to prove it was not pre-mined before January 3, 2009, and it offered commentary on the financial system that motivated Bitcoin's creation.
Halving Celebrations
Miners have continued the tradition at significant milestones. At the third halving (block 629,999, May 2020), F2Pool embedded a New York Times headline echoing Satoshi's style:
NYTimes 09/Apr/2020 With $2.3T Injection, Fed's Plan Far Exceeds 2008 RescueThe parallel between Satoshi's original message about bank bailouts and this pandemic-era headline about unprecedented monetary stimulus was deliberate: a reminder of why Bitcoin exists.
Pool Identification Tags
Mining pools routinely embed ASCII identification strings in the coinbase field. Tags like /Foundry USA Pool/, /ViaBTC/, and /AntPool/ allow block explorers and analytics services to attribute blocks to specific pools. These tags are voluntary: there is no protocol requirement to include them, but most pools do for branding and transparency.
Use Cases
- Consensus-required block height: BIP-34 uses the coinbase field to enforce unique transaction IDs across blocks, preventing TXID collisions that could confuse wallet software and block explorers
- Mining work distribution: the extraNonce mechanism allows pools to partition hash search space across thousands of connected miners without any two duplicating work
- Pool attribution: embedded ASCII tags let anyone verify which pool mined a block, enabling hashrate distribution analysis and decentralization monitoring
- Timestamped messages: because blockchain data is immutable, coinbase messages serve as permanent, timestamped records: useful for proofs of existence, political statements, and cultural milestones
- Signaling: miners have used coinbase strings to signal support for soft fork proposals and protocol upgrades during activation periods
Risks and Considerations
Limited Space
At 100 bytes maximum, the coinbase field is tightly constrained. After accounting for block height encoding (4 bytes at current heights) and extraNonce space (typically 4 to 8 bytes), only 88 to 92 bytes remain for pool tags and other data. Pools must balance identification, extraNonce size, and any additional data within this budget.
No Consensus on Content
Beyond the BIP-34 block height requirement, there is no standard governing what miners put in the coinbase field. Pool tags are voluntary and can be spoofed: a malicious miner could embed another pool's tag. Block attribution based solely on coinbase strings should be cross-referenced with payout address analysis for accuracy.
Permanent Data Storage
Data written to the coinbase field is stored permanently on every full node. While individual entries are small (under 100 bytes), this permanence means inappropriate or illegal content embedded in coinbase fields cannot be removed. Unlike OP_RETURN outputs, which can be pruned, coinbase scriptSig data is part of the transaction input and must be retained by all non-pruning nodes.
ExtraNonce Security Implications
The extraNonce mechanism is essential for mining viability. If the coinbase field were eliminated or significantly reduced in size, modern ASICs would lack sufficient search space to mine efficiently. Any protocol changes affecting the coinbase transaction must preserve adequate room for extraNonce iteration: a constraint that influences mining economics and hardware design.
Coinbase Field vs. OP_RETURN
Both the coinbase field and OP_RETURN allow embedding data in Bitcoin transactions, but they serve different purposes:
| Property | Coinbase Field | OP_RETURN |
|---|---|---|
| Who can use it | Only the miner of the block | Anyone creating a transaction |
| Maximum size | 100 bytes | 80 bytes per output |
| Location | Transaction input (scriptSig) | Transaction output (scriptPubKey) |
| Prunable | No | Yes (provably unspendable) |
| Cost | Free for the miner | Requires a transaction fee |
Why It Matters
The coinbase field sits at the intersection of Bitcoin's consensus rules, mining infrastructure, and cultural history. It is a critical piece of the Bitcoin transaction lifecycle: every block relies on it for unique transaction identification (via BIP-34), and every mining operation depends on it for extraNonce search space. For developers building on Bitcoin layer-2 protocols like Spark, understanding the coinbase field provides insight into how on-chain block production works and why miners structure transactions the way they do.
The coinbase field also demonstrates a broader principle in Bitcoin's design: even tightly constrained protocol spaces find creative uses. From Satoshi's newspaper headline to modern pool tagging systems, the coinbase field shows how a simple 100-byte space can serve consensus, infrastructure, and communication purposes simultaneously.
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.