为广大币圈朋友提供币圈基础入门专业知识!
当前位置首页 > 区块链知识> 正文

区块链双花的解决办法,区块链双花问题

发布时间:2023-12-06-07:46:00 来源:网络 区块链知识 区块   铸块双花

区块链双花的解决办法,区块链双花问题


请查看相关英文文档

『一』What is the concept of double flower theory

In the process of learning blockchain, you will definitely hear the word "double flower", which means double A payment, or more simply a sum of money being spent twice. In this article, we will briefly analyze why double spending occurs and how Bitcoin avoids double spending.

In traditional transactions, because there are centralized institutions like banks, there is no double-spending problem: every payment will deduct the corresponding funds from your bank account. All details are recorded in the bank. But in Bitcoin, because there is no concept of an account, UTXO, that is, unspent transaction output, is introduced. Because there is no guarantee from a centralized institution like a bank, there may be a risk of double spending when a transaction occurs: For example, A has a Bitcoin, and then he constructs two transactions T1 and T2 at the same time to spend this 1 bit. Coins, one of them was given to B to buy a piece of clothing from B, and one was given to C to buy a pair of shoes from C. If some mechanism is not introduced to avoid this situation, Bitcoin as a digital currency will have no meaning in existence. Next, let’s analyze how Bitcoin prevents this “double spend” attack.

(1) Normal situation

First, let’s take a look at the normal situation. To put it bluntly, most of the time, the consensus mechanism of the blockchain can eliminate double spending. embryonic state. Let’s use the example mentioned above to illustrate:

Suppose A constructs two transactions T1 and T2, and transfers its UTXO worth 1btc to B and C respectively, in an attempt to obtain funds from B and C at the same time. C gets the benefit there. Then A broadcasts the two constructed transactions to the network almost at the same time.

Assume that the miner node in the network first receives transaction T1 and finds that the source of funds for this transaction has indeed not been spent, so it adds T1 to its own memory transaction pool and waits to be packaged into a block.

In most cases, the miner node will receive transaction T2 soon. At this time, because the transaction input pointed to by T2 is the same as T1 that has been added to the transaction pool, the miner node will refuse to process it. The transaction. Other miner nodes in the network are similar, so A's attempt to double spend was aborted.

(2) Fork situation

The above is a normal situation, but there are also abnormal situations to consider: Assume that miner nodes M1 and M2 mine at almost the same time A block was created, and unfortunately M1 only received transaction T1 when it mined the block, while M2 only received transaction T2 when it mined the block. In this way, transactions T1 and T2 were packaged into two blocks respectively. Because these two blocks were mined at about the same time, they caused a fork in the blockchain:

Some nodes in the network (probably close to M1) first received the block BLK1 packaged by M1, and then used this block to extend their own blockchain, while other nodes (near M2) received the M2 package first. Block BLK2, use this block to extend your own blockchain, so the entire blockchain network

『二』What you need to know about "Double Spending"

If Xiao Ming What about using digital currency instead of cash?

"Double Spending" Problem

"Double Spending" means that a sum of money is spent twice or more, also called "double spending".

In the digital currency system, due to the replicability of data, the same digital asset may be reused due to improper operations.

1. 51% attack

51% attack is also called Majority attack. This attack achieves double spending by controlling the network's computing power. If an attacker controls more than 50% of the computing power in the network, then during the period when he controls the computing power, he can reverse the block, conduct reverse transactions, and achieve double spending.

For example, the double-spend problem that occurred in Bitcoin Gold is a 51% attack. The attacker controls more than 51% of the computing power on the Bitcoin Gold network. During the period of controlling the computing power, he sent a certain amount of BTG to his wallet on the exchange. We named this branch branch A. At the same time, he sent these BTG to another wallet he controlled. We named this branch branch B.

After the transaction on branch A is confirmed, the attacker immediately sells BTG and gets cash. At this time, branch A becomes the main chain. Then, the attacker mines on branch B. Since it controls more than 51% of the computing power, the attacker has a high probability of obtaining accounting rights. So soon, the length of branch B exceeds the main chain, and is the length of branch A, then branch B will become the main chain, and the transactions on branch A will be rolled back (rollback refers to a program or data processing error and the act of restoring the program or data to the last correct state) .

In other words, branch A is restored to the state before the attacker initiated the first transaction, and the BTG that the attacker had previously converted into cash are back in his hands. Of course, these BTG are the exchange’s losses. Finally, the attacker sends these BTG to another wallet of his. In this way, the attacker controlled more than 51% of the computing power to achieve "double spending" of the same token.  

2. Finney attack

The name "Finney" comes from Hal Finney, who was the first to describe a double-spend attack with 0 confirmations ( Unconfirmed) transaction person. The Finney attack mainly achieves double spending by controlling the broadcast time of blocks. The attack targets merchants that accept 0 confirmations.

