# Coinbase transaction

> Every Pearl block starts with a coinbase: a null input, the BIP-34 height, the reward and the witness commitment, decoded from block 130,825.

Source: https://pearlcodex.com/technical/transaction/coinbase/ · Last updated: 2026-10-20 · Checked against Pearl's source code at v1.5.5

The [coinbase](https://pearlcodex.com/glossary/#coinbase) is the transaction a miner writes to pay themselves. It’s always the first transaction in a block, and it’s the only one allowed to create coins out of nothing.

It looks like any other transaction, with three twists: its input points at nothing, its scriptSig carries the block height and whatever else the miner wants, and, in any block with witness data, one of its outputs commits to all the block’s witnesses. Here is a real one, from block 130,825, mined by the Kryptex pool.

## Try it

_Interactive: Transaction decoder. Try it on the page: <https://pearlcodex.com/technical/transaction/coinbase/>_

## What does a coinbase look like?

**Coinbase of block 130,825 · 216 bytes**

```
02000000 00 01 01 0000000000000000000000000000000000000000000000000000000000000000 ffffffff 27 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb ffffffff 02 cc84ce1d34000000 22 5120e31e8032a67b9af27dc279f448c003457bae6c5d28de7ee719bc87b6801ede17 0000000000000000 26 6a24aa21a9ed78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 01 20 0000000000000000000000000000000000000000000000000000000000000000 00000000
```

| Field                                                  | Bytes          | Value                                                                                                                                                                                                          |
| ------------------------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`version`)                                    | 4, offset 0    | 2 · int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.                                                                                                           |
| Marker (`marker`)                                      | 1, offset 4    | 0x00 · Segwit marker (BIP-144): says witness data follows the outputs.                                                                                                                                         |
| Flag (`flag`)                                          | 1, offset 5    | 0x01 · Witness flag; 0x01 is the only value Pearl accepts.                                                                                                                                                     |
| Input count (`vin.length`)                             | 1, offset 6    | 1 · CompactSize number of inputs.                                                                                                                                                                              |
| Previous txid (`vin[0].txid`)                          | 32, offset 7   | 0000000000000000000000000000000000000000000000000000000000000000 · All zeros: this input creates new coins (coinbase).                                                                                         |
| Output index (`vin[0].vout`)                           | 4, offset 39   | 0xffffffff · 0xffffffff together with a zero txid marks a coinbase.                                                                                                                                            |
| scriptSig length (`vin[0].scriptSig.length`)           | 1, offset 43   | 39 · CompactSize length of the scriptSig.                                                                                                                                                                      |
| Coinbase script (`vin[0].scriptSig`)                   | 39, offset 44  | 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb · Coinbase data. It starts with the block height 130825 (BIP-34, required in every Pearl block), then anything the miner likes. |
| Sequence (`vin[0].sequence`)                           | 4, offset 83   | 0xffffffff · Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.                                                                          |
| Output count (`vout.length`)                           | 1, offset 87   | 2 · CompactSize number of outputs.                                                                                                                                                                             |
| Amount (`vout[0].value`)                               | 8, offset 88   | 223,838,373,068 grains (2238.38373068 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                                      |
| Script length (`vout[0].scriptPubKey.length`)          | 1, offset 96   | 34 · CompactSize length of the locking script.                                                                                                                                                                 |
| Locking script (`vout[0].scriptPubKey`)                | 34, offset 97  | prl1puv0gqv4x0wd0ylwz086y3sqrg4a6umza9r08aecehjrmdqq7mctsmqaqsh · OP_1 OP_PUSHBYTES_32 \<output key Q>: a Taproot output.                                                                                      |
| Amount (`vout[1].value`)                               | 8, offset 131  | 0 grains (0.00000000 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                                                       |
| Script length (`vout[1].scriptPubKey.length`)          | 1, offset 139  | 38 · CompactSize length of the locking script.                                                                                                                                                                 |
| Locking script (`vout[1].scriptPubKey`)                | 38, offset 140 | witness commitment 78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 · OP_RETURN aa21a9ed ‖ SHA256d(witness Merkle root ‖ nonce): the BIP-141 witness commitment.                               |
| Witness items (`witness[0].length`)                    | 1, offset 178  | 1 · Number of witness stack items for input 0.                                                                                                                                                                 |
| Witness reserved value length (`witness[0][0].length`) | 1, offset 179  | 32 · CompactSize length of this witness item.                                                                                                                                                                  |
| Witness reserved value (`witness[0][0]`)               | 32, offset 180 | 0000000000000000000000000000000000000000000000000000000000000000 · The coinbase witness is one 32-byte value (the witness-commitment nonce); pearld uses zeros.                                                |
| Locktime (`locktime`)                                  | 4, offset 212  | 0 · 0: no time lock.                                                                                                                                                                                           |

- **txid:** 0a2acb6004406b21252d1578585dec84efd7e7547f1bca19c30c17538c51caa0
- **Size:** 216 bytes · 189 vbytes
- **Block:** 130,825

216 bytes: one input, two outputs (the reward and the witness commitment), and a one-item witness. Its version is 2; pearld’s own template writes 1, but pools may write either.

## How is its input different?

| Field            | Size  | Description                                              |
| ---------------- | ----- | -------------------------------------------------------- |
| txid             | 32    | All zeros: there is no previous transaction.             |
| vout             | 4     | `ffffffff`. With the zero txid, this marks a coinbase.   |
| scriptSig length | 1     | `27` = 39 here. Must be 2 to 100.                        |
| scriptSig        | 2–100 | Starts with the block height (BIP-34); the rest is free. |
| sequence         | 4     | `ffffffff`.                                              |

Only one input like this is allowed, in only one transaction per block, and it must come first.

## What’s in the scriptSig?

- **Size:** 2 to 100 bytes
- **Type:** Free-form, starting with a script-number push
- **Format:** BIP-34 height first

Block 130,825’s 39 bytes, taken apart:

| Bytes                                  | Meaning                                                                                           |
| -------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `03` `09ff01`                          | Push 3 bytes: 0x01ff09 = **130,825**, the [block height](https://pearlcodex.com/glossary/#bip-34) |
| `04` `8393d76a`                        | Push 4 bytes: 0x6ad79383 = 1,792,512,899, the block’s own timestamp                               |
| `2f706f6f6c2e6b7279707465782e636f6d2f` | The text “/pool.kryptex.com/”                                                                     |
| `1550cad31e016e7bf00f2ecb`             | 12 bytes of [extranonce](https://pearlcodex.com/glossary/#extranonce)                             |

Only the first push is checked. It must be the height, in the shortest possible script-number encoding (heights 1 to 16 use the one-byte opcodes OP_1 to OP_16). After that the miner can write anything. The pool tag and extranonce here aren’t even valid script pushes, which is fine: a coinbase scriptSig is never run.

Pearl’s own node writes `<height> <extranonce> "/P2SH/pearld/"`. Block 1’s coinbase is exactly that: `51` (OP_1, height 1), `00` (an extranonce of zero) and a 13-byte push of “/P2SH/pearld/”, a tag inherited from btcd.

> **Note: Why the height?**
>
> Before BIP-34, two coinbases could be byte-for-byte identical and share a txid, which caused real trouble in Bitcoin. Putting the height first makes every coinbase unique. Pearl requires it in every block from block 1.

## How much does it pay?

At most the block subsidy plus the fees of every other transaction in the block. Block 130,825 claims exactly that:

|                                    | Grains                                   |
| ---------------------------------- | ---------------------------------------- |
| Subsidy at height 130,825          | 223,833,660,195                          |
| Fees of the other 114 transactions | 4,712,873                                |
| **Coinbase output 0**              | **223,838,373,068** (2,238.38373068 PRL) |

Pearl’s subsidy shrinks a little with every block on a smooth curve, with no halvings; block 1 paid 3,229.64134063 PRL. The [block reward](https://pearlcodex.com/technical/emission/block-reward/) page has the formula. A miner may claim less (the rest is lost forever), never more.

The reward output must follow the same rule as any output: Taproot, P2MR or OP_RETURN. Here it pays the Taproot address `prl1puv0gqv4x0wd0ylwz086y3sqrg4a6umza9r08aecehjrmdqq7mctsmqaqsh`.

## What is the witness commitment?

The block header’s Merkle root covers txids, which leave witnesses out. So witnesses need their own commitment, and it lives in the coinbase, in an OP_RETURN output:

**Coinbase of block 130,825 · 216 bytes**

```
02000000 00 01 01 0000000000000000000000000000000000000000000000000000000000000000 ffffffff 27 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb ffffffff 02 cc84ce1d34000000 22 5120e31e8032a67b9af27dc279f448c003457bae6c5d28de7ee719bc87b6801ede17 0000000000000000 26 6a24aa21a9ed78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 01 20 0000000000000000000000000000000000000000000000000000000000000000 00000000
```

| Field                                                  | Bytes          | Value                                                                                                                                                                                                          |
| ------------------------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`version`)                                    | 4, offset 0    | 2 · int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.                                                                                                           |
| Marker (`marker`)                                      | 1, offset 4    | 0x00 · Segwit marker (BIP-144): says witness data follows the outputs.                                                                                                                                         |
| Flag (`flag`)                                          | 1, offset 5    | 0x01 · Witness flag; 0x01 is the only value Pearl accepts.                                                                                                                                                     |
| Input count (`vin.length`)                             | 1, offset 6    | 1 · CompactSize number of inputs.                                                                                                                                                                              |
| Previous txid (`vin[0].txid`)                          | 32, offset 7   | 0000000000000000000000000000000000000000000000000000000000000000 · All zeros: this input creates new coins (coinbase).                                                                                         |
| Output index (`vin[0].vout`)                           | 4, offset 39   | 0xffffffff · 0xffffffff together with a zero txid marks a coinbase.                                                                                                                                            |
| scriptSig length (`vin[0].scriptSig.length`)           | 1, offset 43   | 39 · CompactSize length of the scriptSig.                                                                                                                                                                      |
| Coinbase script (`vin[0].scriptSig`)                   | 39, offset 44  | 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb · Coinbase data. It starts with the block height 130825 (BIP-34, required in every Pearl block), then anything the miner likes. |
| Sequence (`vin[0].sequence`)                           | 4, offset 83   | 0xffffffff · Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.                                                                          |
| Output count (`vout.length`)                           | 1, offset 87   | 2 · CompactSize number of outputs.                                                                                                                                                                             |
| Amount (`vout[0].value`)                               | 8, offset 88   | 223,838,373,068 grains (2238.38373068 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                                      |
| Script length (`vout[0].scriptPubKey.length`)          | 1, offset 96   | 34 · CompactSize length of the locking script.                                                                                                                                                                 |
| Locking script (`vout[0].scriptPubKey`)                | 34, offset 97  | prl1puv0gqv4x0wd0ylwz086y3sqrg4a6umza9r08aecehjrmdqq7mctsmqaqsh · OP_1 OP_PUSHBYTES_32 \<output key Q>: a Taproot output.                                                                                      |
| Amount (`vout[1].value`)                               | 8, offset 131  | 0 grains (0.00000000 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                                                       |
| Script length (`vout[1].scriptPubKey.length`)          | 1, offset 139  | 38 · CompactSize length of the locking script.                                                                                                                                                                 |
| Locking script (`vout[1].scriptPubKey`)                | 38, offset 140 | witness commitment 78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 · OP_RETURN aa21a9ed ‖ SHA256d(witness Merkle root ‖ nonce): the BIP-141 witness commitment.                               |
| Witness items (`witness[0].length`)                    | 1, offset 178  | 1 · Number of witness stack items for input 0.                                                                                                                                                                 |
| Witness reserved value length (`witness[0][0].length`) | 1, offset 179  | 32 · CompactSize length of this witness item.                                                                                                                                                                  |
| Witness reserved value (`witness[0][0]`)               | 32, offset 180 | 0000000000000000000000000000000000000000000000000000000000000000 · The coinbase witness is one 32-byte value (the witness-commitment nonce); pearld uses zeros.                                                |
| Locktime (`locktime`)                                  | 4, offset 212  | 0 · 0: no time lock.                                                                                                                                                                                           |

- **txid:** 0a2acb6004406b21252d1578585dec84efd7e7547f1bca19c30c17538c51caa0
- **Size:** 216 bytes · 189 vbytes
- **Block:** 130,825

| Field              | Size | Description                                            |
| ------------------ | ---- | ------------------------------------------------------ |
| amount             | 8    | 0 grains.                                              |
| script length      | 1    | `26` = 38 bytes.                                       |
| OP_RETURN, push 36 | 2    | `6a 24`.                                               |
| tag                | 4    | `aa21a9ed`, which marks a witness commitment.          |
| commitment         | 32   | SHA256d(witness Merkle root ‖ witness reserved value). |

1. **Build a Merkle tree of wtxids**

   Every transaction’s [wtxid](https://pearlcodex.com/technical/transaction/txid/), in block order, except the coinbase, whose own entry counts as 32 zero bytes (it can’t include itself).

2. **Append the witness reserved value**

   The coinbase’s single 32-byte witness item. pearld uses all zeros.

3. **Hash twice**

   SHA256d of those 64 bytes is the commitment. For block 130,825: `78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3`.

Block 1 shows the simplest case. With only the coinbase, the tree is a single zero entry, so the commitment is SHA256d of 64 zero bytes: `e2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9`. That’s exactly what block 1’s coinbase contains.

**Coinbase of block 1 · 193 bytes**

```
01000000 00 01 01 0000000000000000000000000000000000000000000000000000000000000000 ffffffff 10 51000d2f503253482f706561726c642f ffffffff 02 af9829324b000000 22 512054ff8eb1b3102b0f9517d00aa5f3d3c8a6253535c70d44e8fcdd83d0d9b1bf6a 0000000000000000 26 6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9 01 20 0000000000000000000000000000000000000000000000000000000000000000 00000000
```

| Field                                                  | Bytes          | Value                                                                                                                                                                            |
| ------------------------------------------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`version`)                                    | 4, offset 0    | 1 · int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.                                                                             |
| Marker (`marker`)                                      | 1, offset 4    | 0x00 · Segwit marker (BIP-144): says witness data follows the outputs.                                                                                                           |
| Flag (`flag`)                                          | 1, offset 5    | 0x01 · Witness flag; 0x01 is the only value Pearl accepts.                                                                                                                       |
| Input count (`vin.length`)                             | 1, offset 6    | 1 · CompactSize number of inputs.                                                                                                                                                |
| Previous txid (`vin[0].txid`)                          | 32, offset 7   | 0000000000000000000000000000000000000000000000000000000000000000 · All zeros: this input creates new coins (coinbase).                                                           |
| Output index (`vin[0].vout`)                           | 4, offset 39   | 0xffffffff · 0xffffffff together with a zero txid marks a coinbase.                                                                                                              |
| scriptSig length (`vin[0].scriptSig.length`)           | 1, offset 43   | 16 · CompactSize length of the scriptSig.                                                                                                                                        |
| Coinbase script (`vin[0].scriptSig`)                   | 16, offset 44  | 51000d2f503253482f706561726c642f · Coinbase data. It starts with the block height 1 (BIP-34, required in every Pearl block), then anything the miner likes.                      |
| Sequence (`vin[0].sequence`)                           | 4, offset 60   | 0xffffffff · Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.                                            |
| Output count (`vout.length`)                           | 1, offset 64   | 2 · CompactSize number of outputs.                                                                                                                                               |
| Amount (`vout[0].value`)                               | 8, offset 65   | 322,964,134,063 grains (3229.64134063 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                        |
| Script length (`vout[0].scriptPubKey.length`)          | 1, offset 73   | 34 · CompactSize length of the locking script.                                                                                                                                   |
| Locking script (`vout[0].scriptPubKey`)                | 34, offset 74  | prl1p2nlcavdnzq4sl9gh6q92tu7neznz2df4cux5f68umkpapkd3ha4qlknklv · OP_1 OP_PUSHBYTES_32 \<output key Q>: a Taproot output.                                                        |
| Amount (`vout[1].value`)                               | 8, offset 108  | 0 grains (0.00000000 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                         |
| Script length (`vout[1].scriptPubKey.length`)          | 1, offset 116  | 38 · CompactSize length of the locking script.                                                                                                                                   |
| Locking script (`vout[1].scriptPubKey`)                | 38, offset 117 | witness commitment e2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9 · OP_RETURN aa21a9ed ‖ SHA256d(witness Merkle root ‖ nonce): the BIP-141 witness commitment. |
| Witness items (`witness[0].length`)                    | 1, offset 155  | 1 · Number of witness stack items for input 0.                                                                                                                                   |
| Witness reserved value length (`witness[0][0].length`) | 1, offset 156  | 32 · CompactSize length of this witness item.                                                                                                                                    |
| Witness reserved value (`witness[0][0]`)               | 32, offset 157 | 0000000000000000000000000000000000000000000000000000000000000000 · The coinbase witness is one 32-byte value (the witness-commitment nonce); pearld uses zeros.                  |
| Locktime (`locktime`)                                  | 4, offset 189  | 0 · 0: no time lock.                                                                                                                                                             |

- **txid:** 36b18b26fba6b71149951d88904945c64137e74b250de8d76c4beded90560be2
- **Size:** 193 bytes · 166 vbytes
- **Block:** 1

The rules: the commitment output starts `6a24aa21a9ed` and the last such output counts; if present, the coinbase witness must be exactly one 32-byte item; if absent, no transaction in the block may have a witness. Every normal Pearl spend needs a witness, so in practice only coinbase-only blocks can skip it. Some miners do: 8 of 200 recent blocks had a coinbase with no witness and no commitment.

## When can the miner spend it?

After 100 blocks. A coinbase output from block 130,825 can first be spent in block 130,925. If a [reorganization](https://pearlcodex.com/glossary/#reorg) replaces the block, its coinbase vanishes too; the wait makes it very unlikely anyone has spent those coins by then.

## What about the genesis block?

Pearl’s first coinbase is unusual in every way. It’s serialized the old way, with no witness, and its scriptSig is 234 bytes, longer than the 100-byte rule allows (the genesis block is never validated). It starts with `04 ffff001d 01 04`, a copy of the start of Bitcoin’s own genesis coinbase (Bitcoin’s difficulty bits, not Pearl’s), then a 225-byte message that ends with the hash of Bitcoin block 946,842. Its only output pays 0 grains to a bare OP_RETURN, and the code marks it unspendable: Pearl had no premine.

**Show the genesis coinbase**

**The genesis block coinbase · 295 bytes**

```
01000000 01 0000000000000000000000000000000000000000000000000000000000000000 ffffffff ea 04ffff001d01044ce1546865206e61746976652063757272656e637920666f72206d616368696e657320616e642068756d616e732e20546f74616c20322e31653920506561726c732c2043756d756c617469766520656d697373696f6e20682f28682b363530323236292c205754454d4120336d3134732037642c20426974636f696e20626c6f636b20233934363834322077697468204d5450203137373732373035323420697320303030303030303030303030303030303030303033613932323138363165633734313134323764643234663937396662393161336238663732363565316462632e ffffffff 01 0000000000000000 01 6a 00000000
```

| Field                                         | Bytes          | Value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| --------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Version (`version`)                           | 4, offset 0    | 1 · int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Input count (`vin.length`)                    | 1, offset 4    | 1 · CompactSize number of inputs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Previous txid (`vin[0].txid`)                 | 32, offset 5   | 0000000000000000000000000000000000000000000000000000000000000000 · All zeros: this input creates new coins (coinbase).                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Output index (`vin[0].vout`)                  | 4, offset 37   | 0xffffffff · 0xffffffff together with a zero txid marks a coinbase.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| scriptSig length (`vin[0].scriptSig.length`)  | 1, offset 41   | 234 · CompactSize length of the scriptSig.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Coinbase script (`vin[0].scriptSig`)          | 234, offset 42 | 04ffff001d01044ce1546865206e61746976652063757272656e637920666f72206d616368696e657320616e642068756d616e732e20546f74616c20322e31653920506561726c732c2043756d756c617469766520656d697373696f6e20682f28682b363530323236292c205754454d4120336d3134732037642c20426974636f696e20626c6f636b20233934363834322077697468204d5450203137373732373035323420697320303030303030303030303030303030303030303033613932323138363165633734313134323764643234663937396662393161336238663732363565316462632e · Coinbase data: starts with the block height (BIP-34), then anything the miner likes (2-100 bytes). |
| Sequence (`vin[0].sequence`)                  | 4, offset 276  | 0xffffffff · Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Output count (`vout.length`)                  | 1, offset 280  | 1 · CompactSize number of outputs.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| Amount (`vout[0].value`)                      | 8, offset 281  | 0 grains (0.00000000 PRL) · int64 little-endian, in grains (1 PRL = 100,000,000 grains).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Script length (`vout[0].scriptPubKey.length`) | 1, offset 289  | 1 · CompactSize length of the locking script.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Locking script (`vout[0].scriptPubKey`)       | 1, offset 290  | OP_RETURN data (unspendable) · OP_RETURN data carrier: provably unspendable, never enters the UTXO set.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| Locktime (`locktime`)                         | 4, offset 291  | 0 · 0: no time lock.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |

- **txid:** 302f59c6f1239648bd38eddf16b22acc8c8df3c96de2e4f552bd2f38371675c1
- **Size:** 295 bytes · 295 vbytes
- **Block:** 0

> **Note: Merged mining tags**
>
> The scriptSig’s free space is also used for merged mining. Block 130,792’s coinbase carries the text “NOCKCHAIN-AI-POW-AUX” plus 32 bytes, a third output `OP_RETURN "NAC*"` plus 32 bytes, and splits the reward 99% / 1% between two Taproot outputs. Pearl’s rules don’t care, as long as the height comes first and the outputs are valid.

> **Pearl vs Bitcoin**
>
> - **Same structure and rules:** null input, BIP-34 height, 2–100-byte scriptSig, BIP-141 witness commitment, 100-block maturity. All active from block 1.
> - **Different reward:** a subsidy that shrinks every block on a smooth curve, not halvings every 210,000 blocks.
> - **Stricter outputs:** coinbase outputs must be Taproot, P2MR or OP_RETURN, like every other output.

## In short

- The coinbase is the first transaction of every block. Its one input points at nothing (32 zero bytes, index ffffffff); its outputs pay the miner.
- Its scriptSig, 2 to 100 bytes, must start with the block height (BIP-34). The rest is free: pools put timestamps, tags and extranonces there.
- It may claim at most the block subsidy plus the block’s fees. Block 130,825’s coinbase claims exactly that: 223,838,373,068 grains.
- When the block has witness data, an extra OP_RETURN output commits to every wtxid: 6a24aa21a9ed followed by SHA256d(witness root ‖ the coinbase’s 32-byte witness value).
- Coinbase outputs can’t be spent for 100 blocks, and they too must be Taproot, P2MR or OP_RETURN.

## Read the code

- [CheckSerializedHeight: the BIP-34 height](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/validate.go#L564-L651) `node/blockchain/validate.go:564-651`
- [Coinbase scriptSig must be 2 to 100 bytes](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/validate.go#L279-L287) `node/blockchain/validate.go:279-287`
- [Validating the witness commitment](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/merkle.go#L196-L297) `node/blockchain/merkle.go:196-297`
- [pearld's coinbase template: height, extranonce, "/P2SH/pearld/"](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/mining/mining.go#L205-L260) `node/mining/mining.go:205-260`
- [CalcBlockSubsidy: the smooth emission curve](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/validate.go#L160-L191) `node/blockchain/validate.go:160-191`
- [The genesis coinbase is unspendable](https://github.com/pearl-research-labs/pearl/blob/v1.5.5/node/blockchain/validate.go#L1005-L1008) `node/blockchain/validate.go:1005-1008`

## Sources

### Bitcoin standards

- [BIP-34: Block v2, height in coinbase](https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki)
- [BIP-141: Segregated witness (the witness commitment)](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki)

### Chain data

- [Block 130,825 coinbase 0a2acb60…caa0 on Pearl's explorer](https://explorer.pearlresearch.ai/tx/0a2acb6004406b21252d1578585dec84efd7e7547f1bca19c30c17538c51caa0)
