Learn Blockchain technology located under Bitcoin Protocol [Part 1]

Tram Ho

Purpose

This article is for those who want to learn about technology below Bitcoin, go into every simple concept to the technology section below it that gives an overview of the Blockchain technology used in so-called Bitcoin. Protocol.

1. Why is it called Blockchain? Blockchain to do? How does a transaction take place?

This I need to understand the structure of a Blockchain in Block and I will learn about the structure of a Block in Bitcoin Protocol. Blockchain understands simply to record all transactions that are taking place on the network. And when it is recorded, it is almost impossible to delete.

1.1 Structure of a Block

A Block also has a number of fields, but what we need to consider is the 6 fields below because 1 Block is the Hash value of the 6 fields below. The hash algorithm used here is the SHA-256 algorithm. I also explain this algorithm a bit.

Why is Blockchain technology so complicated?
Blockchain FinTech BitRock calls for more than 4 Million dollars to develop FinTech solutions!

The SHA-256 algorithm is a one-way hashing algorithm. That is, you include an input as a string, an image, …. then through the algorithm it will produce an output of 256 bits in length. And it can’t find that input even if I have the output hash code. Note: What kind of input you put in, it only gives a 256 bits output. You can try this algorithm yourself at the link below:

https://passwordsgenerator.net/sha256-hash-generator/

NameExplain
VersionRecord the version of Bitcoin Protocol when creating Block
Previous Block HashRecord Block’s hash just before
Merkle RootThe hash of all transactions in Block
TimestampRecord the time of creating Block
BitsRecord Block’s difficulty
NonceIs a random number (I’ll explain below)

Previous Block Hash

This field to record Block’s Hash right before it lets Bitcoin form a chain that links the links together, making it “difficult to change Block’s information when it has created a block.” . Because a Block is a hash of the above 6 fields, if the previous Block is changed => the previous Block hash is also changed => the Previous Block Hash field value is also changed and so on if the first block is change then block n + 1, n + 2, …. n + n is also changed. And also from the previous Block feature connecting to the following Block into a string like this, so people called Blockchain (Block: Chain, Chainchain, Blockchain: temporary block).

Merkle Root

In order for the transaction to be executed on the Blockchain network, it needs to be put into a block. This field records the hash value of all transactions in the block in the form of Merkle like this:

Transactions are hashed together and eventually form a merged hash (Since using the SHA-256 algorithm as I showed above, no matter how many times the hash is used, the result returned to Merkle Root still It’s only 256 bits), making every small change in the tree will make the merkle root value change. and lead to Block hash changes as well. The Merkle tree ae shown here is currently the number of transactions as shown in the figure is even.

Bits and Nonce

Record the difficulty of (something). Understand this, I have to find out how a valid Block is created. And for a Block to be considered valid, the Block creator must find the Block hash, and to find Blockhash, one needs to find the value of all 6 fields above, including a field containing a value. random (It is the Nonce school). Let’s look back at how BlockHash was created:

The Bits field is the field that records the difficulty of finding a random Nonce number. (And this is also the work of Miners or bitcoin miners.) A bit of a bit about the work of Bitcoin miners is like the following.

The Nonce counter will count incrementally from 0.1,2,3, …. until it is valid. For every 1 unit increase, the computer will have to recalculate Block’s Hash value. Through the SHA-256 algorithm, the number of nonce additions by 1 unit also gives a BlockHash value that is completely different from the last Hash value. So the more people digging Bitcoin have a machine that has the power to calculate Hash, the more chances of finding Nonce sooner. And the appropriate Nonce number will be the number when combined with the other 5 fields will produce a hash value of less than the Bits field.

