Block structures in the blockchain

Blockchain is a chain of data, which are represented in blocks. It is the fundamental part of web3 implementations and decentralized…

Block structures in the blockchain

Blockchain is a chain of data, which are represented in blocks. It is the fundamental part of web3 implementations and decentralized solutions. Each block has to include data which are stored in the blockchain.


Have you ever wondered how it does it and which data it consists?

Are you curious how blocks are connected in chains?

if so, it is the resource for you…


Agenda:

  • block structure,
  • Header,
  • Previous hash details,
  • Timestamp,
  • Nonce,
  • Merkle tree,
  • Body,
  • Blocks types,
  • When block is orphan.

Each block is made from header and body. Both of them store data, but slightly different and for other purposes.

Block structure is mainly the same in various ecosystems, there might be some changes in the data format and informations about transactions, because blockchain can be also used in other industries.


Header

Header of a block represents:

  • previous hash,
  • Timestamp,
  • Nonce,
  • Merkle root

Hash of previous block is calculated by passing the header of latest block to hash function. Hash algorithm prevents blockchain from hacking, because even one small change in a header and the hash result is totally different. Moreover, it is impossible to calculate header from has result.

Timestamp is used as a proof that block was mined at concrete moment and is the crucial element of argument in hash function. One second of change and calculated hash is different.

Nonce is the number used only once, which miners in the blockchain are solving for. When it is solved, new block can be added. This number is 4 bits long, seeking it in the bitcoin ecosystem takes about 10 minutes.

Merkle tree is a binary tree, which each leaf node is labeled with a hash of one transaction, included in the block body. Merkle tree is used to reduce the effort to verify the transactions in the block.


Body

The block body is the main part of stored data. It is the place where transactions data are saved and ready to read from blockchain explorers.


Types of blocks

  • genesis block,
  • - Valid blocks,
  • - Orphan blocks,

Genesis block is the first block in the blockchain ecosystem, entire system is build upon them.

Valid blocks are all mined and approved blocks.

Orphan block is mined block but not attached in a blockchain.


Block is orphan in situation when two miners add new block at the same time, but system has to decide which will be the part of a blockchain.

Moreover, when there is a hacker attack, the situation can be similar. “Injected” Block is not correct, so it is not attached.


Join my web3 challenge and follow new content:

  • twitter: https://twitter.com/kacperhernacki
  • Instagram: https://www.instagram.com/kacper.hernacki/
  • LinkedIn: https://pl.linkedin.com/in/kacper-hernacki-965161203
  • Github: https://github.com/Kacper-Hernacki