Assume that an attacker mines a block. The block contains transaction information, that is, address 1 transfers a certain number of tokens to address 2, but both addresses are attackers. of. But the attacker does not broadcast this block, but immediately finds a merchant, uses his address 1, and sends these tokens to the merchant's address 3.

After the transaction sent to the merchant is broadcast, if the merchant accepts 0 confirmation, the attacker will broadcast the block he mined before. At this time, the transaction sent to himself will be sent before Transactions to merchants. For attackers, by controlling the broadcast time of blocks, they can achieve "double spending" of the same token.

Generally speaking, it is very unsafe to accept 0 confirmations in order to save time, especially for large-amount transactions, and for large-amount transactions, more confirmations will Reduce the risk of transactions being rolled back.

3. Race attack

This method mainly achieves double spending by controlling miner fees.

For example, the attacker sends a certain number of tokens to a merchant, which we name branch A. If the merchant accepts 0 confirmation, then the attacker will send the token to one of his own wallets, which we name branch B.

However, the attacker added a higher miner fee to the transaction sent to himself, thereby greatly increasing the probability of being packaged by miners (it can also be said to indirectly increase the probability of successful attack) . If the transaction sent by the attacker to himself is packaged in advance, this transaction will precede the transaction sent to the merchant. That is, the length of branch B exceeds the length of branch A, and the transaction on branch A will be rolled back. . For attackers, by controlling the mining fee, they can achieve "double spending" of the same token.

4. Vector76 attack

Vector76 attack is a combination of racial attack and Fenney attack, also known as "one confirmation attack", that is, even if the transaction is confirmed once, Transactions can still be rolled back.

If the electronic wallet meets the following points, the Vector76 attack is easy to occur. These points mean that the wallet accepts payment once confirmed; the wallet acceptsSubject to direct connections from other nodes; the wallet uses nodes with static IP addresses.

The specific attack method is as follows (if you are interested, you can click here to view):

The attacker controls two full nodes, and full node A is only directly connected to the electronic wallet node. , full node B is connected to one or more nodes that are running well.

Then the attacker conducted two transactions with the same token. One was sent to the attacker's own address on this wallet (which will be attacked next). We named it transaction 1, and the other One is sent to the attacker's own wallet address, named transaction 2. However, the miner fee paid by the attacker for transaction 1 is much greater than the miner fee for transaction 2. The attacker did not broadcast these two transactions to the network.

Then the attacker started mining on the branch where transaction 1 is located, which we named branch 1. After the attacker mined the block, he did not broadcast it, but did two things at the same time: sending transaction 1 on node A and sending transaction 2 on node B.

Since node A is only connected to the electronic wallet node, when the electronic wallet node wants to transmit transaction 1 to other peer nodes, node B, which is connected to more nodes, has already broadcast transaction 2 given to most nodes in the network. Therefore, from a probability perspective, transaction 2 is more likely to be deemed valid by the network, and transaction 1 is deemed invalid.

After transaction 2 is considered valid, the attacker immediately broadcasts the block he previously mined on branch 1 to the network. At this time, the wallet that accepts payment with one confirmation will immediately pay the token to the attacker's wallet account. Then the attacker immediately sells the token and gets cash.

Since branch 2 is connected to more nodes, the miner mines another block on this branch, that is, the chain length of branch 2 is greater than the chain length of branch 1. As a result, the transaction on branch 1 will be rolled back, and the transaction information previously paid by the wallet to the attacker will be cleared, but the attacker has already withdrawn money, achieving a double spend.

5. Alternative history attack (Alternative history attack)

If the merchant is waiting for transaction confirmation, an alternative history attack may occur. Of course, this requires the attacker to have high For attackers, there is a risk of wasting a lot of power.

The attacker sends a certain number of tokens to a merchant, which we name branch A. At the same time, the attacker sent the token to a wallet of his own, which we named branch B. While the merchant is waiting for confirmation, the attacker mines on branch B.

After waiting for N confirmations, the merchant sent the goods to the attacker. However, if the attacker mines more than N blocks with a high hash rate, then the length of branch B will exceed that of branch A, and the transaction of branch A will be rolled back, and the attacker will achieve a double spend. If the number of blocks mined by the attacker does not exceed N, the attack fails.

The possibility of a successful alternative history attack depends on two aspects. One is the proportion of the attacker's computing power in the network, and the other is the number of confirmations the merchant waits for. For example, if the attacker controls 10% of the computing power in the network, if the merchant waits for 2 confirmations, the probability of a successful attack is less than 10%; if the merchant waits for 4 confirmations, the probability of a successful attack is less than 1%; If the merchant waits for 6 confirmations, the probability of a successful attack is less than 0.1%. Due to the opportunity cost of this attack, the game is only possible if the token transaction amount is similar to the block reward amount.

