BlockChain Internals: Data Storage

Table of contents
Reading Time: 2 minutes

A BlockChain is a public ledger that create a digital ledger of transactions and share it among a distributed network of computers. BlockChain uses cryptography to allow each participant on the network to manipulate the ledger in a secure way without the need for a central authority.

BlockChain is just an data structure i.e. how logically data can be put together and stored. BlockChain in context of data structure is similar to Book. Lets take a look how BlockChain stores data :-

  • BlockChain uses Merkle Tree to Store the data in distributed manner.
  • You can think a Block as a page in the Book. just like a page contains header and content similarly Block also contains Header and Content.
  • Header contains the data about the block (we will read later).
  • Content contains the transaction data and data related to mining rewards.

Header of the Block :- Header of the Block stores the following informations :-

  • Technical Data :- it contains Version , size of the block and Magic ID.
  • Previous Block Hash :- it contains hash of previous block header generated by 2 times applying SHA256 algorithm.
  • Merkle Root :- it contains the single hash of the Block.
  • Time Stamp :- it contains the time stamp when the block is created.
  • Difficulty Target :- this data is related to mining how hard it is to mine the block.
  • Nonce :- A random number.

After the Header There is another part of the block that stores the Transaction count i.e. the total number of transaction this block stores.

Content of the Block :- Content of the block contains the following informations:-

  • Coinbase Transactions:- this contains the data related to mining reward, processing fees. its special type of transaction where there is no input and from address.
  • BitCoin Transaction :- this contains all to information related to all the transactions.

Transaction :- Each transaction is the bitcoin payment. Each transaction contains the following informations :-

  • Technical Data :- it contains Version number, Transaction lock time, Input count and Output Count.
  • Inputs :- it contains the information about which coin are being spent. it includes Sequence number, script data, input script length, Previous transaction hash and index.
  • Output :- it contains the information about who is getting the coin. in includes Output script length, Amount and output script.

These are information that are stored inside the Block of the BlockChain. Block contains lot of Hashes of different values thats makes it kind of immutable.

Each Block contains the reference of the previous block so, each block is connected with other block in chain like form which is more similar to pages link to each other in book.

Written by 

Rachel Jones is a Solutions Lead at Knoldus Inc. having more than 22 years of experience. Rachel likes to delve deeper into the field of AI(Artificial Intelligence) and deep learning. She loves challenges and motivating people, also loves to read novels by Dan Brown. Rachel has problem solving, management and leadership skills moreover, she is familiar with programming languages such as Java, Scala, C++ & Html.

1 thought on “BlockChain Internals: Data Storage2 min read

Comments are closed.