1

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.

  • possible duplicate of Eligius pool and 'generated' bitcoins – cdecker Jan 11 '14 at 17:08
  • @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 Jan 11 '14 at 18:22
  • Sure, I'll retract the close flag. – cdecker Jan 11 '14 at 19:44
1

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:

0000000000000000000000000000000000000000000000000000000000000000

An example of such a transaction in JSON format can be found here (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.

0

Okay, found it:

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.