At present, the official solutions given by several blockchain projects mainly include the following:

1. Increase the number of confirmations. For example, LCC recommends increasing the number of confirmations to 100.

2. Improve the consensus mechanism. For example, LCC stated that a PoS mechanism may be introduced.

3. Upgrade new algorithm. For example, Bitcoin Gold stated that it is developing a new PoW algorithm to replace the original Equihash algorithm.

4. Cooperate with exchanges, etc. For example, Bitcoin Gold immediately cooperated with partner exchanges to block hackers’ cash-out channels.

Link: https://www.jianshu.com/p/56617e91b12a

Link: https://www.jianshu.com/p/0eb023e1d5dd

『三』 The whole story of Double Spending Incident on Filecoin network, what is Double Spending

On March 18, when the majority of investors were immersed in the carnival that FIL currency was about to break through a new high of 100U, many media outlets in the evening It was reported that a double-spend vulnerability was suspected to have occurred on the Filecoin main network. Many leading exchanges closed the recharge function of FIL coins, and the price of FIL coins was once reduced to 74U.

Subsequently, Filecoin officials immediately conducted an investigation and said that no network problems or API vulnerabilities were found. The root cause of this problem was that the exchange Lotus API was used incorrectly, and there was only one transaction. affected by this problem. The Lotus team is working with all exchangeswork, correct their use of the API, and determine usage specifications.

Major media have forwarded official reports one after another to clarify the facts. At this point, the double-spending issue on the Filecoin mainnet has basically come to an end.

You may have questions, what is the "double spend problem"? Why does it have such a big impact? To put it simply, according to the literal meaning, a sum of money is spent twice or multiple times. It’s like I spent 100 yuan shopping with Alipay. As a result, there was a bug in the Alipay system, but there was no such thing in my balance. The money is deducted, and then I use the 100 yuan to eat. This is a double spending problem! If this works, there will be no trust left in the blockchain.


How did the double-spend problem arise?

1. Control more than 51% of the computing power: when the first transaction passes verification After it is recorded in the block, a new block chain will be verified with better computing power in the network, and the digital asset will be spent a second time in the new chain because the new block chain is longer. , this will cause the blockchain where the first transaction is located to be abandoned, and the digital assets spent for the first time will be returned to the account, which results in a double spend. Therefore, in the Filecoin network, the official also controls that the effective computing power of a single node cannot exceed 20% of the entire network. This is also to avoid the phenomenon of controlling the computing power of the entire network, and now the effective computing power of the Filecoin network has reached 3.377EB. The cost of a powerful attack is too high;

2. Time difference: Due to the consensus mechanism, the block confirmation time is long, and a certain amount of digital currency is used for transactions. Before the transaction is completed before it is confirmed, it will be done again. Conduct secondary transactions;


What "double spend vulnerabilities" have appeared in history

In 2018, a miner controlled at least BTG (Bit Gold ) 51% of the computing power, successfully stole 380,000 BTG from the exchange, with a current value of up to 12 million US dollars;

In 2019, the attacker rented more than 51% of the computing power and carried out a double-spend attack, with a profit of at least 5.4 Ten thousand ETC, currently worth approximately US$650,000;




『四』One sentence explanation Blockchain, why don’t you understand it?

Blockchain is an extremely popular concept now. It is talked about almost everywhere and almost everyone is talking about it. However, it seems that not many people really understand.

You must have seen articles like this on the Internet: "Tell you what blockchain is in X minutes", "Explain blockchain in X pictures", etc., but after reading it, you still think In the fog.

You must have heard someone explain blockchain in one sentence: Blockchain is a distributed ledger.

It’s indeed a sentence, but I know you still didn’t understand it.

You don’t understand what “distributed” is, let alone what “distributed ledger” is. What’s especially confusing is: isn’t it just a ledger? How come it has become a technology that will change the world? ?

Since you don’t understand this explanation, let me try to explain the blockchain from another angle.

Of course, it’s also a sentence.

Let us think about it carefully. No matter how mysterious blockchain technology is, it is just a tool. As long as it is a tool, it is used to solve certain problems.

From this perspective, blockchain technology is no different from the hammer in your home: the hammer is a tool, and the problem to be solved is the nail on the wall.

If a tool is difficult to explain "what it is", then ask another question: What does it solve? Could answering this new question help us finally understand this tool?

For example:

Epacadostater is an extremely complex molecular compound that represents the highest technological achievement in the field of biomedicine today. If you talk about the definition, it is almost impossible for you to explain to a layman what it is; but starting from the problem it solves, this magical drug can be explained clearly in one sentence: It is a specific drug for the treatment of AIDS.

