El enseñar y aprender léxico
4.1. Qué vocabulario enseñar y aprender
So far we have just stated that successful mining creates a generated blockand that it is then added to theblockchain. We have not yet explained what miningis, whyminers are keen to do it and how it can be done successfully. This explanation is going follow here.
Block hashing algorithm If a node decides to start mining bitcoins it executes the following
algorithm:46
1. Harvest from the Network as manytransactions as possible that are so far not part of a generated block in the longest blockchain and are therefore not verified yet.
2. Validate newly harvestedtransactions. Check for inconsistencies in signatures, script and hashes and fordouble-spendingofbitcoins, especially by comparing the timestamps of the inputs of the broadcast transaction with those in the locally stored blockchain
3. Put new validated transactionsinto the current block (and forward them to the peer-to- peerNetwork) and discard invalid transactions
4. Create new hash of all validated transactions47
5. Put the hash of the previousblock (hashPrevBlock), the hash of all current transactions (hashMerkleRoot)48, a timestamp, the current targetand a random number called nonce into what is called the block’s header
6. Hash the current block’s header
7. Compare the just createdhash to thetarget
45see
https://en.bitcoin.it/wiki/Blockchain- accessed July 19th 2014.
46
seehttps://en.bitcoin.it/wiki/Block_hashing_algorithm- accessed July 20th 2014.
47this hash is called hashMerkleRoot, because it is the root of a Merkle hash tree. Merkle trees were mentioned
as an application of cryptographic hashing in3.3and are briefly depicted by Nakamoto (seeNakamoto,2008, pg. 4).
48
By putting just a hash into the block’s header and not all transactions, the time needed for hashing the header is constant, whether the block contains 1 or 1000 transactions.
7.2 Fundamentals 7 BITCOIN
a) If the hash is greater than the target, then start again at step 1., making sure that at least the nonce is incremented and thereby changed to receive a totally different hash for the current block’s header.
b) If the hash is equal to or smaller than the target, proceed to step 8. 8. The minerwas successful.
9. The successfulminerbroadcasts the complete block to theNetworkincluding the successful nonce.
10. Other miners in the Network check the broadcast block by rehashing it with the given values. The approval of a once successfully generated block is simple compared to the mining.
a) If all transactions are valid and do not double-spend and the hashing with the pro- posed nonce yields a hash that is smaller than the target proceed to step 11.
b) If there is any problem with the proposedblock, disregard it and continue with step 1.
11. Other miners express their acceptance of the newlygenerated blockthat was just broadcast to the Network by adding it as the most recent block in their blockchain, too. They are referencing now this newly generated block in the hashPrevBlock field of their current block and start again from step 1 completely updating their current block.
12. The successful miner receives newly createdbitcoinsin acoinbase transactionthat now is part of theblockchain of all approvingminers.
The block hashing algorithm depicted here is based on Nakamoto’s proposition (seeNakamoto,
2008, pg. 4) and on analysis from Hobson (see Hobson,2013, pg. 42) and Nielsen (2013). To further the understanding of entities involved in mining we created a simple object model that is show in figure 17. 1 1..* 1 1..* Blockchain contains all generated Blocks Miners are Nodes that decided to hash the current Block
1
Miners receive Info from the Network and add new Transactions to the Block that is currently hashed
(Block's header is actually hashed) Peer-to-peer Network of Nodes Block contains Transactions If Mining was successful the current Block is added to the Blockchain and broadcast to the Network Verifying the TA adds verified Block
is a 1..* hashes 1 1..* 1 1..* 1..* 1 1 1 is broadcast to :Miner Network :Blockchain :Block :Node :Transaction 1..* 1 creates
Figure 17: Object model showing the relevant objects and their relations involved in thehashing of ablock(bitcoin mining).
7 BITCOIN 7.2 Fundamentals
Creating bitcoins New bitcoins are created as a so called coinbase transaction in every gen-
erated block. Within this transaction the node that generated the block first receives newly created bitcoins. In Bitcoin terminology these additional bitcoins are ‘mined’. The initial re- ward was 50 XBT. Currently (July 2014) it has dropped to 25 XBT per coinbase transaction as can be seen in figure18 that contains a screen shot of the coinbaseof an actualblock, block #312286.
Figure 18: Screenshot of a coinbase transaction, created with ablockexplorer.49
Thecoinbase transaction, rewarding brand newbitcoinsto themineris the incentive to provide computational power, which is obviously required to engage in mining. It is this incentive that should keep malicious miners or attackers from defrauding honest nodes, because instead of cheating they might as well choose to gain from being honest, thereby strengthening the overall health of theblockchain and thereby theNetworkas a total.
Nakamoto puts it this way:
“If a greedy attacker is able to assemble more CPU power than all the honest nodes, he would have to choose between using it to defraud people by stealing back his payments, or using it to generate new coins. He ought to find it more profitable to play by the rules, such rules that favour him with more new coins than everyone else combined, than to undermine the system and the validity of his own wealth.” (see
Nakamoto,2008, pg. 4)
So, to offer an incentive tominers by awarding them new bitcoinsis an important feature of Bitcoin. We might assume that a drop in incentive might result in a drop in the soundness of theNetwork.
Constant rate of generated blocks We have already mentioned the target as a property of
a block. A successful miner needs to create a hash of the current block that is equal to or lower than the target. This target (and thereby also the difficulty) is adjusted by a so called retarget every 201650 generated blocksin such a way that thegeneration of a blockhappens at a constant rate of roughly oneblockevery 10 minutes. This is also the average time it takes for atransaction to be verified once.
Total bitcoin supply The total amount of bitcoins that will ever be mined was determined
by Nakamoto and subsequently by the software development team that currently maintains the standardclientto 21 Millionbitcoins. This effectively means that at some point no new coins are going to be rewarded to successfulminers any more, thereby obviously changing the incentive forminersat the latest at that point in time.
The date of this happening is more than a hundred years away, since the coinbase rewards are halved every 210.000 generated blocks, which at the current rate of one generated block every ten minutes corresponds to roughly 4 years for each bisection of rewards. This leads to an asymptotic approach of the targeted 21 Millionbitcoins that will be never reached. Ceteris paribus mining will stop to create new bitcoins right around 2140, for the very last bisection
50
7.2 Fundamentals 7 BITCOIN
from 0.00000001XBT, or 1satoshiwill drop to 0satoshiwith the completion ofgenerated block #6, 929, 999.51
Transaction fees What is also visible in figure 18 is that additionally to the reward that
created 25 brand new bitcoinsin thecoinbase transaction themineris rewarded - in this case - additional 0.0194147 bitcoin in transaction fees. This is equalling roughly $ 12 at a price of $ 625 perbitcoin, which was the price of the latest trade onhttps://www.bitstamp.net/on July 20th 2014. The fees are paid by the creators of the 132 othertransactionsthat are contained in this very block.52
Incentive for mining after coinbase transactions stop As explained above in the paragraph
on creating bitcoins, mining is critical to confirming transactions and therefore to the overall health of theblockchain and theNetwork, it cannot just stop or even fall dramatically however far away this point in time is, if theNetwork is not supposed to stop at that time, too.
The answer to this pending question are transaction fees that will have to be high enough to keep mining profitable, but low enough to not take away the feature of Bitcoin of being able to offer transactionsat competitive transaction costs for its users. Therefore the sufficient motivation of miners especially after coinbase transactions stop, is a non trivial issue that, if not successfully provided, also might make Bitcoin potentially vulnerable to a revision of the entire blockchain, called a history revision attack (see Barber et al. ,2012, pg. 405). This type of attack on the soundness of theblockchain was in principle already described in this work as the intentional forking of the blockchain. If the incentive forminers however becomes so low to allow a successful ‘doomsday’ history revision attack, then the intentional forking does not only allow for thedouble-spendingof a limited number of bitcoin, but the manipulation of big parts of the entire blockchain is meant. A successful history revision attack of this kind might not only harm single users but could potentially endanger the whole Bitcoinproject .
Ideas on how to potentially prevent this type of attack even thoughminingwill at some point stop to create newbitcoinsas incentive are given by Barber et al. (seeBarber et al. ,2012, pg. 406f.).