# At which point and how does the miner who successfully solved hash get coins? [duplicate]

When miner creates a valid block he broadcasts that to the network.

It can happen that someone else did the same. So we have half nodes think that chain+A is correct, and other half that it is chain+B. This gets resolved when next block is solved.

1. When are the coins given to the miner, or are they given to both miners?

2. How do the coins get sent to the miner?

3. Does the solved block contain the identity (public address) of the solver so the protocol can send him money? https://en.bitcoin.it/wiki/Block_hashing_algorithm - can't find that address here

EDIT: Now it seems to me that both are rewarded, each inside his respective fork. Something like the reward transaction is put inside that chain-head. When one fork wins the respective reward stays as valid and the other fork is dropped by community. Am I correct?

The truth is that "the point of getting coins" is before the "point of solving block" :)

The miner first creates the coinbase transaction with the reward to himself and tries to solve block after.

• Hahahahahaha. Cool answer. And my edit above is also correct? Oct 21 '17 at 20:48

The block subsidy isn't awarded by anyone. It is taken by the miner, by virtue of creating a block that gives himself money.

The system's role in this is restricted to permitting blocks to indeed contain such an (otherwise unbalanced) payment.

If you have a fork with two branches, then within each branch there will be a payment to some miner. Which one is eventually treated as valuable by the world depends on which of the two gets built on. As far as the system is concerned, there are two possible versions of history, and both are valid. In one of them A gets paid, in the other one B gets paid. At some point, one of the two chains gets longer, and everyone switches to accepting that one.

In order to avoid random forks for flipflopping people's balancea (if they got paid by a block subsidy), bitcoin transaction outputs from coinbase (the type of transaction that credits the subsidy and fees to the mimer), they must be buried by 100 additional blocks before being spent. That is a special rule, called the maturity rule, which only applies to coinbase transactions.