What are blocks in a blockchain

Photo by Traxer on Unsplash

What are blocks in a blockchain

·

3 min read

In a blockchain ledger, blocks are a type of data structure where transactions are stored and recorded. In the case of cryptocurrency the transactions are transfers of cryptocurencies on some other blockchains they could also contain other information such as code of computer programs.

Transactions cannot be altered once they have been included in the block. Additionally, once a block is included in the chain, it cannot be removed. As long as the blockchain is active, all data stored in blocks will remain there. Blocks are stacked one on top of the other in a straight line or say in a linear manner. They link together to create a chain that contains every transaction in the network's history. This linking together of blocks is why the term blockchain exists.

Structure Of A Block

In this article we shall focus the bitcoin blockchain,which the very first blockchain. The bitcoin network manages a public ledger which keeps track of the ownership and transactions associated with with native digital asset known as bitcoin(BTC).
The following components are always included in the general structure of a Bitcoin block:

Magic Number: The value 0xD9B4BEF9 is always present in this 4-byte field, indicating that the file format follows a data structure that is compatible with the Bitcoin network.

Blocksize:The maximum quantity of data that may be contained in a block is limited by this 4-byte parameter. The average capacity or the maximum size of a Bitcoin block is one megabyte (MB).

Blockheader: it contains an eighty byte field if cryptographically provable information which will be discussed later in the article

Transaction Count: A positive integer representing the number of transactions in the Bitcoin block, this field can be one to nine bytes in size.

Transaction:This variable size field contains the list of all transactions contained in the block and is typically filled with enough transactions to assure the 1MB Bitcoin block size limit.

Furthermore, network nodes are able to take part in the mining process, which safeguards the network and assures the authenticity of new blocks and the transactions they contain. Since miners are in charge of adding new blocks to the blockchain, they have an essential role to play in verifying the accuracy of the data in a proposed block.

The block time of the bitcoin blockchain which describes the amount of time its takes to create and add a new block to the blockchain,is around ten minutes on average that means 6 blocks are added every hour, While in Etheruem us about 10 to 20 seconds.

The block header contains 80 byte if cryptographic data which are:
Version: It is a 4 bit number which denotes the version of bitcion protocol being used.

HashPrevBlock: Contains the block of the previous ock header. It usually 32 bit in size.

HashMerkleRoot: Hash of all transactions in the current block's Merkle tree.

Time: It is the timestamp used to place the block in a blockchain. It mostly 4 bit in value.

Bits: The target difficulty of the current Bitcoin block is stored in this 4-byte field and determines how challenging it will be to find the target hash.

Nounce: The Encoded value that a miner must decode in order to validate and close a block.

So How's Are Blocks Added To The Chain

Well before a block is added to the chain, all of the components of the block heads are known in advance aside from the nounce. The aim of cryptocurrency mining is to figure out the nounce. A block is added to the chain and permanently recorded in the transaction history by the miner who discovers the nonce first that satisfies the current difficulty requirement.

Size Of A Block

In the bitcoin blockchain there is a fixed size of 1MB for every block, while the ethereum block size is constrained by the maximum number of gas units that can be spent per block. This constraint is commonly known as block gas limit.