Difference between revisions of "Block"

 
(29 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=DISCLAIMER=
+
Bitcoin transaction data is immutably recorded by Miners into files called '''blocks'''. Blocks can be thought of as the individual pages of a city recorder's record book (where changes to title to real estate are recorded) or a stock transaction ledger. Each block references the previous block that it was built upon allowing the record of history to form a linear sequence over time, known as the [[blockchain]]. New transactions are constantly being processed by [[Mining|Miners]] into new blocks which are added to the end of the chain. As new blocks are added to the tip of the chain, blocks are [[Confirmation|buried deeper and deeper]] and become [[Proof_of_Work|harder]] to change or remove, forming part of the Bitcoin network's security model.  
This article is a direct copy of the original https://en.bitcoin.it/wiki/Block and has not been checked for correctness or edited.
 
11 October 2019
 
  
Expected review by: 25 October 2019
+
===Block message structure===
 
 
20191011 Review Brendan Lee
 
Edited first paragraph
 
NOTE: MAGIC BYTES ARE SET TO BTC VALUE. DOES THIS NEED TO CHANGE?
 
29 Nov - removing core guff, re-formatting around corporate miner/large block paradigm
 
 
 
 
 
 
 
 
 
 
 
 
 
Bitcoin transaction data is immutably recorded by miners into files called '''blocks'''. Blocks can be thought of as the individual pages of a city recorder's record book (where changes to title to real estate are recorded) or a stock transaction ledger. Each block references the previous block that it was built upon allowing the record of history to form a linear sequence over time, known as the [[block chain]]. New transactions are constantly being processed by [[Mining|miners]] into new blocks which are added to the end of the chain. As new blocks are added to the tip of the chain, blocks are [[Confirmation|buried deeper and deeper]] and become [[Proof_of_Work|harder]] to change or remove, forming a large part of the Bitcoin network's security model.
 
 
 
===Block structure===
 
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
Line 25: Line 9:
 
|-
 
|-
 
|Magic no
 
|Magic no
|value always 0xD9B4BEF9
+
|Data field indicating that this data packet contains a BitcoinSV block. Value always 0xD9B4BEF9
 
|4 bytes
 
|4 bytes
 
|-
 
|-
|Blocksize
+
|Block size
|number of bytes following up to end of block
+
|number of bytes remaining in the packet up to end of block
 
|4 bytes
 
|4 bytes
 
|-
 
|-
|Blockheader
+
|[[Block header]]
|[[Block hashing algorithm| consists of 6 items]]
+
|[[Block header| consists of 6 items]]
|80 bytes
+
| 80 bytes
 
|-
 
|-
 
|Transaction counter
 
|Transaction counter
| positive integer [[ Protocol#Variable_length_integer|VI = VarInt]]
+
| positive integer VI = [[VarInt]]
 
| 1 - 9 bytes
 
| 1 - 9 bytes
 
|-
 
|-
|[[Bitcoin_Transactions|transactions]]
+
|[[Transactions]]
 
|the (non empty) list of transactions
 
|the (non empty) list of transactions
 
|<Transaction counter>-many transactions
 
|<Transaction counter>-many transactions
Line 46: Line 30:
  
 
==Description==
 
==Description==
Each block contains, among other things, the [[Block timestamp|current time]], a record of some or all recent [[Bitcoin_Transactions|transactions]], and a reference to the block that came immediately before it. It also contains an answer to a difficult-to-solve mathematical puzzle - the answer to which is unique to each block. New blocks cannot be submitted to the network without the correct answer - the process of "[[mining]]" is essentially the process of competing to be the next to find the answer that "solves" the current block.  The mathematical problem in each block is extremely [[difficulty|difficult]] to solve, but once a valid solution is found, it is very easy for the rest of the network to confirm that the solution is correct.  There are multiple valid solutions for any given block - only one of the solutions needs to be found for the block to be solved.
+
Each block contains, among other things, the [[Block timestamp|current time]], a record of some or all recent [[Bitcoin_Transactions|transactions]], and a reference to the block that came immediately before it. It also contains an answer to a hash puzzle which is unique to each block. The [[Block hashing algorithm]] requires that Miners pre-build their block candidate before trying to solve the puzzle. New blocks cannot be submitted to the network without the correct answer - the process of "[[mining]]" is essentially the process of competing to be the next to find the answer that "solves" the current block.  The hash puzzle in each block is [[difficulty|difficult]] to solve, but once a valid solution is found, it is very easy for the rest of the network to confirm that the solution is correct.  There are multiple valid solutions for any given block - only one of the solutions needs to be found for the block to be solved.
  
Because there is a reward of brand new bitcoins for solving each block, every block also contains a record of which [[Bitcoin address]]es or [[Opcodes used in Bitcoin Script|scripts]] are entitled to receive the reward. This record is known as a generation transaction, or a [[coinbase]] transaction, and is always the first transaction appearing in every block. The number of [[Bitcoin|Bitcoins]] generated per block starts at 50 and is halved every 210,000 blocks (about four years).
+
As a reward for building and performing work on a block and successfully propagating it to the network, the winning Miner awards themselves the [[block subsidy]] and any [[Transaction fees]] that have been included in the transactions. The winning Miner pays this reward out to themselves in the first transaction in the block which is known as a generation transaction, or a [[coinbase]] transaction. The block subsidy started at 50 bitcoins per block and is halved every 210,000 blocks, or about every four years.
  
 
When Bitcoin transactions are broadcast to the [[network]] by the sender, nodes who compete to build blocks collect the transactions and add them to the block they are working to solve. Miners' incentive to include transactions in their blocks is the attached [[Transaction fees]].
 
When Bitcoin transactions are broadcast to the [[network]] by the sender, nodes who compete to build blocks collect the transactions and add them to the block they are working to solve. Miners' incentive to include transactions in their blocks is the attached [[Transaction fees]].
  
The [[difficulty]] of the mathematical problem is automatically adjusted by the network, such that it targets a goal of solving an average of 6 blocks per hour. Every 2016 blocks (solved in about two weeks), all Bitcoin clients compare the actual number created with this goal and modify the target by the percentage that it varied. The network comes to a consensus and automatically increases (or decreases) the difficulty of generating blocks.
+
The [[difficulty]] of the mathematical problem is automatically adjusted by the network, such that it targets a goal of solving an average of 6 blocks per hour. In the original design this rate was adjusted every 2016 blocks which is around 2 weeks. Currently (November 2019) the BitcoinSV network follows a 'Difficulty Adjustment Algorithm' (DAA) which adjusts the difficulty every block.
  
Because each block contains a reference to the prior block, the collection of all blocks in existence can be said to form a chain.  However, it's possible for the chain to have temporary splits - for example, if two miners arrive at two different valid solutions for the same block at the same time, unbeknownst to one another.  The peer-to-peer network is designed to resolve these splits within a short period of time, so that only one branch of the chain survives.
+
Because each block contains a reference to the prior block, the collection of all blocks in existence can be said to form a chain.  However, it's possible for the chain to have temporary splits - for example, if two Miners arrive at two different valid solutions for the same block at the same time, unbeknownst to one another.  The peer-to-peer network is designed to resolve these splits within a short period of time, so that only one branch of the chain survives.
  
The client accepts the 'longest' chain of blocks as valid. The 'length' of the entire [[block chain]] refers to the chain with the most combined difficulty, not the one with the most blocks. This prevents someone from forking the chain and creating a large number of low-difficulty blocks, and having it accepted by the network as 'longest'.
+
The client accepts the 'longest' chain of blocks as valid. The 'length' of the entire [[blockchain]] refers to the chain with the most blocks at the required difficulty.
  
== Common Questions about Blocks ==
+
==See Also==
 
 
=== How many blocks are there? ===
 
[http://blockexplorer.com/q/getblockcount Current block count]
 
  
=== What is the maximum number of blocks? ===
+
* [[Block header]]
There is no maximum number, blocks just keep getting added to the end of the chain at an average rate of one every 10 minutes.
+
* [[Blockchain]]
 
+
* [[Block hashing algorithm]]
==== Even when all 21 million coins have been generated? ====
+
* [[Block timestamp]]
Yes. The blocks are for proving that transactions existed at a particular time. Transactions will still occur once all the coins have been generated, so blocks will still be created as long as people are trading Bitcoins.
 
 
 
=== Where can I find more technical detail? ===
 
There is more technical detail on the [[block hashing algorithm]] page.
 
 
 
==See Also==
 
  
* [[Protocol#"block" messages|Protocol rules - "block" messages]]
+
==Attribution==
 +
This content is based on content sourced from https://en.bitcoin.it/wiki/Block under [https://creativecommons.org/licenses/by/3.0/ Creative Commons Attribution 3.0]. Although it may have been extensively revised and updated, we acknowledge the original authors.

Latest revision as of 01:54, 11 January 2022

Bitcoin transaction data is immutably recorded by Miners into files called blocks. Blocks can be thought of as the individual pages of a city recorder's record book (where changes to title to real estate are recorded) or a stock transaction ledger. Each block references the previous block that it was built upon allowing the record of history to form a linear sequence over time, known as the blockchain. New transactions are constantly being processed by Miners into new blocks which are added to the end of the chain. As new blocks are added to the tip of the chain, blocks are buried deeper and deeper and become harder to change or remove, forming part of the Bitcoin network's security model.

Block message structure

Field Description Size
Magic no Data field indicating that this data packet contains a BitcoinSV block. Value always 0xD9B4BEF9 4 bytes
Block size number of bytes remaining in the packet up to end of block 4 bytes
Block header consists of 6 items 80 bytes
Transaction counter positive integer VI = VarInt 1 - 9 bytes
Transactions the (non empty) list of transactions <Transaction counter>-many transactions

Description

Each block contains, among other things, the current time, a record of some or all recent transactions, and a reference to the block that came immediately before it. It also contains an answer to a hash puzzle which is unique to each block. The Block hashing algorithm requires that Miners pre-build their block candidate before trying to solve the puzzle. New blocks cannot be submitted to the network without the correct answer - the process of "mining" is essentially the process of competing to be the next to find the answer that "solves" the current block. The hash puzzle in each block is difficult to solve, but once a valid solution is found, it is very easy for the rest of the network to confirm that the solution is correct. There are multiple valid solutions for any given block - only one of the solutions needs to be found for the block to be solved.

As a reward for building and performing work on a block and successfully propagating it to the network, the winning Miner awards themselves the block subsidy and any Transaction fees that have been included in the transactions. The winning Miner pays this reward out to themselves in the first transaction in the block which is known as a generation transaction, or a coinbase transaction. The block subsidy started at 50 bitcoins per block and is halved every 210,000 blocks, or about every four years.

When Bitcoin transactions are broadcast to the network by the sender, nodes who compete to build blocks collect the transactions and add them to the block they are working to solve. Miners' incentive to include transactions in their blocks is the attached Transaction fees.

The difficulty of the mathematical problem is automatically adjusted by the network, such that it targets a goal of solving an average of 6 blocks per hour. In the original design this rate was adjusted every 2016 blocks which is around 2 weeks. Currently (November 2019) the BitcoinSV network follows a 'Difficulty Adjustment Algorithm' (DAA) which adjusts the difficulty every block.

Because each block contains a reference to the prior block, the collection of all blocks in existence can be said to form a chain. However, it's possible for the chain to have temporary splits - for example, if two Miners arrive at two different valid solutions for the same block at the same time, unbeknownst to one another. The peer-to-peer network is designed to resolve these splits within a short period of time, so that only one branch of the chain survives.

The client accepts the 'longest' chain of blocks as valid. The 'length' of the entire blockchain refers to the chain with the most blocks at the required difficulty.

See Also

Attribution

This content is based on content sourced from https://en.bitcoin.it/wiki/Block under Creative Commons Attribution 3.0. Although it may have been extensively revised and updated, we acknowledge the original authors.