This time, I know you must understand. Not because you understand the definition of Epacadostater, but because you understand the problem it solves: AIDS.

Therefore, this way of thinking is completely feasible by understanding the problem to understand the tool.

So, what problem does the blockchain want to solve?

A simple explanation in one sentence: Blockchain technology is an effective solution to the double-spend problem.

Okay, I admit I lied to you, but you still don’t understand. But don't hit me yet, we are actually very close.

Look at these two sentences:

The key to these two sentences is: you understand AIDS, but you don’t understand the "double spend" problem. It is precisely because of this The difference in cognition means that you can understand the first sentence but not the second sentence.

Therefore, understanding the double-spending problem is the key to understanding the blockchain!

Let’s solve it belowExplain what the "double spend" problem is. Although it is not a sentence, it is not difficult to understand.

Starting from WeChat, which we use daily, you must be familiar with the following two scenarios:

On the surface, the two scenarios seem to be similar, but in fact, there are huge differences!

If you send a photo to someone else, the photo is still there, but the money is not. Why?

Maybe you think it should be like this: If the money was still there, wouldn’t everyone have endless money to spend (dreams come true)!

No , the reason behind this is not ordinary at all. Let me explain why.

Now, each of us has to face two different worlds at the same time: a physical real world and a virtual network The world (mobile phones, computers, Internet, etc.), the former is composed of atoms and molecules, while the constituent elements of the latter are "digits". Let me call the second world the "digital world"

The "digital world" is one of mankind's greatest inventions. Many tasks that are difficult to accomplish in the real world can be easily accomplished in the "digital world."

For example, in the real world, You have a paper photo that you want to share with your distant friends and also want to keep a copy for yourself. To do this, you need to go to the photo studio to copy it and then send it to the post office. Not to mention troublesome, it also takes time .

And all this in the digital world, you only need to click on your mobile phone, and in an instant, your distant friend will receive this photo. It is very convenient.

Why is it so convenient?

In the real world, molecules and atoms are not easy to copy, and there is no way to transmit them at high speed. In the digital world, numbers are extremely easy to copy and can be transmitted at high speed (in fact , when you send a photo on your mobile phone, you are sending a copy of the photo. Copying is a natural thing in the digital world).

Relying on this characteristic, the digital world provides far beyond The convenience of the real world has greatly changed our lives.

However, people find that this convenience encounters a huge difficulty: how to transmit "money" in the digital world?

In the real world, if you give 100 yuan in cash to your friend, you will naturally have less of this 100 yuan in cash, and your friend will naturally have more of this 100 yuan in cash. This kind of physical operation , no need for others to intervene.

However, in the digital world, the components of everything are numbers. There is no difference between 100 yuan (or other valuable things) and photos, they are all numbers. Numbers can be easily copied and transmitted.

But youObviously you cannot transfer money by transferring photos (copying digital copies). If the photos are transferred, you can keep an original copy, but if the money is transferred, you cannot keep the money.

In other words, in the digital world, you can have countless copies of your photos, but you can only have one copy of your "money". When "money" circulates between different owners, it must be its "real person", which just changes the owner, unlike photos that can have multiple "doppelgangers".

Because this "uniqueness" is inconsistent with the nature of the digital world, additional mechanisms must be in place to ensure this. Otherwise, once the money can be copied, you can first transfer 100 yuan to one person, and then transfer the copy to other people. This is equivalent to a 100 yuan being spent twice. This is the so-called "double spending problem". )".

To sum up, although the "double spending" problem can make everyone have more money to spend, the modern financial system absolutely cannot accept this.

How to solve it? You are familiar with the previous solution, which is the bank. The bank is responsible for recording the owner of each money.

The bank will give each person an account. After your transaction is completed, the bank will do the following: record that there is a loss of 100 yuan in your account, and record that there is an increase of 100 yuan in your friend's account. The yuan just changed owners and was not copied. Here the bank acts as a trusted intermediary.

But the banking system has various problems:

It is slow and it may take several days to transfer a sum of money. This is not the efficiency that the digital world should have.

Risk: Banks are vulnerable to hacker attacks.

Expensive, high handling fees, you know.

For these reasons, we don’t want banks to be the “intermediaries”. Is there any other way to solve the double-spending problem mentioned above without any intermediary?

For a long time, the answer was no.

There is no way to solve the double-spending problem in a digital world without banks. Until one day, a genius came up with blockchain technology, and everything changed from then on!

Blockchain technology is an effective solution to the double-spending problem. It allows humans to fully enjoy the advantages of the digital world in transactions for the first time, which is fast, safe, reliable and cheap. With blockchain technology, you can transfer money to friends just like sending photos, and more importantly, there is no bank in the whole process!

