Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!


“Block chain” three words, is undoubtedly the most popular investment concept in the past year. As the price of block chains, such as bitcoin, has soared, the interest of ordinary investors in block chains and digital money is becoming more and more interesting. Suddenly, it seems that the whole world is talking about block chains and bitcoins.

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

The block chain is like an invasion of the whole human economy, which may be more thorough than the Internet invasion. People begin to transfer, not simple information and consumption habits, but a new understanding and choice of assets.

Is the block chain difficult to understand? Here’s a beginner’s Guide

I don’t understand why people would find it difficult to understand the block chain, and I also wonder why I did not.

It was in 2013 that I heard about bitcoin for the first time. (yes, I know it’s too late). I am so poor that I can not afford to buy one, and you may have no love for it here.

Later, I want to understand the underlying technology that it relies on, that is, block chain. But it was too busy to start.

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

What is the “block chain” in the end?

The block chain is actually two things: one is the block, the other is the chain. A little bit of mystery is a block of a chain. Because it is something that exists in a computer, we can determine what its physical form looks like, that is, the digital information is divided into a block and linked together.

For example, the boxes in the following picture represent each country, and each one contains the city name of the corresponding country.

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

Wait, there’s a lot more. Every square here is a thing called hash. A Hashi is a string of characters (such as  , “1hi515AHA5H”).

Hash is derived from information contained in squares. U.S.A’s blocks have New York, Los Angeles, and Chicago cities, so its Hashi is a   like “NYLAC,” (technically far from it, but you do it).

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

Each successive box will contain the hash of the previous block, so this is a mandatory link to tie them together.

If someone tampered with the first box without authorization, joined the city   Boston, then the new Hashi would be “NYLACB”.

However, Hashi is still “NYLAC” after the India block has been stored. This kind of mismatch will break the chain. So the purpose of hash is to make sure that no one can tamper with the block.

What if someone modifies the content of a block and updates the hash of the subsequent block?  

This is also possible, but I haven’t told you one thing yet. The data of block chaining do not exist only in a single computer. The block chain data in a computer can’t fool people, because it will be copied to every user’s computer in the network.

If you add a block chain network, your computer will download the block data, and if someone has tampered with the version he owns, the entire network will consider the correct version of the majority of the computer.

Another thing is, in a block chain network, not only data, but also the whole system’s program is copied to all computers.

Most Internet applications are centralized, such as Facebook, where her data and programs are placed on her server, and your computer will get the information you need to know from the Facebook server.

But in the world of block chaining, there is nothing in the center. It depends on the user’s computer to accommodate its own program. This means that if every computer in the block chain network is turned off, the block chain system will be dead.

Public block chain

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

Does this mean that the block chain system is actually made up of a group of people with good intentions that voluntarily keep their computers running? And what are these tampering blocks for?

The efficiency of the block chain network is too numerous to enumerate. Bitcoin is a data currency and a payment system. All of its tamper resistant blocks are stored in the ledger of all transactions. Those who contributed their own computers are called miners. The system will provide them with bitcoin as a reward.

Ethereum has an additional function. It can carry your code and develop a block chain system from scratch.

It may be very difficult to build a system that belongs to you. Ethereum maintains these huge computing power, and you need to pay for those calculations.

Block chain application is not necessarily a payment system or an encrypted currency. It can be anything like a social network, a learning platform like  , LiveEdu , and so on.

Private block chain

Is the block chain difficult to understand? The 200 line teaches you to write your own block chain!

Bitcoin, Ethereum, and so on are all examples of public block chains. Anyone can be part of it.

What if we want to have a private block chain network? What do some people want to do with a private block chain? Let’s take a look at the story below.

Mark and Sara

Mark has not paid the rent for five months. When Sara asked for him, he said she would give her later. She can’t afford the lawyer’s fees, and the court’s enforcement will take 8 months or even a year, so the only choice is to persuade   Mark.

The business of Joe

Joe is a businessman who often deals with different companies. A few months ago, he signed a contract with a retailer. Although the terms of the contract had already been fulfilled, the retailer refused to pay.

These people use the loopholes in the legal system to lobby Joe, so as to achieve the purpose of paying less. Joe has had this experience before, and in some cases he would find a court for help, but the time and money spent to do so have to lose his own profit.

How do we help Sara and Joe?

Can we solve this problem elsewhere? In the case of Sara, we need to let Mark   pay the rent monthly, which is actually a time – based trigger mechanism. Your calendar program uses such triggers to give you notification of preset events.

In the Joe scenario, once the terms of the contract are satisfied, the parties have to pay. This is actually a conditional trigger mechanism. When you think about buying e-books from Amazon last time, do you have to confirm payment first, and Amazon will send e-books to you?

The point is that computer programs will consistently execute such instructions. When you click on this article, scroll down, such as this kind of operation, it will follow the execution. To help Sara, we need to turn the terms of the contract into code.

Pseudo code for intelligent contracts between Sara and Mark

If  today ‘s  date  is  30th  and  rent  is  not  paid  thenTransfer 

But where do we deploy these codes? It should be deployed to all participants’ computers. Sara’s   and Mark banks will be part of this private block chain network.

Joe and Sara will sign a coded protocol (that is, an intelligent contract), and the agreement will be distributed to the network, and both the Mark and the Sara banks have a copy.

On the 30 of every month, when the clock pulsate to 12 o’clock, the agreed amount would be transferred from Mark account to Sara account. Joe also began to use intelligent contracts to force his clients to pay the good loans.

Sara is happy because she no longer needs to worry about whether Mark will pay the rent as agreed. Joe is also happy, because he doesn’t need to find a court to talk about it, so he can continue to develop his business.

The private block chain is restricted to all parties involved in the business, so Joe will not be part of the chain network of Sara and Mark.

爱上海419论坛 爱上海