<p>Let me clarify the response from kaoD for future reference. The generation transaction is a transaction with exactly 1 input, whose prevOut hash is null:</p>

<pre><code>0000000000000000000000000000000000000000000000000000000000000000
</code></pre>

<p>An example of such a transaction in JSON format can be found <a href="http://blockexplorer.com/rawtx/7dea68bf5b470747c1d821ac6e223e0d8ad611f51ddba0de4977834d3aedda02" rel="nofollow">here</a> (blockchain.info is no use here as it does not conform the JSON output of <code>bitcoind</code>). Notice that besides this, the Satoshi client also puts the coinbase transaction in first position in the <code>tx</code> array, I wouldn't trust this too much though as it may well change in future and may not be consistent across clients.</p>

CC BY-SA 3.0
2014-01-11T19:50:30.363Z
2014-01-11T19:50:30.363Z
cdecker
<p>Okay, <a href="https://bitcoin.stackexchange.com/questions/209/eligius-pool-and-generated-bitcoins">found it</a>:</p>

<blockquote>
  <p>In main.h, function IsCoinBase(): return (vin.size() == 1 &amp;&amp; vin[0].prevout.IsNull());</p>
</blockquote>

CC BY-SA 3.0
2014-01-11T06:58:57.893Z
2014-01-11T06:58:57.893Z
kaoD
<p>I'm implementing my own blockchain reader but I'm stuck validating transactions.</p>

<p>I can validate a common transaction checking the UTXO and executing both scripts, but... how do I validate generation transactions? AFAIK there's no flag that lets me detect generation so I can ignore the input.</p>

CC BY-SA 3.0
2014-01-11T17:08:11.487Z
possible duplicate of [Eligius pool and 'generated' bitcoins](http://bitcoin.stackexchange.com/questions/209/eligius-pool-and-generated-bitcoins)
cdecker
CC BY-SA 3.0
2014-01-11T18:22:17.733Z
@cdecker IMHO it's not a duplicate, even if the answer overlaps. That question asks *what* are generated transactions, this one asks *how* to detect them. Different questions. I'd keep this one for reference.
kaoD
CC BY-SA 3.0
2014-01-11T19:44:03.713Z
Sure, I'll retract the close flag.
cdecker
<transactions><blockchain>
Detecting generation transactions
kaoD
# Detecting generation transactions

(Asked by: username_0 on 2014-01-11)

I'm implementing my own blockchain reader but I'm stuck validating transactions.

I can validate a common transaction checking the UTXO and executing both scripts, but... how do I validate generation transactions? AFAIK there's no flag that lets me detect generation so I can ignore the input.

**Tags:** transactions, blockchain

> **Comments:**
> **username_1**: possible duplicate of [Eligius pool and 'generated' bitcoins](http://bitcoin.stackexchange.com/questions/209/eligius-pool-and-generated-bitcoins)  
> **username_0**: @username_1 IMHO it's not a duplicate, even if the answer overlaps. That question asks *what* are generated transactions, this one asks *how* to detect them. Different questions. I'd keep this one for reference.  
> **username_1**: Sure, I'll retract the close flag.  

---

## 2 answers

### Answer by username_1 on 2014-01-11. Score: 1 | Accepted answer

Let me clarify the response from username_0 for future reference. The generation transaction is a transaction with exactly 1 input, whose prevOut hash is null:

```
0000000000000000000000000000000000000000000000000000000000000000

```

An example of such a transaction in JSON format can be found [here](http://blockexplorer.com/rawtx/7dea68bf5b470747c1d821ac6e223e0d8ad611f51ddba0de4977834d3aedda02) (blockchain.info is no use here as it does not conform the JSON output of `bitcoind`). Notice that besides this, the Satoshi client also puts the coinbase transaction in first position in the `tx` array, I wouldn't trust this too much though as it may well change in future and may not be consistent across clients.


---

### Answer by username_0 on 2014-01-11. Score: 0

Okay, [found it](https://bitcoin.stackexchange.com/questions/209/eligius-pool-and-generated-bitcoins):

> In main.h, function IsCoinBase(): return (vin.size() == 1 && vin[0].prevout.IsNull());


---