Perfect!

The following is a summary of this article:

1. Don’t understand blockchain from the definition of blockchain.But start with the problems it solves.

2. The real world is composed of molecules and atoms, which are not easy to copy and transmit.

3. Everything in the digital world is composed of numbers, which solves the problem of difficulty in copying and transmitting in the real world, but brings new double-spending problems.

4. Building a bank-centered network can solve the double-spend problem in the digital world, but it also brings other problems: low efficiency, high cost, poor security, etc.

5. Blockchain technology solves the above problems. The explanation in one sentence is: Blockchain is a tool that can solve the double-spend problem in the decentralized digital world.

I hope after reading this, you can understand what the blockchain does by understanding the "double spend" problem. As for how the blockchain works specifically, I will introduce it to you in a subsequent article.

Finally, I made up Epacadostater, there is no such thing.

『五』‘Double Flower’ Attack

What is Double Flower?

"Double spending" means that a sum of money is spent twice or more, also called "double spending". In layman's terms, a "double spend attack" is also called a "double spend attack", that is, the same amount of funds is spent twice in some way, and services exceeding the amount of funds are obtained.

In the digital currency system, due to the replicability of data, the same digital asset may be reused due to improper operations.

How does a double spend happen?

It is known that blockchain nodes always consider the longest chain as the correct chain and continue to work and extend it. If two nodes broadcast different versions of a new block at the same time, work will be done on the first received block, but the other chain will also be retained in case the latter becomes the longest chain. When the next proof of work is discovered and one of the chains is confirmed to be the longer one, the nodes working on the other branch chain will switch camps.

A double spend simply means spending it twice. How is double spending achieved? Divided into two situations:

(1) Double spending before confirmation. Transactions with zero confirmation may not be written to the blockchain in the end. Unless the amount is small, it is best to at least wait for confirmation to avoid such double spending.

(2) Double spending after confirmation. This requires controlling more than 50% of the computing power to be implemented. That is, it is similar to a small fork that puts transactions for a store into an orphan block. This kind of double spending after confirmation is difficult to implement, but it is only theoretically possible.

Double-spend attack case

In 2018, a double-spend attack occurred on Bitcoin Gold (BTG). BTG was the 27th largest cryptocurrency in the world at the time, with a circulating market value of 5 billion yuan. Since May 16, 2018, attackers have successfully implemented a double-spend attack on the BTG network, making huge profits of more than 388,000 BTG.

The attacker controls more than 51% of the computing power on the BTG network. During the period of controlling the computing power, he sends a certain amount of BTG to his wallet on the exchange. We name this branch branch A. At the same time, these BTG are sent to another wallet controlled by themselves. We name this branch branch B. After the transaction on branch A is confirmed, the attacker immediately sells BTG and gets cash. Subsequently, the attacker mined on branch B. Since it controlled more than 51% of the computing power, the length of branch B soon exceeded the length of branch A. Branch B would become the main chain, and transactions on branch A would It will be rolled back to the last state. The BTG that the attacker had previously converted into cash are back in his own hands. These BTG are the losses of the exchange. In this way, the attacker achieved "double spending" of the same cryptocurrency by controlling more than 50% of the computing power.

『Lu』Introductory science: What is a double flower

If you want to understand the blockchain, you must first be familiar with various terms related to the blockchain. For example, the "double flower" we talked about today, some people may ask, what kind of flower is double flower? Hahaha, just kidding, let’s learn what “double spending” is.

01

What is "double flower"?

Double payment is also known as "double spending", which means double spending. For example: If I have 100 yuan in my wallet, I can buy items of equal value. When I went to the store, I found that the lamp and the table both cost 100 yuan, so I could only buy one of them. What we call the double-spending problem is just the opposite. I can buy two things with the same 100 yuan.

In the cryptocurrency system, due to the replicability of data, the system may have the same digital asset being used repeatedly. This is also called a double spend, also called a double consumption attack.

02

How does the double spend problem occur?

In the blockchain system, the double-spending problem will occur under the following circumstances:

1. Due to the long block confirmation time due to the consensus mechanism, if you use a digital currency to conduct a transaction, you can conduct a second transaction before the transaction is confirmed.

2. Control the computing power to achieve double spending. After the first transaction is verified and recorded into the block, there will be higher computing power in the network to verify a new and longer chain. , the money is spent for the second time in the chain. Since the block chain spent the second time is longer, the chain where the first transaction block is located is an invalid chain. In this way, the block where the first transaction is located is invalid. The blockchain is abandoned by the blockchain network, and the money spent for the first time returns to your own account, which leads to the double-spending problem.

03

How does Bitcoin avoid the double-spend problem?

