0

In a coinbase transaction, the previous output field is 0000000000000000000000000000000000000000000000000000000000000000ffffffff because there is no previous output, the coins are generated.

If you look at this coinbase transactions raw data: https://blockchain.info/rawtx/04183fe0d461697c043abd156276f14e810c2d250970170ce66debf687223ff6?format=hex

The previous output field comes immediately after the input count field. Normally there should be a 4-byte VOUT field in between. But because there is no previous output, does that mean there is simply no VOUT field?

Is this also the same for transactions which only have 1 previous output?

2 Answers 2

3

The previous output field comes immediately after the input count field. Normally there should be a 4-byte VOUT field in between. But because there is no previous output, does that mean there is simply no VOUT field?

There is; it's the ffffffff in the hex dump you cited. The rules for coinbase transactions are:

  • It must have exactly one transaction input
    • That input must have prevout hash exactly equal to 0000000000000000000000000000000000000000000000000000000000000000
    • That input must have prevout index exactly equal to ffffffff (=232-1, =4294967295).
    • That input must have a scriptSig between 2 and 100 bytes in length.
    • Since BIP34 activation (March 2013), that scriptSig must start with a push of the block height.
1
  • Oh I see. Thanks. I thought the ffffffff was a part of the prevout hash.
    – apchrkey
    Apr 21, 2022 at 15:40
2

When a miner creates a candidate block, the very first space for a transaction is reserved for the coinbase transaction. An input is constitued of this structure :

  • Transaction Id (32 bytes)
  • Vout (4 bytes)
  • Script Sig Size (varInt)
  • Script Sig (Script Sig Size)
  • Sequence (4 bytes)

Regarding the transaction 0x04183fe0d461697c043abd156276f14e810c2d250970170ce66debf687223ff6, it's a coinbase transaction. Every transaction has a VOUT. In your case, this tx has a VOUT equals to 0xffffffff. This is specific to the coinbase transaction with obviously an empty previous transaction id (txId).

For others transactions, the txId is replaced by the previous user's transaction hash and the vout by the output number of this transaction hash in which there's the user's address. These data are stored in UTXO database.

Best regards.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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