How Blockchain works?

11 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$99.99
List Price:  $139.99
You save:  $40
€93.47
List Price:  €130.87
You save:  €37.39
£79.12
List Price:  £110.77
You save:  £31.65
CA$136.80
List Price:  CA$191.52
You save:  CA$54.72
A$153.03
List Price:  A$214.24
You save:  A$61.21
S$136.24
List Price:  S$190.75
You save:  S$54.50
HK$782.75
List Price:  HK$1,095.89
You save:  HK$313.13
CHF 90.39
List Price:  CHF 126.55
You save:  CHF 36.16
NOK kr1,103.76
List Price:  NOK kr1,545.32
You save:  NOK kr441.55
DKK kr697.01
List Price:  DKK kr975.84
You save:  DKK kr278.83
NZ$168.36
List Price:  NZ$235.71
You save:  NZ$67.35
د.إ367.25
List Price:  د.إ514.16
You save:  د.إ146.91
৳11,001.09
List Price:  ৳15,401.97
You save:  ৳4,400.87
₹8,339.41
List Price:  ₹11,675.50
You save:  ₹3,336.09
RM476.70
List Price:  RM667.40
You save:  RM190.70
₦132,134.22
List Price:  ₦184,993.20
You save:  ₦52,858.97
₨27,905.82
List Price:  ₨39,069.27
You save:  ₨11,163.44
฿3,697.97
List Price:  ฿5,177.30
You save:  ฿1,479.33
₺3,250.47
List Price:  ₺4,550.79
You save:  ₺1,300.31
B$511.57
List Price:  B$716.23
You save:  B$204.65
R1,877.82
List Price:  R2,629.02
You save:  R751.20
Лв182.79
List Price:  Лв255.92
You save:  Лв73.12
₩137,795.03
List Price:  ₩192,918.56
You save:  ₩55,123.52
₪381.78
List Price:  ₪534.51
You save:  ₪152.73
₱5,764.02
List Price:  ₱8,069.86
You save:  ₱2,305.84
¥15,807.91
List Price:  ¥22,131.71
You save:  ¥6,323.80
MX$1,715.83
List Price:  MX$2,402.24
You save:  MX$686.40
QR365.49
List Price:  QR511.70
You save:  QR146.21
P1,379.76
List Price:  P1,931.72
You save:  P551.96
KSh13,280.92
List Price:  KSh18,593.82
You save:  KSh5,312.90
E£4,785.67
List Price:  E£6,700.13
You save:  E£1,914.46
ብር5,752.60
List Price:  ብር8,053.87
You save:  ብር2,301.27
Kz83,397.65
List Price:  Kz116,760.05
You save:  Kz33,362.40
CLP$95,187.41
List Price:  CLP$133,266.18
You save:  CLP$38,078.77
CN¥724.48
List Price:  CN¥1,014.31
You save:  CN¥289.82
RD$5,876.15
List Price:  RD$8,226.85
You save:  RD$2,350.69
DA13,419.92
List Price:  DA18,788.43
You save:  DA5,368.50
FJ$226.22
List Price:  FJ$316.72
You save:  FJ$90.50
Q779.62
List Price:  Q1,091.50
You save:  Q311.88
GY$20,970.66
List Price:  GY$29,359.76
You save:  GY$8,389.10
ISK kr14,012.52
List Price:  ISK kr19,618.09
You save:  ISK kr5,605.56
DH1,012.51
List Price:  DH1,417.55
You save:  DH405.04
L1,776.81
List Price:  L2,487.61
You save:  L710.79
ден5,750.48
List Price:  ден8,050.91
You save:  ден2,300.42
MOP$808.27
List Price:  MOP$1,131.61
You save:  MOP$323.34
N$1,891.23
List Price:  N$2,647.80
You save:  N$756.57
C$3,688.83
List Price:  C$5,164.51
You save:  C$1,475.68
रु13,363.42
List Price:  रु18,709.33
You save:  रु5,345.90
S/376.55
List Price:  S/527.19
You save:  S/150.63
K386.91
List Price:  K541.69
You save:  K154.78
SAR375
List Price:  SAR525.02
You save:  SAR150.01
ZK2,656.27
List Price:  ZK3,718.89
You save:  ZK1,062.61
L465.65
List Price:  L651.93
You save:  L186.28
Kč2,349.23
List Price:  Kč3,289.02
You save:  Kč939.78
Ft36,664.08
List Price:  Ft51,331.18
You save:  Ft14,667.09
SEK kr1,088.81
List Price:  SEK kr1,524.39
You save:  SEK kr435.57
ARS$87,581.58
List Price:  ARS$122,617.72
You save:  ARS$35,036.13
Bs695.16
List Price:  Bs973.25
You save:  Bs278.09
COP$396,484.19
List Price:  COP$555,093.74
You save:  COP$158,609.54
₡50,931.67
List Price:  ₡71,306.37
You save:  ₡20,374.70
L2,475.19
List Price:  L3,465.37
You save:  L990.17
₲746,363.69
List Price:  ₲1,044,939.03
You save:  ₲298,575.33
$U3,863.50
List Price:  $U5,409.05
You save:  $U1,545.55
zł402.98
List Price:  zł564.19
You save:  zł161.21
Already have an account? Log In

