Basic architecture of Blockchain

Welcome to my first article, I am glad you are reading it 🙂

The article describes the purpose of using blockchain, what exactly it is and its basic elements. Additionally, it contains a code, which I wrote in C#. You can find full code on my Github.

Real-life use

For instance, imagine a banking system which has one database with records containing owner name and account number.

no blockchain

And imagine an attacker who changed some owner name. Nobody will notice a malicious attack until owner of hacked account would like use the account.

How would blockchain help in this situation?

Structure of Blockchain

Before I explain how blockchain would help, let me clarify what it exactly is.

Blockchain is a chain of blocks. Logical, isn’t it? 🙂 Alright, let’s look at below code.

Each block has a field with some data, which in this case is an object containing owner name and account number. In addition, it has a hash and previous hash either.

Hash is a unique representation of each block. It is created with SHA256, one-way cryptographic algorithm, which accepts string parameter built from concatenating block’s properties. One-way means that any other algorithm cannot recreate block’s properties from hash.

Previous hash is a hash of the previous block. Hash value links blocks. First block has no previous hash and no data. It is called a genesis block.


This is a basic set of data for a block. Moreover, it might be useful to add a timestamp to keep a creation time and index to know which is the block in a list of blocks.

Let’s go back to the attacker. Now he is changing a data of a record which is wrapped by a blockchain. As a result, a hash of the block has changed. Method GetHash returns a new hash, but Hash property still contains old hash. Therefore, whole blockchain is not valid and it is easy to detect the situation.


In conclusion, using blockchain improves security, because to break cryptographic security layer, the attacker would have to change hash to the proper value and likewise hashes and previous hashes of next blocks either. What if there would be thousands of next blocks? Attacker would have to make much effort.

0 0 vote
Article Rating
Share on
Notify of
1 Comment
Newest Most Voted
Inline Feedbacks
View all comments
February 2, 2019 5:35 pm

What a nice surprise! Blockchain explained in a really short post in straightforward way, finally I got it!