So in Bitcoin network, Bitcoin excavators will scramble to find the appropriate number of Nonce to create a new Block. (The Block creator will be rewarded from the system (Transaction from coinbase). And all the fees from transactions in Block. Reward from coinbase will decrease from the first Block created, the first Block ( Genesis Block) by Nakamoto Satoshi- The creator of Bitcoin has been awarded 50 Bitcoin bonus and currently the Block creator will receive 12.5 Bitcoin.In Bitcoin now, every 1 minute, 1 new block is created. This is configurable, every 2 weeks (2048 blocks), the system will automatically recalculate the difficulty level, and by changing the value of the Bits field, Bitcoin Protocol can adjust the difficulty level. of Purple algorithm to value Block Hash to keep 10 minutes / 1 block even when there are more or less participants o Bitcoin digging work: Currently the number of people participating in math solving is very large, so finding Block Hash is extremely difficult, if currently digging through personal machines, there is very little chance we will dig The digging of Bitcoin is the calculation of the number of Hashs so if people used CPU to dig in the past, the current use of GPU (graphics card) to dig will bring many times more efficiency. Due to the specialized graphics card used to calculate hash to move color pixels to display. Currently there is also a dedicated machine to dig Bitcoin named ASIC from China below and it has the power to calculate hash far beyond the personal computer we are using. How much more specific is depending on the type.

Not only that, when digging up Bitcoin is difficult, many groups of people have come up with the idea of ​​linking together to form a “Mining Pool.” . How much Bitcoin will be divided depends on Mining Pool. And currently at the large Mining Pool gathered in China.

1.2 How to transfer information in Bitcoin’s peer network

In the ae Web model being used as client-server model, the communication relationship is only 1-1 Client -> sever and Sever -> client like this:

In the model of peer machines like the Blockchain model will look like this:

The machines link together and transmit information across each other. Specifically, if you call each machine to join the system as a Node and you are trying to send a message to the node that “I want to send a transaction to you” Dogs also learn code ‘1 bitcoin’

If from 1 node you send information to all other nodes in the system and other nodes also do so, there will be a bottleneck phenomenon in many places so … Each Node will have a list my “neighbors” and the communication will only happen in me -> my neighbors, and so my neighbor will receive a message that will confirm whether the transaction I sent is valid is not. And if it is valid, it will be sent to his neighbors and his neighbors will continue to check and send it until it reaches all nodes. And it will be done pretty quickly because of the information model in binary form. Even if the number is increased twice, it only takes 1 more time to send …

1.3 How the network accepts a transaction

Suppose that the previous transaction I sent you the “Dog also learned code” 1 bitcoin was valid and the transaction was sent to all Node in the network. The network will include temporary Mining Nodes called specialized machines to dig Bitcoin in the network. These nodes will collect transactions into a list and then select the transactions that you want to add to form a Block (about 1500 transactions are optional) most will choose transactions with high transaction fees to be able to benefit more. 1 Block only has Max capacity of 1 MB and proceeds to calculate BlockHash value. Run the function to calculate the value of Nonce running from 0,1,2,3, … .. And when you find Blockhash, you will add that Block to your own lovable Blockchain and continue (with the same form as sending information). Transaction information) sent to my neighbors, the check block neighbors are valid, if it is valid to add that Block Block to my Blockchain then continue sending.

To be continue …

Bitcoin slumped, pre-coding digging companies went bankrupt
Blockchain’s complete breakdown from A – I: “Bitcoin – The first virtual currency”
Share the news now

Source : viblo .u6449b51646017051eb99e06ec4233105 { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:#eaeaea; border:0!important; border-left:4px solid #34495E!important; text-decoration:none; } .u6449b51646017051eb99e06ec4233105:active, .u6449b51646017051eb99e06ec4233105:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .u6449b51646017051eb99e06ec4233105 { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .u6449b51646017051eb99e06ec4233105 .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .u6449b51646017051eb99e06ec4233105 .postTitle { color:#000000; text-decoration: underline!important; font-size: 16px; } .u6449b51646017051eb99e06ec4233105:hover .postTitle { text-decoration: underline!important; } Bitcoin sụt giảm thê thảm, các công ty đào tiền mã hóa đua nhau phá sản .uaae56076deae138a28941dcdde3d9238 { padding:0px; margin: 0; padding-top:1em!important; padding-bottom:1em!important; width:100%; display: block; font-weight:bold; background-color:#eaeaea; border:0!important; border-left:4px solid #34495E!important; text-decoration:none; } .uaae56076deae138a28941dcdde3d9238:active, .uaae56076deae138a28941dcdde3d9238:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; text-decoration:none; } .uaae56076deae138a28941dcdde3d9238 { transition: background-color 250ms; webkit-transition: background-color 250ms; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; } .uaae56076deae138a28941dcdde3d9238 .ctaText { font-weight:bold; color:inherit; text-decoration:none; font-size: 16px; } .uaae56076deae138a28941dcdde3d9238 .postTitle { color:#000000; text-decoration: underline!important; font-size: 16px; } .uaae56076deae138a28941dcdde3d9238:hover .postTitle { text-decoration: underline!important; } Giải ngố toàn tập về Blockchain từ A - I: "Bitcoin - Đồng tiền ảo đầu tiên"