How Bitcoin uses blockchain technology to trade

Now, because Bitcoin is talking about more and more people in the blockchain, even the idea of ​​using blockchain as a Ponzi scheme has begun to emerge. The blockchain algorithm itself is a distributed storage model that is specifically designed to solve the accounting problem. Instead of reading so many blockchain articles, it is better to read the bitcoin code more reliably.

Just like we are writing code to make a cooking device, where should your focus be? I think it should not be what language you used, what framework is used, how much the system stability parameters are, how low the cost is, and it should be that the fried dishes are not good. Just as no one pays attention to technical details, people are concerned about what it can do. No matter how good your code is written, what is the system architecture, how much hardware or model design is optimized, and how high-tech technology is used, but as long as the dish is not good, it is a waste.

In general, as long as the blockchain is referred to as “chives”, “cryptocurrency”, and “circle money”, the blockchain is actually just a model for solving the central accounting problem.

Now let us return to the essence of the blockchain's accounting system, and then according to the blockchain is a bookkeeping model.

The traditional accounting bookkeeping model is a central model. For example, Ali has a financial department, a provincial finance department, and a municipal finance department. Ali has a large number of transactions every day, and the finance department has countless bills. The accounting and accounting bills of the municipal finance department are sent to the provincial level; the provincial-level statistics are sent to the financial headquarters of Ali.

Our current financial accounting model looks like this, but big companies like Ali are exaggerated in the amount of transactions per minute. In this case, when the amount of data is small, the financial departments at all levels I counted myself, but the more I summed it up, the bigger the horror was. If someone makes a false account or someone modifies a historical bill or someone misses a certain account, it is basically a bad debt in countless massive bills. Regardless of how well the management system is doing, it is basically impossible to find out the wrong bills that have been modified.

The blockchain is an algorithmic model used to solve this financial bad debt problem.

Stage one

Here is a code that exemplifies the most basic storage model of the blockchain as simple as possible.

// Piece

Type block struct {

// timestamp

Timestamp int64

// billing data

Data []byte

// the hash value of the previous block

PrevBlockHash []byte

// hash value

Hash []byte

}

Golang's code doesn't have to be seen too clearly. Just read the comments. The block in the Bitcoin code can be understood as an account on the financial statement, and the billing time and the transaction data on the bill need to be stated on the bill.

PrevBlockHash is understood as a number for the time being and will be explained later.

This hash can be understood as the current billing time and transaction data, as well as the PrevBlockHash number, which is calculated using a strange mathematical formula to protect the bill from being modified.

If someone wants to check if the account has been modified, you need to look at the time of the book and the original data of the transaction, and then check the number of PrevBlockHash. Count all three of these data and see if the calculated number is the number in the Hash, and you know if the bill has been modified.

Such a data block can be understood as a one-by-one bill, one piece of transaction data. This is followed by a billing block, and each billing block is numbered.

The PrevBlockHash of the number 1 bill is a number, which is directly written as the number 0. This bill of number 1 is commonly called the Genesis block.

The PrevBlockHash of the number 2 bill is written with the hash check value of the bill numbered 1, and so on.

Suppose this bill now has 100 billing blocks. If someone wants to do something, make a false account and modify the data for the bill numbered 1.

The Hash number for the bill of number 1 is the billing time, the billing transaction content, and the number calculated by PrevBlockHash. The PrevBlockHash content of Bill 1 is 0. Modifying the billing time or modifying the transaction content of the bill will result in a change in the Hash number. This person has to make a false account, he must change the number of Hash to a recalculated number.

However, our bill requires the number of the PrevBlockHash of the bill of number 2 to write the Hash check value of Bill 1.

By the same token, since the number of PrevBlockHash in Bill 2 changes, the number of Hash changes.

By analogy, our current billing block is 100. In order to modify any point in the bill 1, it will result in the need to modify all the bills from 1 to 100. Otherwise, the ledger will be used as the check value is incorrect. The wrong ledger was discarded.

In this way, the previously recorded account is basically impossible to be modified. This is the advantage of the blockchain as a distributed storage and billing system, and it is almost impossible to modify the bill once it is entered. The accounting system is also a storage model that stores a model of the bill.