In order to solve the double-spend problem, our daily use of digital assets relies on third-party trust institutions. Such institutions centrally manage data and prevent double payments by modifying account balances in real time. As a decentralized peer-to-peer value transmission system, Bitcoin solves the double-spend problem through the integration of UTXO, timestamp and other technologies.

1. First, each transaction must first confirm the previous situation of the corresponding Bitcoin and check whether it exists in the user's UTXO. If not, the transaction will be rejected by the system.

2. If a user uses the same UTXO to pay two people, the nodes in the system will only confirm the one received first.

3. When two transactions that are very close in time are confirmed by different nodes, the blockchain will fork. The remaining nodes choose to build new blocks on the chain they believe is the longest.

4. When one of the transactions is confirmed by 6 nodes, it will become the longest chain in the system, and it can be considered that the transaction has received final confirmation.

『撒』 In the blockchain, what is the double-spend problem?

What is the double-spend problem?

The double-spending problem simply means that a sum of money can be spent two, three, or many times. Why has the double-spend problem become such an important issue in the Bitcoin system?

The reason is: Bitcoin is a virtual currency. It is virtual, presented in the form of code, and can be copied. Once a code vulnerability is breached, the same Bitcoin can be used repeatedly, making "money" like Bitcoin useless.

Let’s think about it, if a sum of money can be spent many times, you have 500 yuan, you buy a 500 yuan piece of clothing, it can be recycled, and you buy another pair Shoes costing 500 yuan, in this case, can money still be called money?

So, when Satoshi Nakamoto set up the Bitcoin system, all his technical methods basically focused on solving

The "double spend problem" is to protect Bitcoin as a currency and its own function as a payment method.

Actually, this double-spend problem is not a problem at all in our current centralized world, because there are banks, and money transaction settlements are all done through banks, which is very safe. If you have any questions, go directly to the bank.

However, in the decentralized world, there is no central institution like a bank, and it must ensure that a sum of money can only be spent once. How to prevent "double spending" under the premise of decentralization? question", this is a difficult problem.

Insert a sentence here, why does Satoshi Nakamoto pursue "decentralization" so persistently? Are you asking for trouble? No, he hopes to solve some social problems through decentralization, the most important of which is inflation caused by excessive issuance of currency by authorities.

So, let’s summarize his logic: Centralized currency issuance leads to inflation – so we must achieve decentralization – decentralization faces many problems, the biggest problem is the double-spending problem ——So we have to solve the double-spending problem—how to solve the double-spending problem?

Here, Satoshi Nakamoto introduced the concepts of UTXO and "timestamp", relying on these two methods to solve the double-spend problem.

『8』Bitcoin 8, the originator of the blockchain: double-spending payments caused by forks, 51% attacks and solutions

Forks

As mentioned earlier, Bitcoin solves the time sequence through the unique design of blockchain + proof of work, but there is no guarantee that two nodes will calculate the correct solution at the same time, although this possibility is very low. This brings about the fork of the block.

Although it is extremely unlikely that two nodes will calculate this mathematical problem at almost the same time, there is still such a possibility, so the fork means that the same block may be followed by on two different blocks.

The rules are broken until the next block is solved. will immediately move to the longest block, while those shorter blocks will be discarded. Mathematical problems make it difficult for blocks to be broken up simultaneously. It is even more difficult to have it happen multiple times in a row. Eventually the blockchain will stabilize. That is to say, everyone reaches a consensus on the order of the last few blocks. A fork means that, for example, if your transaction appears on a shorter fork, it will lose its place in the blockchain. Generally speaking, it only means that he will return to the unconfirmed transaction pool. Then it is included in the next block.

How does the Bitcoin network solve double-spending payments caused by forks?

Unfortunately, the potential for transactions to lose their block position jeopardizes the original ordering system.System prevents duplicate payment attack opportunities. Consider the following attacker A, who first exchanges his own bitcoins for the goods of node B, which he immediately pays himself. Then it worked hard to create a longer chain so that its own payment could replace the payment of node B, thereby achieving double payment. Node B neither received money nor lost the goods.

At this time, the transaction will be returned to the unconfirmed pool, because node A has replaced it with the same input transaction. The node will consider Bob's transaction invalid. Because it has been used.

You may guess that node A will pre-calculate a blockchain and then seize the opportunity to publish it to the network. But the mathematical puzzle of each block blocks this possibility. As mentioned before, unlocking a block is a process of guessing a random number. Once the answer is found, the solved hash becomes a fingerprint-like identification of the block. As long as the content of the block changes even slightly, the reference value of the next block will be completely different. The result of this mechanism is that blocks cannot be replaced in the blockchain. The lower block cannot be unlocked until the previous block is obtained. The fingerprint of the previous block is also one of the arguments of the hash function.

