Understanding Blocks
Blocks are where transaction data is stored in a blockchain. Each block has a hash that uniquely identifies the information contained within the block.
Blocks are created by miners (or validators in Proof of Stake) and contain recent transactions. When a valid block is produced, it is propagated throughout the network and each miner adds the block to their copy of the blockchain.
The table below shows the information contained within a block
The two main pieces here are the transactions and the blockheader. The transactions contain inputs and outputs as well as the digital signature of the sender.
The blockheader contains several pieces including the nonce (a somewhat random number), timestamp, the hash of the transactions in the block, and the hash of the previous block.
From Blocks to Blockchain
Individual blocks are linked together to make the blockchain. The blocks are linked by the hash of the previous block. This linkage (and the concept of hashes) makes it very easy to detect if someone has changed their copy of the blockchain. Take a look at the visuals below.
In the two blocks above there is transaction data, a nonce, the hash of the previous block, and the hash of the current block. This is a simplified model but serves the purpose of visualizing blocks.
Notice how the hash of block 1 (ending in d64) is used as an input in block 2. This means that the hash of block 2 is partially determined by the hash the previous block.
If someone were to change the transactions in block 1, the hash of block 1 would change. That would then cause the hash of block 2 to change.
In this second visual, the first transaction in block 1 has been changed. The hash of block 1 changes because of this.
Compare the hashes of block 2 from both visuals. They are different because the hash of block 1 changed.
This feature allows for easy checking of different copies of the blockchain and allows people (and computers) to come to a consensus on the ‘real’ version of the blockchain.