Stage two

The above only talks about the most basic blockchain storage model. When used in real time, Data is not a real bill, but a check value of the root node of a Merkel tree. Then add the Merkel tree and re-understand the blockchain.

// Piece

Type block struct {

// block header

Head BlockHead

// billing data

Data Merkle

}

// block header

Type BlockHead struct {

// timestamp

Timestamp int64

// billing data

MerkleRoot []byte

// the hash value of the previous block

PrevBlockHash []byte

// hash value

Hash []byte

}

// bill

Type Merkle struct {

// every transaction record

Data []byte

}

With the above Merkle parameter, the Merkel tree can be understood as a bill. Or just in the first stage, each Data is not a transaction record, it can be understood that a block record is a bill.

When there are too many transaction records, the amount of transaction data in the bookkeeping is too large, and the entire bill is involved in the calculation of the hash value. The calculation amount is too large, so it is too much trouble, so the bill is recorded by the Merkle tree.

There is not much talk about Merkel trees. If you are interested, you can check it. It is similar to the blockchain. Each tree node is calculated by the hash check value of the child nodes of this tree node.

A simple understanding, you can think of a bill through the Merkle tree, this bill has a root node, here is MerkleRoot, is a node of the tree structure, can not be understood as a check digit. As long as any byte is not matched in the entire bill, the number of MerkleRoot will change, so once the bill is completed, the MerkleRoot number of the Merkle bill is written into the block header, then any one of the entire bills. Words cannot be modified. Once any changes are made, the hash value of each transaction record on the entire tree structure needs to be recalculated.

Eventually, the number of MerkleRoot will change. Once there is a change, the hash value of the block will change. The value of the PrevBlockHash of all the bills after the entry of this bill is changed, and all the accounts after this block are completely redone. The blockchain manages the bills through such a management model.

Blockchain summary

In fact, the blockchain has been finished so far. The blockchain is actually a simple accounting model, in order to avoid someone making changes to the intended statement. Each block of the blockchain is constantly being added as the transaction record increases. Because the data of any block is locked by a perfect mathematical system, any word is unmodifiable. As long as there is any modification, all the subsequent bills from the beginning of this billing block need to be recalculated, otherwise the bill is an error. The bill will not be adopted by the system.

The current blockchain actually has three usage models: decentralized, federated, and multi-center. According to the vote, whoever's bill is the longest, according to who's bill as the general ledger.

In this way, the centralized accounting is avoided, and the person in the financial center has maliciously modified the data, and no one has managed the problem. If multiple centers are mutually restrained, each person has a complete account in hand, and one verifies that each node is calculated correctly to ensure that the bill is not modified, and then verifies the content of each block, and who pays the bill. Most (commonly known as the longest blockchain), according to who's bill as the general ledger, all other nodes update their bills after receiving the notice.

Decentralized type is that anyone can join the financial center, everyone can get the general ledger, can verify the general ledger, and can help with accounting. As long as you are right and the fastest, you can be adopted.

The alliance center type is a model in which multiple companies are mutually restrained. Many companies use this model to manage the general ledger. No company can easily modify this dynamic record that has been recorded.

The multi-center type is similar to the Chinese bank, but it is also centrally managed, but it is not a node billing, but multiple points are recorded at the same time, so that any account is not modified by the person in the financial center.

Here the blockchain has to face two serious problems. There is a limit to the number of bills that can be recorded in each bill block of the blockchain. Now a billet block size is 2 MB, which cannot exceed this size. Once the block size is to be modified, all node algorithms of the blockchain system are required to follow. Change, the price will become very high.

Here is a random number, a block assumes that it can hold 2,000 transaction records, such as Ali double eleven, 3 minutes and 01 seconds, with a turnover of 10 billion yuan. Except for five million, that is to say, 5 million bills should be written in 3 minutes. Bitcoin writes a bill of evenly every ten minutes for some reason, such as mining (described later).

6 blocks per hour, 24 hours a day, which means that Alibaba's double eleventh last year, the bill generated in three minutes, takes about 34 722 days, about 95 years to book. This bookkeeping speed is simply a joke.