At the same time, the workload proof mechanism also solves the problem of who is the majority when voting collectively. If the way to decide the majority is based on IP addresses, one IP address, one vote, then if someone has the power to allocate a large number of IP addresses, the mechanism is broken. The essence of the workload proof mechanism is one CPU, one vote. The "majority" decision is expressed as the longest chain, because the longest chain contains the greatest amount of work. If the majority of CPUs are controlled by honest nodes, then the honest chain will extend as quickly as possible and surpass other competing chains. If the attacker wants to modify a block that has already appeared, the attacker must re-complete the workload of the block plus the workload of all subsequent blocks, and eventually catch up with and surpass the workload of honest nodes. We will show that, assuming a slower attacker tries to catch up with subsequent blocks, the probability of success decreases exponentially. Another problem is that the computing speed of hardware is increasing rapidly, and the degree of node participation in the network will fluctuate. In order to solve this problem, the proof-of-work difficulty will be determined using a moving average target method, that is, the difficulty is directed to make the speed of generating blocks per hour a predetermined average number. If blocks are generated too quickly, the difficulty increases.

If there was a super computer, could it win the block-solving puzzle?

Even a supercomputer,Or it would be difficult for hundreds or thousands of computers to win in solving a block, because the competitor is not any computer, but the entire Bitcoin network. You can compare it to buying a lottery ticket. Operating thousands of computers is like buying thousands of lottery tickets.

What does 51% attack mean

Based on the previous example, we know that if we want to have a 50% probability of winning ahead of others in solving problems, we need to master all the More than 50% of the network’s computing power. To continuously solve blocks ahead of others, one needs to have much higher computing power. So transactions in the blockchain are protected by mathematical competitions. Malicious users must take on the entire network. As a result of the establishment of block connections, transactions at the front of the branch chain are safer. Malicious users must defeat the entire network over a longer period of time to achieve repeated payments and replace the previous blockchain. Therefore, only the end of the system is vulnerable to double payment attacks. This is why the system recommends waiting for a few more blocks before confirming successful payment.

Personal blog: https://dreamerjonson.com/

『九』 The secret hidden in the characteristics of currency circulation, how DCEP elegantly solves the "double-spending problem"

We have already discussed in the previous article that the account system can perfectly solve the double-spending problem that occurs when data is used as currency. However, due to this account mechanism, the circulation of currency loses its parallel characteristics, making it difficult to An independent system can accommodate a large number of transactions at the same time.

So, how can we enable these accounts to achieve parallel processing of data?

Think about the account structure in another way.

In our previous account system, different user accounts recorded a number. We used a number to represent the amount of currency held by a user. But now we no longer use a number to represent the currency amount of the account, but instead turn each currency into an independent data segment and record it in the ledger.

When a user wants to conduct a transaction, he only needs to select a part of the currency, copy these currencies to the new user, and mark the currency in the original user's hand as invalid.

Assume that there are 100 pieces of currency representing one yuan in Zhang San’s account. Each one-yuan currency has a unique number. Then when Zhang San transfers 50 yuan to Li Si, Zhang San You only need to select these 50 currencies in your account and tell the account manager that I want to transfer these 50 currencies to Li Si. After the account manager receives such an information request, he will mark the 50 currencies in the account as invalid. At the same time, 50 new one-yuan currencies were generated in Li Si's account.

This processing method is now used in the so-called Bitcoin UTXO structure. Its advantage is that it allows currency to be transferred from multiple accounts to multiple accounts at the same time. The system will automatically add a timestamp during the transaction. If a user uses the same UTXO to pay two people, the nodes in the system will only confirm the one received first.

However, the actual implementation of Bitcoin transactions does not adopt the approach of 50 pieces of one dollar, but allows each currency to have its own denomination.

This is also easy to understand, because since currency can be generated and destroyed, why not directly generate a 50 yuan ticket, which is simpler and more convenient.

In the Bitcoin account ledger, currency is recorded in the form of a string. Each currency has its own independent ID. This ID is determined by the UTXO transaction hash value and the position index in the UTXO.

The advantage of this accounting method is that the transaction logic is clear. It can analyze the dependencies between transactions through algorithms and will be able to achieve a certain degree of parallel processing of transactions.

Although the problem of parallelization is solved and the concept of real currency exists in the system, users do not actually own these currencies, they are stored on the blockchain.

In this case, why don’t we let users “hold” these currencies?

It sounds like this is just a simple operation, as long as the data record of this currency is taken from our ledger to the user.

But this small change can make our entire system achieve a qualitative leap.

In fact, this is the design logic of DCEP.

Let users actually hold a string representing currency in their hands. These string data are signed using digital signature technology to ensure that the currency is indeed issued by the central bank.

