Need to know what are coinbase transaction type in transaction and components related to that

Hi @diwaker,

I was checking the transactions array using below API:

https://stacks-node-api.mainnet.stacks.co/extended/v1/address/SP3MKRB8AGZ1FTNCJAPWE13D7R4AD8CDDTRCVHS4V/transactions?limit=50

and was having some questions which i could not get clear answers in the documentation:

  1. Generally in Bitcoin blockchain, there is only one (first) transaction which is marked as coinbase transactions but in the above block i can see more than 150 transactions which are marked as “Coinbase”. Can you explain the significance of these?
  2. In most coinbase transactions, we can see “coinbase_payload” as 0. What does it mean and its significance?
  3. I found in documentation that there are 5 transaction types:“coinbase” “token_transfer” “smart_contract” “contract_call” “poison_microblock”. For “coinbase” and “token_transfer” , i found that if these transactions types are there - we need to look for “coinbase_payload” & “token_transfer” : amount. But i could not find a block where other 3 transaction types are there.

Can you please help me understand the meaning of these transactions and also what are the keys i should look for when these transactions occur.

Generally in Bitcoin blockchain, there is only one (first) transaction which is marked as coinbase transactions but in the above block i can see more than 150 transactions which are marked as “Coinbase”. Can you explain the significance of these?

The query above returns all of the transactions sent from SP3MK…VHS4V. This address “sent” coinbase transactions because it has mined blocks – those coinbase transactions are the coinbases from the blocks it mined.

In most coinbase transactions, we can see “coinbase_payload” as 0. What does it mean and its significance?

The coinbase wire format gives miners 32 bytes of “scratch area” to store whatever information they’d like. This isn’t used right now, but it’s meant for storing in-band signaling like votes for activating new features via soft-forks.

I found in documentation that there are 5 transaction types:“coinbase” “token_transfer” “smart_contract” “contract_call” “poison_microblock”. For “coinbase” and “token_transfer” , i found that if these transactions types are there - we need to look for “coinbase_payload” & “token_transfer” : amount. But i could not find a block where other 3 transaction types are there.

If you look on the block explorer (explorer.stacks.co), you can filter the chain’s transaction history by “smart_contract” or “contract_call” transactions – there’s lots of them. But, I don’t think anyone’s sent a “poison_microblock” transaction yet, because no one has produced a forked microblock stream.

The meaning of the types is listed in a table here: Transactions | Stacks

Hey @jude, Thanks a lot for quick reply. To clarify my understanding , i am posting my comments below. Please respond when you can.

If i understand correctly, does it mean that these transactions are the mining fee which it might have paid for mining each block? I was actually wondering that if this address is sending those coinbase payloads… who is receiving them?

Ok. So does it mean that in Stacks 2.0 - users do not get STACKS tokens as miner reward but they get a scratch area to store some kind of info/doc or anything which they’d like to store? I thought there should be some way to find the STACKS token which they might have earned as a result of successful mining. Is it not applicable in case of STACKS?

I was actually wondering that if this address is sending those coinbase payloads… who is receiving them?

No – the sender is rewarded the coinbase and transaction fees. Also, this is documented here: sips/sip-005-blocks-and-transactions.md at main · stacksgov/sips · GitHub

So does it mean that in Stacks 2.0 - users do not get STACKS tokens as miner reward but they get a scratch area to store some kind of info/doc or anything which they’d like to store?

No, miners get the reward, not users. Miners can put whatever they want into the coinbase scratch area. The amount of STX miners receive is not encoded in the coinbase transaction; it is derived from the block reward schedule (derived from the Stacks block height) and fees of the block’s constituent transactions and confirmed microblock transactions (see the above link for details).