0

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?

2

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

  • 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/… – Rafael Milewski Aug 16 '17 at 0:58
  • 1
    Note that a block must contain exactly one coinbase transaction. It's invalid without one as well. ;) – Murch Aug 30 '17 at 7:20
  • @RafaelMilewski, bitcoin core doesn't currently support coinbasetxn I believe – MeshCollider Aug 30 '17 at 10:09

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.