1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2024-11-25 17:38:26 +00:00

Edited ch12_mining.adoc with Atlas code editor

This commit is contained in:
clenser 2023-10-28 18:40:43 +00:00
parent 0e02f1ea88
commit e0bde9f1c1

View File

@ -1,7 +1,7 @@
[[mining]] [[mining]]
== Mining and Consensus == Mining and Consensus
The ((("mining", "purpose of")))((("bitcoins", "mining", "purpose of")))word "mining" is somewhat The ((("mining", "purpose of")))word "mining" is somewhat
misleading. By evoking the extraction of precious metals, it focuses our misleading. By evoking the extraction of precious metals, it focuses our
attention on the reward for mining, the new bitcoins created in each attention on the reward for mining, the new bitcoins created in each
block. Although mining is incentivized by this reward, the primary block. Although mining is incentivized by this reward, the primary
@ -27,7 +27,7 @@ Mining
is one of the mechanisms by which Bitcoin's _consensus security_ is _decentralized_. is one of the mechanisms by which Bitcoin's _consensus security_ is _decentralized_.
==== ====
Miners ((("bitcoins", "mining", "operational overview", id="bitcoin-mining-overview")))((("mining", "operational overview", id="mining-overview")))record new transactions on the global blockchain. A Miners ((("mining", "operational overview", id="mining-overview")))record new transactions on the global blockchain. A
new block, containing transactions that occurred since the last block, new block, containing transactions that occurred since the last block,
is _mined_ every 10 minutes on average, thereby adding those is _mined_ every 10 minutes on average, thereby adding those
transactions to the blockchain. Transactions that become part of a block transactions to the blockchain. Transactions that become part of a block
@ -94,7 +94,7 @@ decentralized consensus mechanism that underpins Bitcoin's security.
To understand mining and consensus, we will track Alice's transaction To understand mining and consensus, we will track Alice's transaction
as it is received and added to a block by Jing's mining equipment. Then as it is received and added to a block by Jing's mining equipment. Then
we will follow the block as it is mined, added to the blockchain, and we will follow the block as it is mined, added to the blockchain, and
accepted by the Bitcoin network through the process of ((("bitcoins", "mining", "operational overview", startref="bitcoin-mining-overview")))((("mining", "operational overview", startref="mining-overview")))emergent accepted by the Bitcoin network through the process of ((("mining", "operational overview", startref="mining-overview")))emergent
consensus. consensus.
=== Bitcoin Economics and Currency Creation === Bitcoin Economics and Currency Creation
@ -201,7 +201,7 @@ outweighs the risks of((("Bitcoin", "economics of", startref="bitcoin-economics"
=== Decentralized Consensus === Decentralized Consensus
In the ((("bitcoins", "mining", "decentralized consensus", id="bitcoin-mining-consensus")))((("mining", "decentralized consensus", id="mining-consensus")))((("decentralized consensus", id="decentral-consensus")))((("emergent consensus", id="emergent-consensus")))((("consensus", see="decentralized consensus")))previous chapter we looked at the In the ((("mining", "decentralized consensus", id="mining-consensus")))((("decentralized consensus", id="decentral-consensus")))((("emergent consensus", id="emergent-consensus")))((("consensus", see="decentralized consensus")))previous chapter we looked at the
blockchain, the global list of all transactions, which blockchain, the global list of all transactions, which
everyone in the Bitcoin network accepts as the authoritative record of everyone in the Bitcoin network accepts as the authoritative record of
ownership transfers. ownership transfers.
@ -248,13 +248,13 @@ processes that occur independently on nodes across the network:
In the next few sections, we will examine these processes and how they In the next few sections, we will examine these processes and how they
interact to create the emergent property of network-wide consensus that interact to create the emergent property of network-wide consensus that
allows any Bitcoin node to assemble its own copy of the authoritative, allows any Bitcoin node to assemble its own copy of the authoritative,
trusted, public, global ((("bitcoins", "mining", "decentralized consensus", startref="bitcoin-mining-consensus")))((("mining", "decentralized consensus", startref="mining-consensus")))((("decentralized consensus", startref="decentral-consensus")))((("emergent consensus", startref="emergent-consensus")))blockchain. trusted, public, global ((("mining", "decentralized consensus", startref="mining-consensus")))((("decentralized consensus", startref="decentral-consensus")))((("emergent consensus", startref="emergent-consensus")))blockchain.
[[tx_verification]] [[tx_verification]]
=== Independent Verification of Transactions === Independent Verification of Transactions
In In
<<c_transactions>>, we saw ((("bitcoins", "mining", "independent transaction verification", id="bitcoin-mining-verify")))((("mining", "independent transaction verification", id="mining-verify")))((("transactions", "independent verification", id="transaction-verify")))((("independent transaction verification", id="independent-transaction-verify")))((("verifying", "transactions", id="verify-transaction")))((("nodes", "transaction verification", id="node-verify")))how wallet software creates transactions by <<c_transactions>>, we saw ((("mining", "independent transaction verification", id="mining-verify")))((("transactions", "independent verification", id="transaction-verify")))((("independent transaction verification", id="independent-transaction-verify")))((("verifying", "transactions", id="verify-transaction")))((("nodes", "transaction verification", id="node-verify")))how wallet software creates transactions by
collecting UTXOs, providing the appropriate authentication data, and then collecting UTXOs, providing the appropriate authentication data, and then
constructing new outputs assigned to a new owner. The resulting constructing new outputs assigned to a new owner. The resulting
transaction is then sent to the neighboring nodes in the Bitcoin network transaction is then sent to the neighboring nodes in the Bitcoin network
@ -303,12 +303,12 @@ address new types of denial-of-service attacks.
By independently verifying each transaction as it is received and before By independently verifying each transaction as it is received and before
propagating it, every node builds a pool of valid (but unconfirmed) propagating it, every node builds a pool of valid (but unconfirmed)
transactions known ((("bitcoins", "mining", "independent transaction verification", startref="bitcoin-mining-verify")))((("mining", "independent transaction verification", startref="mining-verify")))((("transactions", "independent verification", startref="transaction-verify")))((("independent transaction verification", startref="independent-transaction-verify")))((("verifying", "transactions", startref="verify-transaction")))((("nodes", "transaction verification", startref="node-verify")))((("memory pool")))as the _memory pool_ or transactions known ((("mining", "independent transaction verification", startref="mining-verify")))((("transactions", "independent verification", startref="transaction-verify")))((("independent transaction verification", startref="independent-transaction-verify")))((("verifying", "transactions", startref="verify-transaction")))((("nodes", "transaction verification", startref="node-verify")))((("memory pool")))as the _memory pool_ or
_mempool_. _mempool_.
=== Mining Nodes === Mining Nodes
Some of the((("bitcoins", "mining", "miners, purpose of", id="bitcoin-mining-miner-purpose")))((("mining", "miner nodes, purpose of", id="mining-nodes-purpose")))((("nodes", "miner nodes", "purpose of", id="nodes-miner-purpose"))) nodes on the Bitcoin network are specialized nodes Some of the((("mining", "miner nodes, purpose of", id="mining-nodes-purpose")))((("nodes", "miner nodes", "purpose of", id="nodes-miner-purpose"))) nodes on the Bitcoin network are specialized nodes
called _miners_. Jing is a called _miners_. Jing is a
Bitcoin miner; he Bitcoin miner; he
earns bitcoin by running a "mining rig," which is a specialized earns bitcoin by running a "mining rig," which is a specialized
@ -351,7 +351,7 @@ finding a solution according to the proof-of-work algorithm.
When Jing's node aggregates all the transactions from the memory pool, When Jing's node aggregates all the transactions from the memory pool,
the new candidate block has several thousand transactions that each pay the new candidate block has several thousand transactions that each pay
transaction fees he'll attempt to((("bitcoins", "mining", "miners, purpose of", startref="bitcoin-mining-miner-purpose")))((("mining", "miner nodes, purpose of", startref="mining-nodes-purpose")))((("nodes", "miner nodes", "purpose of", startref="nodes-miner-purpose"))) claim. transaction fees he'll attempt to((("mining", "miner nodes, purpose of", startref="mining-nodes-purpose")))((("nodes", "miner nodes", "purpose of", startref="nodes-miner-purpose"))) claim.
==== The Coinbase Transaction ==== The Coinbase Transaction
@ -572,7 +572,7 @@ version field set to 2 or higher) must contain the block height as a script
=== Constructing the Block Header === Constructing the Block Header
To To
construct ((("bitcoins", "mining", "constructing block header", id="bitcoin-mining-blockheader")))((("mining", "constructing block header", id="mining-blockheader")))((("nodes", "miner nodes", "constructing block header", id="nodes-miner-blockheader")))((("block header", "constructing", id="block-header-construct")))the block header, the mining node needs to fill in six fields, construct ((("mining", "constructing block header", id="mining-blockheader")))((("nodes", "miner nodes", "constructing block header", id="nodes-miner-blockheader")))((("block header", "constructing", id="block-header-construct")))the block header, the mining node needs to fill in six fields,
as listed in <<block_header_structure_ch10>>. as listed in <<block_header_structure_ch10>>.
++++ ++++
@ -694,13 +694,13 @@ With all the other fields filled, the header of the candidate block is now compl
the process of mining can begin. The goal is now to find a header the process of mining can begin. The goal is now to find a header
that results in a hash that is less than the target. that results in a hash that is less than the target.
The mining node will need to test billions or trillions of variations of The mining node will need to test billions or trillions of variations of
the header before a version is found that satisfies the((("bitcoins", "mining", "constructing block header", startref="bitcoin-mining-blockheader")))((("mining", "constructing block header", startref="mining-blockheader")))((("nodes", "miner nodes", "constructing block header", startref="nodes-miner-blockheader")))((("block header", "constructing", startref="block-header-construct"))) requirement. the header before a version is found that satisfies the((("mining", "constructing block header", startref="mining-blockheader")))((("nodes", "miner nodes", "constructing block header", startref="nodes-miner-blockheader")))((("block header", "constructing", startref="block-header-construct"))) requirement.
[role="less_space pagebreak-before"] [role="less_space pagebreak-before"]
=== Mining the Block === Mining the Block
Now Now
that((("candidate blocks", "mining", id="candidate-mine")))((("blocks", "candidate blocks", "mining", id="block-candidate-mine")))((("mining", "candidate blocks", id="mining-candidate")))((("bitcoins", "mining", "candidate blocks", id="bitcoin-mining-candidate"))) a candidate block has been constructed by Jing's node, it is time that((("candidate blocks", "mining", id="candidate-mine")))((("blocks", "candidate blocks", "mining", id="block-candidate-mine")))((("mining", "candidate blocks", id="mining-candidate"))) a candidate block has been constructed by Jing's node, it is time
for Jing's hardware mining rig to "mine" the block, to find a solution for Jing's hardware mining rig to "mine" the block, to find a solution
to the proof-of-work algorithm that makes the block valid. Throughout to the proof-of-work algorithm that makes the block valid. Throughout
this book we have studied cryptographic hash functions as used in this book we have studied cryptographic hash functions as used in
@ -718,7 +718,7 @@ until the desired hash result appears by chance.
==== Proof-of-Work Algorithm ==== Proof-of-Work Algorithm
A hash((("bitcoins", "mining", "proof-of-work algorithm", id="bitcoin-mining-proof")))((("mining", "proof-of-work algorithm", id="mining-proof")))((("hash functions", "proof-of-work algorithm", id="hash-proof")))((("proof-of-work algorithm", id="proof-mining"))) algorithm takes an A hash((("mining", "proof-of-work algorithm", id="mining-proof")))((("hash functions", "proof-of-work algorithm", id="hash-proof")))((("proof-of-work algorithm", id="proof-mining"))) algorithm takes an
arbitrary-length data input and produces a fixed-length deterministic arbitrary-length data input and produces a fixed-length deterministic
result, called a _digest_. The digest is a digital commitment to the result, called a _digest_. The digest is a digital commitment to the
input. For any specific input, the resulting digest will always be the input. For any specific input, the resulting digest will always be the
@ -859,7 +859,7 @@ enough block header hash.
//TODO:use visual representation like I did on bitcoin.org //TODO:use visual representation like I did on bitcoin.org
Block headers ((("bitcoins", "mining", "proof-of-work algorithm", startref="bitcoin-mining-proof")))((("mining", "proof-of-work algorithm", startref="mining-proof")))((("hash functions", "proof-of-work algorithm", startref="hash-proof")))((("proof-of-work algorithm", startref="proof-mining")))((("bitcoins", "mining", "target representation", id="bitcoin-mining-target")))((("mining", "target representation", id="mining-target")))((("targets", "representation of", id="target-represent")))((("proof-of-work algorithm", "target representation", id="proof-target")))contain the target in a notation called "target Block headers ((("mining", "proof-of-work algorithm", startref="mining-proof")))((("hash functions", "proof-of-work algorithm", startref="hash-proof")))((("proof-of-work algorithm", startref="proof-mining")))((("mining", "target representation", id="mining-target")))((("targets", "representation of", id="target-represent")))((("proof-of-work algorithm", "target representation", id="proof-target")))contain the target in a notation called "target
bits" or just "bits," which in block 277,316 has the value of bits" or just "bits," which in block 277,316 has the value of
+0x1903a30c+. This notation expresses the proof-of-work target as a +0x1903a30c+. This notation expresses the proof-of-work target as a
coefficient/exponent format, with the first two hexadecimal digits for coefficient/exponent format, with the first two hexadecimal digits for
@ -905,12 +905,12 @@ header hash less than the target. In binary that number must
have more than 60 leading bits set to zero. With this level of have more than 60 leading bits set to zero. With this level of
difficulty, a single miner processing 1 trillion hashes per second (1 difficulty, a single miner processing 1 trillion hashes per second (1
terahash per second or 1 TH/sec) would only find a solution once every terahash per second or 1 TH/sec) would only find a solution once every
8,496 blocks or once every 59 days, ((("bitcoins", "mining", "target representation", startref="bitcoin-mining-target")))((("mining", "target representation", startref="mining-target")))((("targets", "representation of", startref="target-represent")))((("proof-of-work algorithm", "target representation", startref="proof-target")))on average. 8,496 blocks or once every 59 days, ((("mining", "target representation", startref="mining-target")))((("targets", "representation of", startref="target-represent")))((("proof-of-work algorithm", "target representation", startref="proof-target")))on average.
[[target]] [[target]]
==== Retargeting to Adjust Difficulty ==== Retargeting to Adjust Difficulty
As we saw, ((("bitcoins", "mining", "adjusting difficulty", id="bitcoin-mining-difficulty")))((("mining", "adjusting difficulty", id="mining-difficulty")))((("targets", "adjusting difficulty", id="target-difficulty")))((("proof-of-work algorithm", "adjusting difficulty", id="proof-difficulty")))((("difficulty", "adjusting", id="difficulty-adjust")))the target determines the difficulty and As we saw, ((("mining", "adjusting difficulty", id="mining-difficulty")))((("targets", "adjusting difficulty", id="target-difficulty")))((("proof-of-work algorithm", "adjusting difficulty", id="proof-difficulty")))((("difficulty", "adjusting", id="difficulty-adjust")))the target determines the difficulty and
therefore affects how long it takes to find a solution to the therefore affects how long it takes to find a solution to the
proof-of-work algorithm. This leads to the obvious questions: Why is the proof-of-work algorithm. This leads to the obvious questions: Why is the
difficulty adjustable, who adjusts it, and how? difficulty adjustable, who adjusts it, and how?
@ -1013,13 +1013,13 @@ possible with the current generation of silicon fabrication, converting
electricity into hashing computation at the highest rate possible. The electricity into hashing computation at the highest rate possible. The
primary influence on the mining market is the price of one kilowatt-hour primary influence on the mining market is the price of one kilowatt-hour
of electricity in bitcoin because that determines the profitability of of electricity in bitcoin because that determines the profitability of
mining and therefore the incentives to enter or exit the ((("bitcoins", "mining", "adjusting difficulty", startref="bitcoin-mining-difficulty")))((("mining", "adjusting difficulty", startref="mining-difficulty")))((("targets", "adjusting difficulty", startref="target-difficulty")))((("proof-of-work algorithm", "adjusting difficulty", startref="proof-difficulty")))((("difficulty", "adjusting", startref="difficulty-adjust")))mining mining and therefore the incentives to enter or exit the ((("mining", "adjusting difficulty", startref="mining-difficulty")))((("targets", "adjusting difficulty", startref="target-difficulty")))((("proof-of-work algorithm", "adjusting difficulty", startref="proof-difficulty")))((("difficulty", "adjusting", startref="difficulty-adjust")))mining
market. market.
[[mtp]] [[mtp]]
=== Median Time Past (MTP) === Median Time Past (MTP)
In Bitcoin ((("decentralized consensus", "timestamps and", id="decentral-consensus-timestamp")))((("consensus rules", "timestamps and", id="consensus-timestamp")))((("timestamps", id="timestamp")))((("median time past (MTP)", id="median-time-past")))((("bitcoins", "mining", "timestamps", id="bitcoin-mining-timestamps")))((("mining", "timestamps", id="mining-timestamps")))there is a subtle, but very In Bitcoin ((("decentralized consensus", "timestamps and", id="decentral-consensus-timestamp")))((("consensus rules", "timestamps and", id="consensus-timestamp")))((("timestamps", id="timestamp")))((("median time past (MTP)", id="median-time-past")))((("mining", "timestamps", id="mining-timestamps")))there is a subtle, but very
significant, difference between wall time and consensus time. Bitcoin is significant, difference between wall time and consensus time. Bitcoin is
a decentralized network, which means that each participant has his or a decentralized network, which means that each participant has his or
her own perspective of time. Events on the network do not occur her own perspective of time. Events on the network do not occur
@ -1071,7 +1071,7 @@ MTP changes the implementation of time calculations for
lock time, +CLTV+, sequence, and +CSV+. The consensus time lock time, +CLTV+, sequence, and +CSV+. The consensus time
calculated by MTP is usually about one hour behind calculated by MTP is usually about one hour behind
wall clock time. If you create timelock transactions, you should account wall clock time. If you create timelock transactions, you should account
for it when estimating the desired value to encode ((("decentralized consensus", "timestamps and", startref="decentral-consensus-timestamp")))((("consensus rules", "timestamps and", startref="consensus-timestamp")))((("timestamps", startref="timestamp")))((("median time past (MTP)", startref="median-time-past")))((("bitcoins", "mining", "timestamps", startref="bitcoin-mining-timestamps")))((("mining", "timestamps", startref="mining-timestamps")))in lock time, for it when estimating the desired value to encode ((("decentralized consensus", "timestamps and", startref="decentral-consensus-timestamp")))((("consensus rules", "timestamps and", startref="consensus-timestamp")))((("timestamps", startref="timestamp")))((("median time past (MTP)", startref="median-time-past")))((("mining", "timestamps", startref="mining-timestamps")))in lock time,
sequence, +CLTV+, and +CSV+. sequence, +CLTV+, and +CSV+.
=== Successfully Mining the Block === Successfully Mining the Block
@ -1107,7 +1107,7 @@ a block at the same height and immediately start computing the next
block in the chain, using Jing's block as the "parent." By building on block in the chain, using Jing's block as the "parent." By building on
top of Jing's newly discovered block, the other miners are essentially top of Jing's newly discovered block, the other miners are essentially
using their mining power to endorse Jing's block and the using their mining power to endorse Jing's block and the
chain((("candidate blocks", "mining", startref="candidate-mine")))((("blocks", "candidate blocks", "mining", startref="block-candidate-mine")))((("mining", "candidate blocks", startref="mining-candidate")))((("bitcoins", "mining", "candidate blocks", startref="bitcoin-mining-candidate"))) it extends. chain((("candidate blocks", "mining", startref="candidate-mine")))((("blocks", "candidate blocks", "mining", startref="block-candidate-mine")))((("mining", "candidate blocks", startref="mining-candidate"))) it extends.
In the next section, we'll look at the process each node uses to In the next section, we'll look at the process each node uses to
validate a block and select the most-work chain, creating the consensus validate a block and select the most-work chain, creating the consensus
@ -1115,7 +1115,7 @@ that forms the decentralized blockchain.
=== Validating a New Block === Validating a New Block
The third ((("bitcoins", "mining", "validating blocks", id="bitcoin-mining-validate")))((("mining", "validating blocks", id="mining-validate")))((("blocks", "validating", id="block-validate")))((("validating", "blocks", id="validate-block")))((("decentralized consensus", "validating blocks", id="decentral-consensus-validate")))((("nodes", "validating blocks", id="nodes-validate")))step in Bitcoin's The third ((("mining", "validating blocks", id="mining-validate")))((("blocks", "validating", id="block-validate")))((("validating", "blocks", id="validate-block")))((("decentralized consensus", "validating blocks", id="decentral-consensus-validate")))((("nodes", "validating blocks", id="nodes-validate")))step in Bitcoin's
consensus mechanism is independent validation of each new block by every consensus mechanism is independent validation of each new block by every
node on the network. As the newly solved block moves across the network, node on the network. As the newly solved block moves across the network,
each node performs a series of tests to validate it. each node performs a series of tests to validate it.
@ -1159,14 +1159,14 @@ The miners have to construct a block, based on the shared rules
that all nodes follow, and mine it with a correct solution to the that all nodes follow, and mine it with a correct solution to the
PoW. To do so, they expend a lot of electricity in mining, and PoW. To do so, they expend a lot of electricity in mining, and
if they cheat, all the electricity and effort is wasted. This is why if they cheat, all the electricity and effort is wasted. This is why
independent validation is a key component of ((("bitcoins", "mining", "validating blocks", startref="bitcoin-mining-validate")))((("mining", "validating blocks", startref="mining-validate")))((("blocks", "validating", startref="block-validate")))((("validating", "blocks", startref="validate-block")))((("decentralized consensus", "validating blocks", startref="decentral-consensus-validate")))((("nodes", "validating blocks", startref="nodes-validate")))decentralized consensus. independent validation is a key component of ((("mining", "validating blocks", startref="mining-validate")))((("blocks", "validating", startref="block-validate")))((("validating", "blocks", startref="validate-block")))((("decentralized consensus", "validating blocks", startref="decentral-consensus-validate")))((("nodes", "validating blocks", startref="nodes-validate")))decentralized consensus.
//FIXME:normalize terminology between "block-finding race", "mining //FIXME:normalize terminology between "block-finding race", "mining
//race", and "forks" //race", and "forks"
[[forks]] [[forks]]
=== Assembling and Selecting Chains of Blocks === Assembling and Selecting Chains of Blocks
The final ((("bitcoins", "mining", "assembling blockchain", id="bitcoin-mining-assemble")))((("mining", "assembling blockchain", id="mining-assemble")))((("blockchain", "assembling", id="blockchain-assemble")))((("decentralized consensus", "assembling blockchain", id="decentral-consensus-assemble")))part in Bitcoin's decentralized The final ((("mining", "assembling blockchain", id="mining-assemble")))((("blockchain", "assembling", id="blockchain-assemble")))((("decentralized consensus", "assembling blockchain", id="decentral-consensus-assemble")))part in Bitcoin's decentralized
consensus mechanism is the assembly of blocks into chains and the consensus mechanism is the assembly of blocks into chains and the
selection of the chain with the most proof of work. selection of the chain with the most proof of work.
@ -1237,14 +1237,14 @@ security, you'd prefer a system with 1-minute blocks, where you could
wait for three blocks, over a system with 10-minute blocks. The shorter wait for three blocks, over a system with 10-minute blocks. The shorter
the time between blocks, the more miner work is wasted on accidental the time between blocks, the more miner work is wasted on accidental
forks (in addition to other problems), so many people prefer Bitcoin's forks (in addition to other problems), so many people prefer Bitcoin's
10-minute blocks over shorter block ((("bitcoins", "mining", "assembling blockchain", startref="bitcoin-mining-assemble")))((("mining", "assembling blockchain", startref="mining-assemble")))((("blockchain", "assembling", startref="blockchain-assemble")))((("decentralized consensus", "assembling blockchain", startref="decentral-consensus-assemble")))intervals. 10-minute blocks over shorter block ((("mining", "assembling blockchain", startref="mining-assemble")))((("blockchain", "assembling", startref="blockchain-assemble")))((("decentralized consensus", "assembling blockchain", startref="decentral-consensus-assemble")))intervals.
==== ====
=== Mining and the Hash Lottery === Mining and the Hash Lottery
Bitcoin mining ((("bitcoins", "mining", "competitiveness of", id="bitcoin-mining-competition")))((("mining", "competitiveness of", id="mining-competitive")))is an extremely competitive industry. Bitcoin mining ((("mining", "competitiveness of", id="mining-competitive")))is an extremely competitive industry.
The hashing power has increased exponentially every year of Bitcoin's The hashing power has increased exponentially every year of Bitcoin's
existence. Some years the growth has reflected a complete change of existence. Some years the growth has reflected a complete change of
technology, such as in 2010 and 2011 when many miners switched from technology, such as in 2010 and 2011 when many miners switched from
@ -1265,7 +1265,7 @@ a rapid pace.
[[extra_nonce]] [[extra_nonce]]
==== The Extra Nonce Solution ==== The Extra Nonce Solution
Since 2012, mining((("bitcoins", "mining", "extra nonce solution", id="bitcoin-mining-nonce")))((("mining", "extra nonce solution", id="mining-nonce")))((("extra nonce solution", id="extra-nonce"))) has evolved to resolve a Since 2012, mining((("mining", "extra nonce solution", id="mining-nonce")))((("extra nonce solution", id="extra-nonce"))) has evolved to resolve a
fundamental limitation in the structure of the block header. In the fundamental limitation in the structure of the block header. In the
early days of Bitcoin, a miner could find a block by iterating through early days of Bitcoin, a miner could find a block by iterating through
the nonce until the resulting hash was below the target. As difficulty the nonce until the resulting hash was below the target. As difficulty
@ -1301,12 +1301,12 @@ an individual piece of mining equipment to perform up to 281 TH/s by
only making changes to the block header. This keeps mining equipment only making changes to the block header. This keeps mining equipment
and protocols simpler than incrementing the extra nonce in the coinbase and protocols simpler than incrementing the extra nonce in the coinbase
transaction every 4 billion hashes, which requires recalculating the transaction every 4 billion hashes, which requires recalculating the
entire left flank of the merkle tree up to ((("bitcoins", "mining", "extra nonce solution", startref="bitcoin-mining-nonce")))((("mining", "extra nonce solution", startref="mining-nonce")))((("extra nonce solution", startref="extra-nonce")))the root. entire left flank of the merkle tree up to ((("mining", "extra nonce solution", startref="mining-nonce")))((("extra nonce solution", startref="extra-nonce")))the root.
[[mining_pools]] [[mining_pools]]
==== Mining Pools ==== Mining Pools
In this ((("bitcoins", "mining", "mining pools", id="bitcoin-mining-pools")))((("mining", "mining pools", id="mining-mining-pools")))((("mining pools", id="mining-pools")))highly competitive environment, individual miners working In this ((("mining", "mining pools", id="mining-mining-pools")))((("mining pools", id="mining-pools")))highly competitive environment, individual miners working
alone (also known as solo miners) don't stand a chance. The likelihood alone (also known as solo miners) don't stand a chance. The likelihood
of them finding a block to offset their electricity and hardware costs of them finding a block to offset their electricity and hardware costs
is so low that it represents a gamble, like playing the lottery. Even is so low that it represents a gamble, like playing the lottery. Even
@ -1483,12 +1483,12 @@ attack problem for Bitcoin itself. Rather, P2Pool makes Bitcoin more
robust overall, as part of a diversified mining ecosystem. As of this robust overall, as part of a diversified mining ecosystem. As of this
writing, P2Pool has fallen into disuse, but new protocols such as writing, P2Pool has fallen into disuse, but new protocols such as
Stratum v2 can allow individual miners to choose the transactions they Stratum v2 can allow individual miners to choose the transactions they
include in their((("bitcoins", "mining", "competitiveness of", startref="bitcoin-mining-competition")))((("mining", "competitiveness of", startref="mining-competitive")))((("bitcoins", "mining", "mining pools", startref="bitcoin-mining-pools")))((("mining", "mining pools", startref="mining-mining-pools")))((("mining pools", startref="mining-pools")))((("P2Pool (peer-to-peer mining pool)", startref="p2pool"))) blocks. include in their((("mining", "competitiveness of", startref="mining-competitive")))((("mining", "mining pools", startref="mining-mining-pools")))((("mining pools", startref="mining-pools")))((("P2Pool (peer-to-peer mining pool)", startref="p2pool"))) blocks.
[[consensus_attacks]] [[consensus_attacks]]
=== Hashrate Attacks === Hashrate Attacks
Bitcoin's ((("decentralized consensus", "hashrate attacks", id="decentral-consensus-hashrate")))((("bitcoins", "mining", "hashrate attacks", id="bitcoin-mining-hashrate")))((("mining", "hashrate attacks", id="mining-hashrate")))((("hashrate attacks", id="hashrate")))((("forks", "hashrate attacks", id="fork-hashrate")))consensus mechanism is, at least Bitcoin's ((("decentralized consensus", "hashrate attacks", id="decentral-consensus-hashrate")))((("mining", "hashrate attacks", id="mining-hashrate")))((("hashrate attacks", id="hashrate")))((("forks", "hashrate attacks", id="fork-hashrate")))consensus mechanism is, at least
theoretically, vulnerable to attack by miners (or pools) that attempt to theoretically, vulnerable to attack by miners (or pools) that attempt to
use their hashing power to dishonest or destructive ends. As we saw, the use their hashing power to dishonest or destructive ends. As we saw, the
consensus mechanism depends on having a majority of the miners acting consensus mechanism depends on having a majority of the miners acting
@ -1629,7 +1629,7 @@ Undoubtedly, a serious hashrate attack would erode confidence in
Bitcoin in the short term, possibly causing a significant price decline. Bitcoin in the short term, possibly causing a significant price decline.
However, the Bitcoin network and software are constantly evolving, so However, the Bitcoin network and software are constantly evolving, so
attacks would be met with countermeasures by the attacks would be met with countermeasures by the
Bitcoin ((("decentralized consensus", "hashrate attacks", startref="decentral-consensus-hashrate")))((("bitcoins", "mining", "hashrate attacks", startref="bitcoin-mining-hashrate")))((("mining", "hashrate attacks", startref="mining-hashrate")))((("hashrate attacks", startref="hashrate")))((("forks", "hashrate attacks", startref="fork-hashrate")))community. Bitcoin ((("decentralized consensus", "hashrate attacks", startref="decentral-consensus-hashrate")))((("mining", "hashrate attacks", startref="mining-hashrate")))((("hashrate attacks", startref="hashrate")))((("forks", "hashrate attacks", startref="fork-hashrate")))community.
[[consensus_changes]] [[consensus_changes]]
=== Changing the Consensus Rules === Changing the Consensus Rules