2

After getting the getblocktemplate, hashing it, finding a solution and generating the proper message to submit to the blockchain, if i ever solve a block how does the network knows it was me and properly give the reward to my wallet?

i heard somewhere that i need to append a transaction sending 12.5 BTC to myself before generating the message, if that is true what does prevent anyone of generating more than one transaction and append before solving a block?

Does getblocktemplate coming from my bitcoin-cli already generates this transaction for me?

1

1 Answer 1

3

A miner will create a special type of transaction known as a Coinbase transaction, as the first transaction in the block. This special transaction pays the block reward (including transaction fees) to the miner (or anyone they choose). But the miner can only put one, valid coinbase transaction in a block because otherwise the block as a whole would be invalid, and all the full nodes would reject it, making the miners work wasted because the block doesn't get onto the valid blockchain and they receive nothing. So miners are forced to play by the rules.

And yes, getblocktemplate includes the coinbase transaction if coinbasetxn is included in the capabilities list

3
  • thats right however sending coinbasetxn as noted here in the documentation doesnt seens to generate it to me on the result any idea why? github.com/bitcoin/bips/blob/master/… Aug 16, 2017 at 0:58
  • 1
    Note that a block must contain exactly one coinbase transaction. It's invalid without one as well. ;)
    – Murch
    Aug 30, 2017 at 7:20
  • @RafaelMilewski, bitcoin core doesn't currently support coinbasetxn I believe Aug 30, 2017 at 10:09

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.