零点课堂 | What Is a Directed Acyclic Graph (DAG) in Cryptocurrency?(3)
Users are more likely to confirm transactions with a "heavier" weight so that the system keeps growing. Otherwise, there would be nothing stopping users from continuously building on older transactions.
With blockchains, double-spend protection is easy enough. The same funds can't be spent twice in a block – nodes can easily detect any attempt and will reject any block containing conflicting transactions. Since it's so expensive for miners to produce blocks in the first place, they're incentivized to play fair.
DAGs also have a mechanism to prevent double-spending. It's sort of similar, but without miners. When a node confirms older transactions, they assess a whole path back to the DAG's very first transaction to be sure that the sender has a sufficient balance. There could be multiple paths, but only one needs to be verified.
If users build on an invalid path, they run the risk of their own transaction being ignored. Theirs could be legitimate, but because the previous one wasn't, no one will want to extend that particular path.
It seems unintuitive at first – couldn't you end up in a situation where multiple branches that aren't aware of each other exist? Then, couldn't people spend the same funds on these different branches?
That's indeed a possibility, but it's resolved with a selection algorithm that favors tips with a heavier accumulated weight. That means that, over time, you'll end up with a branch that is much stronger than the rest. Weaker ones will be abandoned, and the network will continue building on the heaviest one.
声明:本文由 Binance撰写,零点财经收录,观点仅代表作者本人,绝不代表零点财经赞同其观点或证实其描述。