This billing speed can be adjusted by algorithm, but with such a large transaction volume, increasing the billing speed will make the block easy to conflict, because it requires a small number of votes to vote for the longest bill, and the whole network informs and votes for this matter. It also takes time. Although the computer is fast, it takes time. Increasing the block size or accelerating the billing speed has a high communication cost, and it is also unrealistic when the number of bills is too large.

Stage three

Seeing that everyone should understand what a blockchain is, Bitcoin uses blockchain technology to manage its bills. It is also very clear how Bitcoin uses blockchain technology to trade. But what about bitcoin mining?

Here, the encrypted transaction process part of the cryptocurrency is not detailed, and those who are interested can check it out. I assume a model of a clear-text transaction here. The transaction records for each transaction are not encrypted and are written directly on the bill.

The management of this accounting system is implemented by algorithms. All that is needed is the “accounting” that actually writes down each account, and the “accounting” in the blockchain system is what we call “miners”.

What does the so-called miner mining mean? It means that there is no financial management in this multi-center model. Everyone is an "accountant". Every "accounting" has a complete account book in the hands of the whole system, and then starts to make accounts. Write down the next bill block in the entire blockchain, successfully write the bill in, and calculate the correct person, send your bill to everyone, and then put the accounts we each make together. Calculating the correct book and being the longest must be the first "accountant" to successfully write the bill into it.

Then according to the algorithm on the spot, he successfully recorded an account, how much should be given to him, and then distributed rewards on the spot, this is mining. However, this mining is problematic. Whoever has strong computing power, whoever gets the money is always the one who takes the money, others have no enthusiasm for work, and everyone has the same rate of bookkeeping. It is easy to crash and submit bills.

So we re-adjust the structure of this block.

// Piece

Type block struct {

// block header

Head BlockHead

// billing data

Data Merkle

}

// block header

Type BlockHead struct {

// timestamp

Timestamp int64

// difficulty value

Bits []byte

// number of goals

Nonce []byte

// billing data

MerkleRoot []byte

// the hash value of the previous block

PrevBlockHash []byte

// hash value

Hash []byte

}

// bill

Type Merkle struct {

// every transaction record

Data []byte

}

Here two parameters are added to the block header structure: Bits difficulty value and Nonce target number.

Let me talk about the reasons for adding these two parameters. The problem I just encountered is that, in a house "accounting", everyone is doing the accounts, whoever makes the account as soon as possible, after the statistical vote, everyone updates the bill, and the account book of the person is updated as soon as possible.

But counting this bill, although adding some very cumbersome algorithms, is still very simple, everyone is very fast, submitted together, and they are all right, it is easy to cause disputes. If a person is very fast, the account is always remembering, is he going to do something small? Therefore, it should still be recorded by each person, which is more reliable.

This is the "work proof mechanism" proposed by Nakamoto Satoshi, and we all should not start accounting. We all started to count a very difficult math problem, and it was a super trouble, completely useless, basically relying on the math problem of the Universiade. Who figured it out, whoever counts your account according to the process, the computer is basically written in accordance with the process of accounting, but it takes time to calculate this very troublesome math problem, and it is a math problem based on the big game, no People make sure they can figure it out. In this way, the billing time is delayed.

If you really use the blockchain as a billing system, you don't need a deliberately slowing down the billing speed, but Bitcoin is like this. It is also my opinion that this "work proof mechanism" is a resource idling, which is purely wasteful. Then I will talk in detail about what this mathematical body is.

Just now, the Hash check value calculation of the block header is calculated by using the accounting time, billing data and the hash value of the previous block. We also participate in the Hash operation by the Bins difficulty value and the Nonce number.

Let's first talk about the difficulty value of Bits. This number is calculated based on the account that I remembered before. It can be considered that in the account to be remembered, it is a certain number of written death. If you come here, you can check it yourself. data.

Bits = difficulty_1_target / current_target

So when I start to calculate the hash value of this block, this Bits can be considered not to affect the calculation result.

Then there is the Nonce target number, and the biller writes this number casually. However, since Nonce participates in the calculation, different Nonce values ​​are written, and the calculated results are different.

Then the rest of the work depends on the Mongolian, constantly trying a variety of Nonce numbers, so that the calculated Hash value is smaller than the Bits this dead number.

