BlockChain Internals: Data Storage

DZone 's Guide to

BlockChain Internals: Data Storage

In this post we take a look at how the BlockChain protocol stores its data in a distributed fashion. Read on to find out more.

· Big Data Zone ·
Free Resource

A BlockChain is a public ledger that creates a digital ledger of transactions and shares 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 a data structure, i.e. how logically data can be put together and stored. BlockChain in the context of data structure is similar to Book. Let's 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 information:

  • 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.ethe total number of transaction this block stores.

Content of the Block

Content of the block contains the following information:

  • 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.


Each transaction is the bitcoin payment. Each transaction contains the following information:

  • 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 is stored inside the Block of the BlockChain. Block contains a lot of Hashes of different values that makes it kind of immutable.

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

This entry was posted in Scala. Bookmark the permalink.

Want to learn more about blockchain? Check out DZone's new Application and Data Security Guide!
big data, blockchain, blockchain structure

Published at DZone with permission of Akash Sethi . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}