Transcript

Hello everyone. Welcome back to the course, we have already discussed on the overview on blockchain. Now let's see how the core of blockchain performs the core functions with the help of an example. We will go through the working of blockchain through an example. Let's imagine that there are 10 people inside a room, and they decide to create their currency for any exchange between them apart from transacting, they also need to have transparency for all the transactions taking place. They need to be aware about the flow of the funds between them so that disputes regarding the same can be resolved in the future.

That is why they decided to appoint one person to keep a list of all the transactions which are taking place between the members of the group. Let's call this person Dave. You can see in the image that Dave kept a record of all The transactions happening in the room in a notebook. All the transactions from the beginning were noted down. For example, Alice gave three coins to Carol, Carol gave five coins to Chuck. Chuck gave three coins to Eve.

And finally, Eve transferred one coin to Bob were recorded down in a notebook. This notebook acts as a source of transparency and verification for the group. Now, out of the group of 10 people, there is one person Let's call him Chuck, who decided to steal money from the group. To accomplish that he changed the entries present in the notebook. One night, he got hold of the notebook and modified his entry to somebody else. For example, He turned the entry number three in the notebook from Chuck gave three coins to Eve to Carol gave three coins to Eve first making sure his account is not deducted for the transaction.

Dave notices that someone has messed up with the notebook, and he decided to protect the entries, he created a program called a hash function. How does the hash function work? Our hash function converts a variable length of data to an alphanumeric string of a fixed length. A hash function always generates the same size of data for any input size. For example, Sha 256 is a known hash function, which has been used in Bitcoin and aetherium. Beat one kilobyte of input data, or one gigabyte of input data.

Sha 256 hash function will always generate 256 bits of output hash, we can see the example of hash function in action as shown in the table. Examples like attack, counter attack and can attack have a fixed length hash through the SHA 256 hash function, even a single bit of change in data will lead to a different hash result. In other words, we can say that the hash acts like a digital signature for the data. If the data change, the hash will also change. Dave added the records of hash inside the notebook in such a way that after each transaction, he has a hash of the transaction. The new notebook entries look like as shown in the image.

You can see now when Alice gift and coins to Carol, a hash of the same as recorded below the transaction, the same happens for the rest of the transactions or any other future transactions. If Chuck tries again to change the entries inside the notebook, then the hash for those entries will be different, and Dave would be able to verify the modified entries. Although the hash function has been put into effect, Chuck somehow learned about the hash function and decided to manipulate the entity Again, he took the notebook one night and change the transactions as well as the hash of the transactions. For example, you can see in the image he changed the transaction, Carol gave five coins to chuck to Carol gave eight coins to chuck so that his account has more coins. He also recalculated the hash of the other transactions, and modified those in the notebook as well.

By changing the hash, he made sure that if somebody tries to verify the transactions by using the hash function, then the transaction gets validated. they've noticed again that somebody has fiddled with the notebook frustrated with the attacker. He decided to complicate the records in such a way that each hash is generated by combining it with the previous hash. So each transaction record is added with the last hash transaction and pass through the hash function. The result Hash is the current transaction hash and it will be used to generate the hash for the next transaction in the notebook. Each entry in the journal depends upon the previous entry.