If you have successfully reached this number, you will quickly send the bills and the Nonce digital broadcast on the bill to all the people in the room. Everyone has verified that the bill is ok. The number of Hash calculated by the number of Nonce guessed is really smaller than the number of Bits. All the "accountants" in the house update their own bills, write your successful billing to the bill, and then calculate how much wages should be given to you on the spot.

Because the calculated Hash is smaller than the number of Bits, if the number of Bits is too large, it will cause many people to calculate it quickly. Because the current time of billing is written on the bill when the bill is posted, and the number is still not allowed to be modified, so it can be calculated to average how long a bunch of people can calculate a bill and submit it to the general ledger. . If the speed is too fast, it will be calculated in less than 10 minutes. The Bits number is slightly reduced according to the algorithm, based on the previous book record time.

Because each person has a ledger in his hand, how much to write this number, he directly calculated it, no need to control this accounting difficulty coefficient, continue to maintain the blockchain accounting system, no central unmanaged state.

At the same time, this difficulty fluctuation is used to control everyone's billing speed. That is, the bitcoin mentioned above is billed every 10 minutes on average, and a bill block is written to avoid data conflict caused by multiple people simultaneously billing.

Continue to vomit, this "work proof mechanism" is simply used to slow down the bookkeeping speed. This mode is a bit stupid, but it is very effective. It does solve the problem of how to make each other completely in a non-central model of mutual distrust. The problem of managing books between untrusted people.

supplement

In fact, there are still a lot of details, such as the model of bitcoin issuance. The reward is directly distributed according to the algorithm in the way of successful accounting. This is just a way of rewarding with Nakamoto. In order to let everyone continue to play this bookkeeping game.

In the Bitcoin system, only the "accounting" mining can obtain bitcoin out of thin air. When the accounting is successful, it is automatically obtained according to the algorithm, and the system rewards attenuation to avoid inflation.

But now more models are “accounting” without rewards. The system directly issues currency from the very beginning, and the central system issues money. In fact, it is also regulated, and the regulatory center may lead to problems such as currency control.

This bookkeeping system has nothing to remember, and it has become a bookkeeping system "bitcoin" system written by Nakamoto. In the process of accounting, a model is generated in which only the currency issued by the "accounting" is exchanged, and then the participants trade with each other. But to put it bluntly, Bitcoin is a game system, and when it is used, it is a pile of discarded data. Especially when “accounting” disappeared from the system, the accounting system collapsed. If there is no “accounting” for accounting, it will not be able to be sold, and all the orders will become scrap.

Together with the successful issuance of each bitcoin bill, the average is divided by two every four years. You successfully booked 10,000 yuan four years ago, and now successfully booked five thousand. The numbers are written by me casually, because the rewards are recorded in floating point numbers, not in mathematics, which can be infinitely subdivided, so in fact, bitcoin accounting can not get revenue from a certain moment.

Either there are ways to let "accounting" earn money or use trading commissions, otherwise "accounting" will definitely withdraw from this non-profitable game, that is, the day when the bitcoin system must collapse.

Although the game model of Bitcoin is a model that is destined to collapse, it is just a bookkeeping game. Blockchain technology is definitely not a Ponzi scheme, just a billing system.

2G/3G/GSM/4G/5G Antenna

The Description of 2G/3G/GSM/4G/5G Antenna

Frequency of 5G Antenna: 885-900mhz/1800-2170mhz

2G/3G/GSM/4G/5G Antenna is mainly used for communication, which can enhance the signal of mobile phone, computer and wireless Internet. 2G/3G/GSM/4G/5G Antenna has indoor and outdoor, Outdoor Antenna is waterproof, sun protection, lightning protection , Corrosion.

The Picture of the Description of 2G/3G/GSM/4G/5G Antenna:

2G/3G/GSM/4G/5G Antenna5G Antenna indoor 5G Antenna outdoor

2G/3G/GSM/4G/5G Antenna

4G Antenna booster

GSM Antenna

2G Antenna,3G Antenna,GSM Antenna,4G Antenna,5G Antenna

Yetnorson Antenna Co., Ltd. , https://www.xhlantenna.com

Posted on