How can a coinbase transaction be created and what would happen if there was more than one coinbase transaction in a block?
The current bitcoin system does not allow to create a block with two coinbase transactions. The rules are described here. So a player against the system would need to craft such a block manually, which would get rejected, and eventually the node would get banned.
Hint: as his is a basic question of how bitcoin works, I recommend to read the technical articles on bitcoin.org, as well as the article on protocol specification in the link. And on top Andreas‘ book „Mastering Bitcoin“ gives a deep insight into the bitcoin world. It is also online available, in many languages. Highly recommended!
Coinbase Transactoin is created after new block is minned in blockchain. Its the first transaction happen in any block and the transaction is minning reward(12.5 btc+fee) as per now. When new block is minned particular amount of bitcoin is generated as minning reward and to make those btc come in existance it need to be assigned to some address. That address is generated within the block and minning reward is stored on that address which is known as coinbase transaction.
The address the coinbase coins are sent to does not "need to be generated in the block". It can be any valid bitcoin address, including a previously used one. Mar 23, 2018 at 12:48
Any valid address doesnt men "any valid address will work", you should have access to the pvt key of the address, so for that obviusly the address has to be generated and ones address is generated and you have access to its pvt key you can use the same address multiple times as well Mar 24, 2018 at 22:02
You can absolutely send the coins to an address for which no private key is known. You don't need access to the private key to send coins to it. Mar 24, 2018 at 22:10
ohhh wow i didnt know this, how can we do that i am looking forward to try it,any reference? Mar 24, 2018 at 22:11
It's known as "burning" coins. Essentially, you can send them to a Bitcoin address that you provably don't have the private key for. One such example is 1CounterpartyXXXXXXXXXXXXXXXUWLpVr, which was used for the initial counterparty burn. You can read up on en.bitcoin.it/wiki/Proof_of_burn for why burning is a thing Mar 24, 2018 at 22:17