In this way, the entire DCEP system gets rid of the original ledger. What circulates in the system is not just value, but cash. All user transactions will be expressed as an exchange process of encrypted strings. In this way, the equivalence relationship between the currency circulation process and cash is truly realized.

This method can truly make the circulation of digital currency simulate the circulation of real currency, which is fundamentally different from any existing ledger recording method.

In the original ledger form, all the user has is a string that proves your identity.It's not cash. Cash is placed in the hands of the bookkeeping agency. In other words, what the user owns is only the value of the currency, not the physical properties of the currency. Users never know what the governing body is doing with its own cash.

In addition, in daily life, users do not pay attention to the serial number of the currency stored in the bank. They just need to consider the denomination of the currency when using it. Such a design will cause the currency to exhibit different characteristics from real cash.

For example, the currency recorded in the account can be divided. In theory, this division can be carried out indefinitely. There is no difference between two identical dollars in the account system. They are just a number recorded in the system.

Speaking of this, I have to mention a concept from the blockchain industry-NFT.

This concept differs from the way a bank account records value. Its full name is non-fungible token.

To put it simply, every currency is different. Just like cash, although two pieces of one-hundred-dollar currency are both worth one hundred yuan, they are physically different.

In reality, every real currency can be truly held by anyone. The physical properties and value of money are managed uniformly. Each currency also has a unique number, which can be used to track the currency and also ensures the independence of the currency itself. Every currency is indivisible. We cannot tear a hundred dollar bill in half and use half of it as fifty dollars. Then, if we need to adjust the denomination of currency, we must exchange the currency in hand.

The difference between the above two systems is essentially the difference between cash and accounts.

From this perspective, the design model of DCEP shows that it is a real cash.

Any of its attributes, including circulation characteristics, are exactly the same as real cash.

On this basis, because data can be transmitted and managed remotely, DCEP has greater advantages than cash.

As a manifestation of cash, DCEP’s technical design cannot of course be completed by an account mechanism.

Although digital currency can achieve parallel currency circulation after reaching the hands of users, considering that the data itself can be copied, the digital signature used to ensure the authenticity of DCEP even After being copied, it can also be correctly verified. We still need to solve the "double-spending problem" of digital currency.

The solution to this problem lies inAmong the circulation characteristics of gold currency.

As mentioned before, every piece of cash has a unique number.

In fact, this number is the key to solving the DCEP double-spending problem. Through numbering, we can solve the "double spend problem" elegantly.

The "double spend problem" simply means that the payer has paid a sum of money to the recipient, but still has control over the transferred currency. In other words, the money is owned by two people at the same time.

From this perspective, the core point of avoiding currency "double spending" is to ensure that a currency can only be owned by one person at the same time.

In the DCEP scenario, through the number of the DCEP itself, we can successfully track the owner of each currency.

Therefore, under the DCEP system, the way to solve the problem is to construct a registration center to record the mapping relationship between the DCEP string number and the owner's identity number.

As described in the process in the figure, when Alice sends a digital currency to Bob, Alice first sends Bob the digital currency string she owns. At the same time, Alice will also notify the digital currency registration center that the ownership of her currency 0x001 has been transferred. The digital currency registration center will verify Alice's identity based on the digital signature information sent by Alice and ensure that Alice is indeed the owner of currency 0x001, and then modify the ownership record of this currency to Bob.

Although we use a registration center to record identity changes for all currency transfer processes, this center does not limit the performance of the entire digital currency. Because each currency managed by the digital currency registration center is independent of each other, it naturally meets the characteristics of being stateless. On this basis, the entire system can be infinitely expanded in parallel, which means that the core system of DCEP can theoretically provide unlimited expansion of high-performance support to the outside world.

As for Stateless, this is a computer term.

Stateless design can ensure that there are no performance bottlenecks in the entire system. As long as the design of any system meets the characteristics of Stateless, the performance of the system can be infinitely expanded.

In the entire digital currency registration center system, the ownership record of each currency is independent, just like the process of real cash circulating in society..

In a sense, the design goal of DCEP is to provide support for the currency circulation process across the country and even the world. This places high demands on the performance of the entire system.

The technical solution adopted by DCEP to simulate the real cash flow process can not only cleverly solve the double-spending problem that may occur in digital currency, but also ensure the circulation of currency by relying on the parallel characteristics of currency circulation. The settlement process can be perfectly parallelized.

Regardless of the form of the cryptocurrency on the blockchain or the technical characteristics of its implementation, the design model of DCEP can be said to be completely different from that of the blockchain.

In essence, no matter what form the blockchain takes, it is a form of ledger, and the implementation of DCEP is a kind of real cash.

Obviously, the design of DCEP is more in line with the needs of the digital currency scenario.