What Is the “Longest Chain Rule” and How Does It Prevent Confirmed Double-Spending?
The "longest chain rule," also known as the Nakamoto Consensus, dictates that the legitimate version of the blockchain is the one with the most cumulative Proof-of-Work (the longest chain). When a double-spend attempt occurs, both conflicting transactions are broadcast.
Once one is included in a block and that block is followed by subsequent blocks, the chain containing the confirmed transaction becomes the longest. The network rejects the shorter chain containing the conflicting transaction, effectively preventing the confirmed double-spend from becoming permanent.