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

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

发布时间:2023-12-05-23:05:00 来源:网络 区块链知识 区块   链防双花

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

近年来,随着区块链技术的发展,双花问题也成为了一个热门话题。双花是指一个用户同时发送两笔资金,一笔转入自己的账户,另一笔转出到其他账户,从而获得不正当的利益,造成货币流通系统的不稳定。面对这一问题,区块链技术提供了一种有效的解决方案。

首先,区块链技术提供了一个去中心化的系统,即全网用户都可以参与到全网的交易中来。这样,双花的行为就不可能发生,因为双花行为需要大量的资金,而这样的资金在去中心化的系统中是不可能被集中的。

其次,区块链技术采用了共识机制,即所有参与者都可以参与到共识机制中来,这样,每一笔交易都会被所有参与者确认,从而可以有效的防止双花的行为。

此外,区块链技术还采用了分布式账本技术,即每一笔交易都会被记录到分布式账本中,从而可以有效的防止双花的行为。

总之,区块链技术提供了一种有效的解决双花问题的方案,它可以有效的防止双花的行为,从而维护货币流通系统的稳定。区块链技术的发展,为解决双花问题提供了一种有效的解决方案,有助于保护货币流通系统的稳定。


请查看相关英文文档

Ⅰ 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 means were basically focused on solving the "double-spend problem" to protect Bitcoin. As a currency, currency itself functions as a means of payment.

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.

II What are the functions and characteristics of blockchain

1. Any node can create a transaction, and after a period of confirmation, it can reasonably confirm whether the transaction is Effectively, blockchain can effectively prevent the double-spend problem from occurring.
2. The cost of trying to rewrite or modify transaction records is very high.
3. Blockchain implements two types of records: transactions and blocks. Transactions are the actual data stored on the blockchain, while blocks are records confirming when and in what order certain transactions became part of the blockchain database. Transactions are made by participants using the system in the normal courseCreated (in the case of cryptocurrency, a transaction is created by Bob sending tokens to Alice), blocks are created by units we call miners.

Ⅲ What is blockchain

What is blockchain? What changes will it bring to your future life?

Blockchain is a new application model of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.

Blockchain is an important concept of Bitcoin. It is essentially a decentralized database. At the same time, as the underlying technology of Bitcoin, it is a series of cryptographic methods related to each other. Each data block generated contains a batch of Bitcoin network transaction information, which is used to verify the validity of the information (anti-counterfeiting) and generate the next block.

In fact, the original English version of the Bitcoin white paper does not appear in the word blockchain, but uses chain of blocks. In the earliest Chinese translation of the Bitcoin white paper, chain of blocks was translated into blockchain. This is the earliest time when the Chinese word "blockchain" appeared.

The Cyberspace Administration of China issued the "Blockchain Information Service Management Regulations" on January 10, 2019, which will come into effect on February 15, 2019.

In a narrow sense, blockchain is a chain data structure that combines data blocks in a sequential manner in chronological order, and is cryptographically guaranteed to be non-tamperable and non-transformable. Fake distributed ledger.

So in conclusion, this is undoubtedly a new technology that changes life. In the future, the production activities of the entire society will be carried out with blockchain as the underlying logic. Many things We all have it at our fingertips, and with the integration of artificial intelligence and big data, we can easily handle things that may seem cumbersome now, such as some securities market transactions and intelligent matching of financial management activities.

To put it simply, blockchain is a network computing center that integrates people, property, machines, and goods, and packages them into a whole; putting it on an infrastructure to run.

IV The secret hidden in the characteristics of currency circulation, how DCEP elegantly solves the "double-spend problem"

We have already talked about the previous article, the account system can perfectly solve the problem of data As a currency, there will be a double-spend problem, but due to this account mechanism, the circulation of currency will lose its parallel characteristics, making it difficult to accommodate a large number of transactions at the same time in an independent system.

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, what different user accounts record is a number, we use 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 currencyData records can be 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 form of the ledger, all the user has is a string that proves your identity, 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 in the circulation characteristics of cash 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 to ensure that Alice is indeed the owner of the currency 0x001.Change 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.

IV What is the concept of double spend theory

In the process of learning blockchain, you will definitely hear the word "double spend", which means double payment, or more To put it bluntly, a sum of money is 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 account, UTXO is the unspent transaction output. 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, it caused a fork in the blockchain:

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

VI Blockchain Originator Bitcoin 8: Double Spending, 51% Attack and Solutions Due to Forks

Forks
< br />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 is possibleSex 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 increases the risk of repeated payments that the sequencing system originally prevented. Attack opportunity. 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, thenIf 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 sometimes hundreds or thousands of computers, will have a hard time winning the solution to a block, because the competitor is not any single 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/

Ⅶ Witch Attack and Double Flower Attack

The name of Witch Attack comes from the 1973 novel The movie of the same name adapted from "Sybil". The heroine in the movie, Sybil Dorsett, suffers from dissociative identity disorder and has 16 personalities.

The bottom layer of the blockchain is the P2P network. Each node in the network can join or exit at any time. In order to maintain the effectiveness of the network, a piece of data often needs to be deployed on several nodes.on distributed nodes. If a malicious node pretends to have multiple identities, there is a chance that all data can be obtained. Let me give an analogy below:

Suppose Shenlong creates seven dragon balls and puts them on the earth respectively. Every corner. So Shenlong announced to the world that one person from each continent should come to receive the dragon ball. At this time, I, who was proficient in the art of disguise, pretended to be people from seven different regions and came to Shenlong to get the dragon balls. Originally, Shenlong placed the Dragon Balls in different parts of the world to balance the power of various places. However, because I forged my identity, I successfully obtained all the Dragon Balls and controlled the earth.

The above metaphor is the essence of the witch attack.

Double-spending attack is an attack method faced by most blockchain encrypted digital currencies. As the name suggests, a double-spend attack means that a valid amount of money is spent twice.

The feasibility of double-spend attacks is entirely due to the consensus mechanism of the blockchain. Take Bitcoin as an example. Since Bitcoin's POW consensus mechanism is an eventually consistent consensus, it takes a certain amount of time for a transaction to be unanimously confirmed by all nodes in the network, and attackers use this time gap to carry out attacks. Let’s take an example from real life:

Suppose bank A has two branches, B and C. However, this bank's accounting system is relatively inefficient. Branches B and C will only synchronize their accounts with main bank A every hour. I deposited 100 yuan in main bank A. An hour later, branches B and C synchronized their accounts, so I can check in both B and C that I have 100 yuan. After that, I used my account through branch B to buy 100 yuan of delicious food, and then used my account through branch C to sell Wei and buy 100 yuan of fun food. Since the accounts between branches B and C cannot be synchronized at any time, branch C still thinks that I have 100 yuan when I go to buy some fun.

The above is a double-spend attack, and "double-spend" is always the primary problem to be solved by a currency in circulation.

博客主人唯心底涂
男,单身,无聊上班族,闲着没事喜欢研究股票,无时无刻分享股票入门基础知识,资深技术宅。
  • 35226 文章总数
  • 3637265访问次数
  • 3077建站天数