Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the concept of dual payment of bitcoin technology in blockchain?

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "What is the concept of double payment of Bitcoin technology in blockchain". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "What is the concept of double payment of Bitcoin technology in blockchain" together!

Double payment concept

Bitcoin acts as an electronic currency and does not utilize third-party institutions. The first question to be solved is: how to prevent double-spending? Double payment is simply a currency that has been used multiple times.

This constraint can be expressed on the basis of Bitcoin structure: the output of a transaction can be followed by the input of a transaction at most, that is, it can be consumed at most once.

Double payment is the Bitcoin system to solve the problem. There are two corresponding firewalls, the first is a local inspection, and the second is a distributed protocol.

ideally

We have described an ideal working model: one node is mined strictly every 10 minutes, and a block can reach all nodes in 10 minutes.

In this ideal mode of operation, will the system have double payments? No. A quick look: There are now two bills A and B, both of which consume the same bitcoin in no particular order.

(1) Case 1: Suppose A was written to the block chain before B. By the time a node mines and prepares to write B, the node has synchronized with the latest blockchain, according to our previous assumption. Therefore, A is already on the local chain of this node, and local inspection will find that B is illegal and directly throw B away.

(2) Case 2: Neither A nor B has been written into the blockchain. And they are all received by a node, which then directly checks all the bills in the candidate block locally for conflicts, checks A and B, and discards the next one.

It can be seen that, ideally, local checks would avoid double payments. But what about reality?

reality

The reality is not necessarily strict 10 minutes there is a node to mine, may be every arbitrary time there is a node to mine, or may be two nodes at the same time to mine. And there may be network partitioning that results in a block not knowing how long it will be broadcast to all nodes.

Since the node does not need to request the consent of other nodes to directly write to the local blockchain after mining, it is easy for each node to maintain different chains. However, it is a distributed system, and different nodes will always communicate, and when they communicate, conflicts will be detected, similar to branch merging of git. Git branch merge conflicts are manually resolved by users, but Bitcoin conflicts can be resolved by the system. Satoshi Nakamoto offers a simple solution:

With the longest chain as the valid chain, new blocks need to be added to the longest chain, and the short chain will be discarded after a certain time.

This is similar to queuing up for a bus. At this time, there are two queues. The administrator said that the longest queue shall prevail. At this time, the later people will queue up for the longest queue in order to ensure that they get to the front. In this case, the short chain will be discarded, let's look at an example:

When node A receives the chain from node B, node A discards the green block, synchronizes the chain from node B, and continues writing in the yellow block.

Possible double payments

Is there a loophole in this mechanism that allows me to spend a dollar more than once? Yes. I can write the transaction to the blockchain and then find a way to discard it, i.e., make the chain branch of the transaction a short branch (and write a long branch), so that the branch will not be accepted. I can go ahead and create a new deal to spend it.

All right, I'm ready to do something bad. Here's an example:

I control node A. Transaction A is the first transaction and has already been broadcast to other nodes. In order to invalidate transaction A, I need to re-open a black chain containing transaction B. I need to catch up with the green chain first, and pass the green chain by one block, so that I can assimilate the other nodes.

And that would require me to dig two mines in a row. What kind of concept was this? In terms of probabilistic expectations, this equates to me having more than half the computational resources of the Bitcoin system. I'm already so awesome, do I still need to hack the system? All I have to do is mine hard and I get high returns.

However, more often than not:

My computing power is similar to others. When I dig a mine and write a black block, the other two nodes have already dug two mines. They synchronize their data with each other and won't give a shit about me. The gap will get bigger and bigger. In the end, I can only choose to give up resistance.

There is also a detail here: blocks are broadcast one by one, not the whole chain, so when a node receives a block that conflicts with its own branch, it will not be immediately discarded, it will be cached locally first, and when all the cached blocks form a branch that exceeds the current working branch, it will switch to the longest branch.

Generally speaking, when a block is followed by six blocks on the chain, it can be confirmed that all transactions in this block will not be discarded, so the confirmation time of bitcoin bill is 1 hour.

Thank you for your reading. The above is the content of "What is the concept of double payment of Bitcoin technology in blockchain?" After studying this article, I believe everyone has a deeper understanding of what the concept of double payment of Bitcoin technology in blockchain is. The specific use situation still needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report