3 ms·
>Proof of work has nothing to do with that, any system that can encourage everyone to agree on the next block does the same prevention of double spend. What fo
by jasode 5y ago
>Proof of work has nothing to do with that, any system that can encourage everyone to agree on the next block does the same prevention of double spend.
What foundational frame of reference are you using to write that sentence above?
Because for Bitcoin's specific implementation, the purpose of POW is to prevent double spend without centralized trust. Consider the following "if()" statement in bitcoin source code:
Excerpt from validation.cpp [1]:
bool CBlockIndexWorkComparator::operator()(const CBlockIndex *pa, const CBlockIndex *pb) const {
// First sort by most total work, ...
if (pa->nChainWork > pb->nChainWork) return false;
if (pa->nChainWork < pb->nChainWork) return true;
In older versions of source code, excerpt from main.cpp [2]:
if (pindexNew->bnChainWork > bnBestChainWork)
{ ...
The motivation for the C++ code above to compare the chain work is in the original 2009 Bitcoin whitepaper. Excerpt:
>12. Conclusion : We have proposed a system for electronic transactions without relying on trust. We started with the usual framework of coins made from digital signatures, which provides strong control of ownership, but is incomplete without a way to prevent double-spending. To solve this, we proposed a peer-to-peer network using proof-of-work to record a public history of transactions that quickly becomes computationally impractical for an attacker to change if honest nodes control a majority of CPU power.
[1] https://github.com/bitcoin/bitcoin/blob/271155984574a5bba9619d8f6da9bb0606d93f8c/src/validation.cpp#L87 https://github.com/bitcoin/bitcoin/blob/271155984574a5bba961...
[2] https://github.com/bitcoin/bitcoin/blob/40cd0369419323f8d7385950e20342e998c994e1/main.cpp#L1236 https://github.com/bitcoin/bitcoin/blob/40cd0369419323f8d738...