TeachMeBitcoin

The Coinbase Input: Demystifying the Null Input and Coinbase Script

From TeachMeBitcoin, the free encyclopedia Reading time: 3 min

The Coinbase Input: Demystifying the Null Input and Coinbase Script

A standard Bitcoin transaction must spend one or more existing Unspent Transaction Outputs (UTXOs) by pointing to their previous transaction hashes and indexes. A Coinbase Transaction, however, does not spend any pre-existing coins. Instead, it operates on a unique, consensus-enforced structure called the Null Input.

This guide details the byte-level offsets of this null input and explores the properties of the customizable Coinbase Script field.


1. The Structure of the Null Input

Because the coinbase transaction has no parent UTXO to reference, its single input field (the Outpoint) is filled with a static series of null bytes designed to bypass spending checks:

 THE NULL INPUT OUTPOINT SCHEMA

 Bytes: 0-31 (Prev Outpoint TXID) Bytes: 32-35 (Prev Index)
 ┌─────────────────────────────────────────────────────┬──────────────────────────┐
 │ 0000000000000000000000000000000000000000000000000...│ FFFFFFFF │
 │ 32 Bytes of Zeroes │ 4 Bytes (uint32 Max) │
 └─────────────────────────────────────────────────────┴──────────────────────────┘

Offset Parameters

Any transaction mapping these exact parameters is automatically identified by nodes as a coinbase transaction, disabling typical database lookups for parent outputs.


2. The Custom Coinbase Script (Arbitrary Space)

In a standard transaction input, the signature script field (the scriptSig) is populated with cryptographic signatures and public keys to unlock parent UTXOs.

In a coinbase transaction, since there are no parent script constraints to satisfy, this field has no cryptographic duties. Instead, it is repurposed as the Coinbase Script, providing a flexible workspace of 2 to 100 bytes that miners can populate with arbitrary binary or text data.

Standard Allocations of the Coinbase Script:

  1. Extra Nonce Space: The standard block header only allocates $4\text{ bytes}$ for the Nonce, yielding $4.29\text{ billion}$ possible hashes. Modern ASIC farms can exhaust this range in milliseconds. To bypass this, miners write a variable integer—the Extra Nonce—inside the Coinbase script. Changing the Extra Nonce changes the transaction hash of the coinbase, which alters the block's Merkle Root, instantly refreshing the block header with a brand new, un-exhausted $4.29\text{ billion}$ hash search space!

  2. Pool Tagging: Mining pools write their names or identifier signatures to claim blocks (e.g., "Mined by AntPool", "F2Pool").

  3. Historical Inscriptions: Satoshi Nakamoto famously utilized this custom space in the Genesis block to write a political statement, capturing the network's start date and philosophical rationale:

  4. Satoshi's Genesis Inscription (Hex): hex 5468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73
  5. ASCII Translation: "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks"
☕ Help support TeachMeBitcoin

TeachMeBitcoin is an ad-free, open-source educational repository curated by a passionate team of Bitcoin researchers and educators for public benefit. If you found our articles helpful, please consider supporting our hosting and ongoing content updates with a clean donation:

Ethereum: 0x578417C51783663D8A6A811B3544E1f779D39A85
Bitcoin: bc1q77k9e95rn669kpzyjr8ke9w95zhk7pa5s63qzz
Solana: 4ycT2ayqeMucixj3wS8Ay8Tq9NRDYRPKYbj3UGESyQ4J
Address copied to clipboard!