How can you solve a double-spending problem (blockchain)?

The blockchain prohibits double-spending with the help of the consensus algorithm. Before a transaction is recorded in a block, the consensus process validates its validity. As a result, several nodes verify it, allowing for double-spending.

However, because one organization owns more than 50% of the network, a 51 percent network attack will render any blockchain vulnerable to double-spending.

Every transaction on blockchain needs to be approved or needs confirmations by the network. Confirmations range from 2 to 50 or more. These confirmations are done by miners or nodes who maybe sitting anywhere across the globe and always watching the transactions. Once the transaction is confirmed by them they record hash rate , time stamp, source and destination public keys on the block chain which is an open source ledger available to everybody. So once this is recorded , it simply prevents double spend.