Blockchain is precisely defined by its name: a chain of blocks containing information. The blocks store records of transactions on the blockchain. In the case of BTC, transactions are primarily transfers of $BTC from one address to another. Some blockchains can also contain a range of other information.
A block is a permanent storage of records that cannot be changed or deleted once written.
Generating a new block always includes the hash of the previous block, and this structure allows for the creation of a secure database that is highly resistant to manipulation and attacks. The block hash functions as an identifier and is unique for each block and is generated through a process called mining in Proof of Work (PoW) consensus or validation in Proof of Stake (PoS) consensus.
The block hash is a solution to a complex mathematical problem. The miner or validator who calculates the quickest valid solution for the next block has the right to verify and confirm this block. Because this process requires a significant amount of computational resources, successfully creating a new block produces new coins / tokens which reward the miner or validator for their work.
Although blocks are typically discussed in relation to cryptocurrency transactions, they can also be related to other types of digital data stored in a blockchain system
Blockchain is a chain of data blocks. Each block can be thought of as a page in a book. Individual blocks consist of several pieces of information.
They can be divided into a block header and block body.
The block header is divided into six parts:
- Software version
- Previous block hash
- Root hash of Merkle tree
- Time in seconds
- Current difficulty target
In most cases, the version of the software doesn't matter. However, a miner or validator with a specific version may indicate what protocol decisions they support
Previous block hash
The previous block hash is contained in the hash of the new block, thus all blockchain blocks build on top of each other. Without the hash, there would be no connection and chronology between individual blocks.
Root hash of Merkle tree
For chronology, the data itself is hashed first. Then the hashes are rehashed and merged. Finally, the Merkle tree is merged into a single hash. This last hash is called the root hash. It contains all the information about its "leaves" (individual transactions) and "branches" (leaves hashes) in the form of a short link.
Time in seconds
Unix time stamp of the block itself (given in seconds passed since 1/1/1970).
Current difficulty target
The target specifies how small the new hash must be. Each hash has a size in bits. The lower the target in bits, the harder it is to find a matching hash. A hash with many leading zeros is smaller than a hash with no zeros.
A nonce refers to a number or value that can only be used once. In blockchain, a nonce refers to a pseudo-random number used as a counter during the mining or validation process.
These six pieces of information make up the block header. The block header plays a vital role in the blockchain because it links all the blocks together. You can think of it as shipping documents with a list of important information about the cargo space contents.
The block body can be thought of as the trunk in a car. It contains all transactions or other information in each block.
When a miner or validator creates a block, they verify transactions by checking if the sender has enough assets to spend. This information can easily be read from the blockchain. The miner or validator looks in past blocks to see if the sender previously acquired the desired amount they now want to send.
The blocks are further divided into 3 types:
A genesis block is the first block to be created on a given blockchain.
It serves a vital purpose as it allows network nodes to be synchronized. Synchronization is only possible if the node databases have the same genesis block. This guarantees that the blockchain transactions ledger is the same for everyone, thus ensuring security.
Valid blocks are all blocks that have been mined or validated and added to the blockchain. To gain a valid block, each mined / validated block must receive network authorization and report as a block that has solved a cryptographic calculation. As a result, every transaction in a valid block becomes a confirmed transaction. Each valid block added to the blockchain confirms previous transactions.
Orphan blocks are not part of the blockchain network. They are generated when two miners or validators verify a given block simultaneously, but can also be caused by an attacker with sufficient computing power and the intention to duplicate transactions.