If the attacker tries to change any record in the notebook, then he needs to replace all the entries inside the notebook. Now, the notebook look like as shown in the image. So, you can see that we have the input Alice gave 10 coins to Carol, and corresponding to that there is a hash recorded for the same. The second input Carol gave five coins to check is cumulated with the previous hash and pass through a hash function, the resultant hash is recorded against Carol's transaction. Similarly, the next input Carol gave three coins to Eve is again linked to the previous hash and then pass through the hash function to generate the current transaction hash. This is repeated for all the records in the notebook.

Making sure all the records are linked to each other, thus forming a chain of records. But check is a persistent attacker. Chuck wanted more money, and he spends the whole night counting all the hashes. Finally, he came to know about the linked hashes and somehow managed to change the hash and the entries. He replaced all the entries as per his advantage, and also replaced all the hashes with the corresponding cheat hashes to gain money from the group. Dave was also getting frustrated with the attacker, but he didn't want to give up, they've decided to add some more complications with the entries in the notebook.

He decided to add a random number after each transaction record, which will be called as the nonce and it should be chosen in such a way that the hash of each transaction records and into zeros. For example, The Notebook entries logged as shown in the image. The first entry, Alice gave 10 coins to Carol is suffixed with the nonce, whose value is 247. This nonce 247 helps to generate a result in hash, which is ending with two zeros, as you can see in the image. Similarly, the second entry Carol gave five points to chuck has the nonce value 511 added to it, which results in a hash value ending with two zeros. Dave added nouns for each transaction in the notebook, thus creating more complexity for the records.

They've created all the transaction entries with the nouns. Now to force the transaction. Chuck needs to spend hours to find out the value of nouns which will lead to the corresponding hash. More importantly, it would be tough for even the computers to guess the nonce value. After some time, Dave realizes that there are Many transactions in the notebook and it's tough for him to manage all the records. So he decided to get all the transactions verified by Carol and then distribute them globally.

So that every computer which is working on this network has a copy of all the transaction records. This is the core principle of blockchain to transactions are stored inside the blocks which are linked to the next block through a hash value. hashes are generated in the same way. As we discussed in the example of value of nouns is added with the block to create its hash. The number of leading zeros, which are to be present in the hash is calculated through a formula, which makes sure that the block generation time does not deviate from a specific interval. For example, in the case of Bitcoin, leading zeros and nouns are calculated in such a way that a period of 10 minutes is maintained for each block in order to Example.

Every time a new transaction occurs, it has to be validated by a node, and then only it will be confirmed over the blockchain. Once every node receives the transaction, it performs a consensus on the transaction and checks whether the transaction is valid or fraud. In the real world scenario, this consensus occurs on the block, which has all the transactions coming in for a certain period. For example, a Bitcoin block has all the transactions for a period of 10 minutes, and then a new block opens up to receive other transactions. Now over attacker is facing an uphill battle, because he not only needs to change the entries within the notebook or computer held by Dave, but to cheat the system. He needs to replace all the entries present at different nodes, which are located globally.

This spreadsheet created by Dave is an example of a blog present in the blockchain and the whole chain of blocks which are interconnected to each other is called blockchain. Once a block reaches a certain number of approvals from the nodes, then it is added to the chain and a new block is opened up for the transactions. There is an entry of nouns with the block, which is a random number chosen in such a way that it leads to some leading zeros for the hash of the block. different formulas for different platforms define the number of leading zeros. The primary purpose of the miners is to guess this nouns and validate all the transactions, minus run algorithms on their computers or nodes to calculate the nouns and take the hash of the block. Once the hash of the block is in the range of the separate hash, miners can confirm the block and put it over the blockchain.

Moreover, the spreadsheet in our example or the blockchain is available globally at different locations. If somebody tries to change any data in the blockchain, then everyone who is part of the network can verify that this data was not present originally, participants can catch hold of the culprit and reject the change. That's why it is almost impossible to hack the blockchain. That was about how blockchain works. Thanks for attending this session. In the next session, we will learn about wallet digital signatures and protocols.

If you have any queries you can write to us at info at the red v two blocks.com

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.