Thank you for explaing it really helped, but i am still not 100% sure i mean when i read about ACID on vikipedia there were no atms mentioned only sending from A to B some errors power loss was mentioned on it.
Power loss is just one example. Here is a very simplified example (real DBMS are more robust). There is a CC account with a balance of $4000 and the card is duplicated. Two attackers start using the ATM at the same time trying to each withdraw $400. They attempt to execute the withdraw as close to simultaneous as possibly by remaining in communication with each other.
Lets ignore the fact that both ATMs are reporting this to the same central location so it is trivially easy for the bank to detect that the same card is being used simultaneously in two different locations (something that can't happen in fraud) and just confiscate both cards as a precaution. Regardless of how well timed the attackers are, one request will be processed first. The A in ACID means that all steps in one logical operation such as withdrawing cash are done as a single atomic operation. Either they all complete or none of them do. The I means that all atomic operations will always have the same outcome as if they were processed sequentially even if the database is handling multiple requests in parallel.
To keep it simple lets say this ATM protocol has three steps in the withdraw cash operation:
Check balance is greater than or equal to withdraw_amount
Dispense withdraw_amount
Deduct amount from balance
I am assuming you think the attack could work like this (T1 is steps for transaction 1, and T2 is steps for transactions 2):T1 check balance ($400) is greater than or equal to $400 = TRUE
T2 check balance ($400) is greater than or equal to $400 = TRUE
T1 dispense $400
T2 dispense $400
T1 deduct $400 from balance. Balance = $0
T2 deduct $400 from balance. Balance = -$400.
Attackers win, $800 dispensed from account with only a $400 balance.
The reality is this problem was solved more than fifty years ago, what actually happens is:T1 CHECK TO SEE IF EXISTING TX IS IN PROGRESS (if true then wait otherwise start a new transaction)
T1 START TRANSACTION
T1 check balance ($400) is greater than or equal to $400 = TRUE
T2 CHECK TO SEE IF EXISTING TX IS IN PROGRESS (if true then wait otherwise start a new transaction) <- this is true because T1 transaction is still in progress so the request will just halt and wait
T1 dispense $400
T1 deduct $400 from balance. Balance = $0
T1 TRANSACTION COMMIT
T2 CHECK TO SEE IF EXISTING TX IS IN PROGRESS (if true then wait otherwise start a new transaction)
T2 START TRANSACTION
T2 check balance $0 is greater than or equal to $400 = FALSE
T2 report insufficient funds
T2 TRANSACTION COMMIT
All Bitcoin exchanges (or any system processing financial requests) should operate the same way. This is very basic fundamentals of database operations. Sadly many exchanges have been created by people who lack even the basic understanding of transaction processing. They have in the past been attacked in a manner similar to the flawed ATM attack model. They attacks should have failed but they didn't and users lost small fortunes. I am sure more than one exchange is still vulnerable to similar attacks today.