I have been following a fascinating story about Coinbase and bitcoins for a few of days. It is better than any other TV show at the moment.
There are Silicon Valley celebrities, VCs, drama, money, lies, and scandal involved. You will not hear about it in mainstream tech blogs, because too much money is at stake.
But if you watch closely, you will see outrage, confusion, and anger of the people on the internet, especially those who had purchased bitcoins recently through Coinbase.
Coinbase: a Bitcoin Wallet
“Coinbase is a cloud-based Bitcoin wallet that allows users to buy and sell bitcoins with a US bank account, send and receive bitcoins with an email address, and accept bitcoin payments as a merchant.”
– Quoted from Wikipedia
Coinbase, one of the latest Silicon Valley darlings that recently raised 25 million dollars from Andreessen Horowitz, is now caught in a PR crisis: their customers accused them of being liars and thieves, because money was taken from these customers’ bank accounts through ACH in exchange for bitcoins at market value. In one case, the amount withdrawn was US$35,104. In another, US$10,701.
However, in both cases, the money simply vanished from bank accounts, and no bitcoins were ever received in return.
Feeling uneasy about this delay, these people reached out to Coinbase’s customer service and heard either no reply or were treated with rudeness. They escalated the case to Hacker News and Reddit in order to be heard, and to seek justice.
Coinbase has explained that it was going through system upgrade, and there may have been data loss. They told people these problems “are only costing people theoretical profits, and not actual”.
The ACID Test
Upon closer examination, one will find that Coinbase chose MongoDB for their primary datastore, which might have caused these troubling transactional errors due to data loss.
MongoDB certainly has great advantages in certain scenarios, such as storing and processing massive amount of unstructured data, but the tradeoffs includes dropping ACID properties that you would find in SAP HANA, which is essential for financial transactions to be reliable.
Quora user Chris Schrader said, “…(not being ACID compliant) means that two people looking at the exact same key may see different values. For example, if I update key 123 from ABC to DEF, and two people query MongoDB for key 123, 1 person might see ABC and one person might see DEF.
This is because MongoDB is distributed over many nodes and will eventually “sync” the data across those nodes (referred to as eventual consistency). A traditional RDBMS will “lock” the updated data across all its nodes when performing the update in order to ensure that everyone sees the same thing. That is pretty important if you’re storing something like financial transactions.”
What Does Being ACID Compliant Mean
“In computer science, ACID is a set of properties that guarantee that database transactions are processed reliably. In the context of databases, a single logical operation on the data is called a transaction.”
(Quoted from Wikipedia)
In the world of financial transactions, ACID means:
- A (Atomicity) – a transaction to transfer funds from one account to another involves making a withdrawal operation from the first account and a deposit operation on the second. If the deposit operation failed, you don’t want the withdrawal operation to happen either.
- C (Consistency) – a database tracking a checking account may only allow unique check numbers to exist for each transaction
- I (Isolation) – a teller looking up a balance must be isolated from a concurrent transaction involving a withdrawal from the same account. Only when the withdrawal transaction commits successfully and the teller looks at the balance again will the new balance be reported.
- D (Durability) – A system crash or any other failure must not be allowed to lose the results of a transaction or the contents of the database. Durability is often achieved through separate transaction logs that can “re-create” all transactions from some picked point in time (like a backup).
(Quoted from Stackoverflow)
We do not know exactly why the above-mentioned transactions failed to be completed by Coinbase, but since ACID helps insure the reliability of financial transactions, people have been questioning the choice of using MongoDB as the main datastore since the early days of Coinbase.
Making the Right Choice
SAP HANA supports the ACID principles, which protects data integrity by making sure the updates will complete together or the database will roll back to pre-transactional state. The bitcoin fiasco we’re seeing now might have been avoided, by choosing a database such as SAP HANA.