What is a coinbase transaction?
How coinbase transactions are structured
Coinbase transactions are structured as the first transaction in a block, where the miner includes a newly minted amount of BTC as a reward for their effort in solving a complex mathematical problem to validate transactions and create a new block on the blockchain.
Coinbase transactions have a special format. Compared to a regular transaction input, a coinbase transaction has a different set of values that do not represent unspent transaction output (UTXO).
As such, in place of a transaction hash, a coinbase transaction will have 32 bytes, all set to zero. The output index is also filled with 4 bytes, all set to 0xFF (255 decimal places).
What is a transaction value and customizable text property in a coinbase transaction
The coinbase transaction’s value is based on factors such as each individual transaction’s value, block height, and halving. Miners can add any customizable text to the blocks they have created.
The value of a coinbase transaction is determined by several factors. These include the value of every transaction validated by the block, the height of the block (number of transactions) and the halving relative to the block. Once the block has reached 100 confirmations, the miner can use the BTC.
When a block is created, it holds approximately 100 bytes of data. There is also an allocation for miners to include any text they prefer. Nakamoto, for instance, wrote the following message when they mined Bitcoin’s genesis block:
This message is a reference to a headline in the British newspaper The Times from Jan. 3, 2009, and is often seen as a commentary on the state of the global financial system at the time of Bitcoin’s creation.
Nakamoto chose to embed this message in the genesis block to emphasize the need for a decentralized and trustless system of transactions, free from the influence of central authorities and intermediaries.
Moreover, miners can add any information they choose to personalize the block, sending an unalterable message in perpetuity.
What is fork-prevention in a coinbase transaction
Coinbase transactions help to prevent forks by including special rules for their creation and validation.
Blockchains like Bitcoin are open-source and rely on communities to maintain and develop their code. As such, an event like a fork will cause the chain to split and produce a second blockchain. This blockchain will contain all of its history while heading off in a new direction.
In such a circumstance, a miner can create as much BTC as they want if the new blockchain does not have the rule of maturity in place, thereby working against Bitcoin’s halving algorithm that seeks to preserve the cryptocurrency’s scarcity.
What is a coinbase maturity rule
The coinbase maturity rule governs when the block reward from a coinbase transaction can be spent.
The BTC involved in the coinbase transaction cannot be spent until the block has received at least 100 block confirmations on the blockchain. Unlike regular Bitcoin transactions that contain data showing the movement of BTC from one wallet to another, coinbase transactions contain data concerning the generation of a new currency that has not yet been spent.
For this reason, the input in these transactions remains blank. Structurally, therefore, coinbase transactions can also be thought of as single blank inputs. The maturity rule was put in place to protect the blockchain from forks, which are events that happen when a community decides to implement changes to the blockchain’s protocol or set of rules.
What are block rewards and Bitcoin halving
Block rewards are the rewards received by miners for mining new blocks and adding them to the blockchain. The Bitcoin halving reduces the block reward by 50% approximately every four years.
Miners are responsible for creating blocks on proof-of-work (PoW) blockchains like Bitcoin. In return, they are rewarded with BTC after the successful creation of each block. The block reward depends on two things: the number of fees included in the transactions of each block and the number of blocks from the genesis block.
During the early days of Bitcoin, the block reward was 50 BTC per block, and this reward is included in the coinbase transaction. Due to the Bitcoin halving, however, the block reward is reduced by half after every 210,000 blocks mined. Bitcoin’s halving occurs approximately every four years.
The block subsidy that is distributed by the coinbase transaction is 6.25 BTC per block (per the latest halving). And because coinbase transactions create new coins, it is valid without any inputs, as the BTC it contains is newly created and not previously spent.
For example, the Blockstream coinbase transaction in block 650,000 has no inputs, and the single output is the amount of 6.25 BTC in addition to the miner’s 0.244131 BTC of fees collected.
How does a coinbase transaction work
Coinbase transactions have unique features, including maturity, fork prevention and customizable texts. They also have a different structure than other transactions.
On the Bitcoin blockchain, all transactions executed on-chain are combined to form one block. When a block is formed, it will immediately be added to the blockchain. These blocks are immutable and tamper-proof owing to the Bitcoin blockchain’s near-perfect code. Each block should contain one or more transactions, the first of which is always called a coinbase transaction.
Here's how a coinbase transaction works:
Block creation: To earn the block reward after creating a new block, a miner must first create a coinbase transaction.Inputs: A coinbase transaction has no inputs, in contrast to a typical transaction, which makes use of inputs from earlier transactions. A coinbase transaction instead generates brand-new coins out of thin air.Outputs: The coinbase transaction has one or more outputs that list the addresses to which the block reward will be sent. Miners have the option to distribute the block reward to other addresses.Block reward: The block reward is currently BTC, and it is halved approximately every 210,000 blocks. This reward is paid to the miner who verifies and adds the transactions to the blockchain.Mining fee: Miners can also include a mining fee in the coinbase transaction, which is paid by the transaction creators to incentivize miners to include their transactions in the next block.A miner can include a coinbase transaction, along with other transactions, in the block they have mined and broadcast that block to the network after creating it. The block is then examined by other miners, and if approved, it is uploaded to the blockchain and paid for by the block reward plus any associated mining fees.
Some key features of coinbase transactions are discussed below.
What are coinbase transactions
Not to be confused with the cryptocurrency exchange Coinbase, the term “coinbase transaction” refers to a particular type of transaction that occurs in every new block of a blockchain.
Coinbase transactions are a key part of the system that blockchains utilize to introduce new currencies that have never been sent into circulation. The first coinbase transaction was generated by Bitcoin’s (BTC) pseudonymous creator, Satoshi Nakamoto, while mining the first genesis block. The coinbase was reportedly paid to the Bitcoin address “1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa” with a value of 50 BTC.
One of the biggest curiosities of the Bitcoin blockchain is that the said block was never confirmed on the blockchain — something that has puzzled many blockchain scientists and developers.
One theory is that this occurred because the first-ever coinbase transaction was encoded in the genesis block’s source code. And because the entire blockchain is built on this genesis block, the concept of confirmation was not applied to it.
Another theory suggests that Nakamoto designed it this way since, if the genesis block were to get unconfirmed for any reason, it would cause a new blockchain to be built, making the original blockchain obsolete.
The coinbase transaction is also used to reward miners for maintaining the blockchain. They are paid a certain amount of coins for each block they mine. This rewards system creates an incentive for miners and helps keep the blockchain secure by deterring malicious behaviors that could destabilize the network.