A blockchain uses a cryptographic hash function that provides evidence that participants in and users of the blockchain agree on,
The hash has these functions,
A transaction is the pair: list of TxIn's and a list of TxOut's. The transaction proposes the swap of the collection of TxIn's for the collection of TxOut's. Each TxIn points back to a TxOut in a previous transaction, and funds the transaction. Each TxOut gives a value and a lock on the value. The TxIn also has an unlock code that unlocks the the TxOut but only for this transaction.
The TxIn references the TxOut by the hash of the transaction in which it occurs, and its sequential position in the list of TxOut's in that transaction.
The transaction is verified for several things,
A Bitcoin is the collection of unspent (not reference by any TxIn) TxOut's. Also known as UTXO's. When verifying a block, it must be verified that any TxIn references an UTXO.
To mine a block is to find a random number, included in the block header, such that the double hash of the full contents of the block match a numerical criteria. This is a publicly verifiable random coinflip, and it decides who gets to add a block to the blockchain. It is called a proof of work because each coinflip is the calculation of the double SHA256 hash which has a computational cost.
While fanciful in the way gold is coinage and effort is expended to mine gold, or steal it, and hence has value counted in effort; the proof of work consensus depends on the agnosticism of compute cycles. There will be a competition between compute cycles, not miners, as to which miner wins the competition. A miner is unlikely to win without expending a lot of computer cycles, and the solution attests to all that those computer cycles were spent. As long as this miner cannot collude with sufficiently many other miners, if the block is faulty the other miners will ignore it and mine ahead of honest blocks. Then the work of the dishonest block is forfeited (see below about forks for the case of deciding between two honest blocks.)
Another incentive mechanism is that a transaction can yield a profit for the miner that places that transaction in a block and successfully mines it into the block chain. A transaction can include TxIn's whose values sum to more than the sum of the values of the TxOut's. The difference can be claimed in by the miner. (I think this is added to the coinbase transaction. To be checked).
Transactions are proposed to the miner and float in a mempool. Miners collect out transactions and their incentive is to collect up those providing high fees.
The coinbase TxOut is gradually halved over time and will eventually be zero. From that point on, the only incentive will be these fees.
An example of what can go wrong, is that two blocks are mined at about the same time. Assume that otherwise both are valid. It just so happened that two winning blocks occurred at the same time. What happens now is miners choose one block to mine on and extend the chain. Eventually one chain will be (by chance) longer, and miners should mine the larger chain. The transactions on the shorter chain are abandoned. Since they are not on the chain, their TxOut's will not verify in future transactions. The transactions are void, and the miner rewards for the block are void.
An attack on the blockchain risks, if it fails, the waste of effort that certainly was involved in mining the orphaned chain. The correct hash of these blocks, that allowed them to be considered by any honest miner, also attests to an effort. Because the misbehaving miner does not get the block reward, its behavior is not incentivized. Because it cost the misbehaving miner work, its behavior is disincentivized.
author: burton rosenberg
created: 30 Aug 2024
update: 30 Aug 2024