If a user can reacquire the coins they spent in one transaction and spend them again in another, it's called double-spending.
Bitcoin prevents double spending with the following two properties:
In Bitcoin, a user can only spend a coin once. New coins are generated as output whenever a Bitcoin is spent, also known as UTXOs. All Bitcoin transactions point to UTXOs produced as output in some previous transactions.
Miners typically maintain a UTXO database, and whenever a UTXO is spent, its entry is deleted from the database. Therefore, if someone tries to spend that UTXO again, they'll get an error and reject the transaction as the input UTXOs have already been spent elsewhere.
The entire blockchain is visible to every node, and a consensus is held before adding a block to the blockchain. Every node verifies all the transactions in a
Free Resources