You may have noticed the “EX” suffix appears a lot in the cryptocurrency niche?
BitMEX, Poloniex, Bittrex, Goatsex, you name it.
If it ends in EX, then it’s probably related to crypto somehow.
Why?
“EX” is short for EXchange and there are literally tens of them, hundreds perhaps.
Why so many?
Perhaps the best way to illustrate why there are so many crypto exchanges is by giving a practical example.
Wallet API
Johnny, a cryptocurrency enthusiast, bought his first Bitcoins in early 2010.
BTC was really cheap back then, and he had tons of coins in the full node wallet he ran while mining new coins using his CPU. Those were the times!
Then came Litecoin, Dogecoin and in just a few years Johnny was holding a bag of 10 or so different cryptocurrencies that were rapidly gaining dollar value.
Your Own Bank at Home
Suddenly, Johnny realized that he had become his own bank. He also noticed he had all the necessary open source software to run his bank for free!
After reading Bitcointalk threads for some time, Johnny realizes that every cryptocurrency full node has a programmable interface embedded in it!
The Bitcoin full node software can be easily programmed and so can the Litecoin, Dogecoin and just about every other wallet that forked from Bitcoin Core.
And most of them work in a very similar way!
They all share a common API – what software developers know as an “application programming interface”.
Eureka!
While experimenting, Johnny programmed his Bitcoin node to send and receive Bitcoins whenever he sent it a secret command using his cell phone.
Cool!
He could now impress friends and family by sending them Bitcoins from anywhere using his phone!
But what useful (and profitable?) applications could he create using the API?
If your guess is that 9 out of 10 programmers like Johnny immediately thought of creating their own cryptocurrency exchange, then you’ve answered the question posed at the beginning of this article!
BitcoinMarket.com
What if you could interface your Bitcoin full node, running in your bedroom, to Paypal or some other fiat money payment gateway?
Boom! You’ve built a fiat to Bitcoin exchange.
That’s what BitcoinMarket.com did way back in 2010.
Bitcointalk user dwdollar announced BitcoinMarket.com in January of that year and sparked a gold rush for wallet API developers.
What about exchanging Bitcoin for other cryptocurrencies? Remember Johnny was holding a bag of several cryptos? Well….
JohnnyEX
Johnny buys a box of Club Mate and sits down to program his own crypto exchange.
It creates one address per user using the wallet API for every specific cryptocurrency listed in the exchange.
All he has to do is keep all these wallets running 24×7 and keep the database safe. This database tracks who owns which address from which cryptocurrency.
The rest happens on the blockchain.
When given a cryptocurrency address, users send funds to this address and the JohnnyEX system immediately updates the database with your new balance. When you wish to withdraw, the exchange sends a command to this wallet to send the funds back to you and the database is updated accordingly.
When the user wishes to exchange one currency for another, JohnnyEX matches the top bid against the lowest ask. If they match, the trade happens and the database is updated accordingly.
Just like Johnny created his own EXchange in his bedroom, so did tens of other talented programmers.
Is it really that simple?
It’s not as simple as just wiring up to a coin client program, but it’s not rocket science either.
The main challenge in running your own exchange is to keep it secure from hackers.
That’s where most exchanges have historically failed.
Hackers can target the main wallet that receives and sends funds for a given cryptocurrency.
Wallets may contain security flaws that specialized hackers will exploit.
The database itself could be exploited by somehow changing the balances to add or subtract nonexistent amounts.
MtGox
Take MtGox as an example.
One day MtGox’s creator, Mark Karpeles, was asking basic beginner questions on PHP programming language forums.
A short time later he was running MtGox.
This real life example shows how simple it is to interface any programming language to the wallet API’s.
The API’s are easy to use, well documented (thanks Bitcoin Core team!) and anyone can program them using any general purpose programming language.
Unfortunately, MtGox is also an example of poor information security and administrative practices.
Whether MtGox was hacked or an enormous fraud, or a combination of both, the fact remains that thousands of people lost hundreds of million of U$ due to the MtGox collapse.
DEX vs CEX
MtGox illustrates a recurring problem with all centralized exchanges (CEX).
Most exchanges we currently use are centralized.
Which means that someone runs a central database (like JohnnyEX) that keeps track of balances, deposits, withdrawals and trades from one cryptocurrency to another.
These exchanges are especially vulnerable to hackers, because they must keep large sums of cryptocurrency online in order to execute timely deposits and withdrawals.
Enter DEX – decentralized exchanges.
A DEX is a smart contract that accepts remote commands on the blockchain.
A deposit would be a command accompanied by some amount of cryptocurrency.
A withdrawal would be a command that would check the requesting addresse’s balance and, if all went well, would send this amount to the requester.
Since the exchange runs on the blockchain, there’s no centralized database.
Everyone holds a copy of the deposit and withdrawal amounts on their own copy of the blockchain.
DEX Crosschain Traffic
There’s an obvious problem with the above smart contract: it only runs on one blockchain.
An Ethereum smart contract would be able to manage ETH along with any Ethereum-based token (ERC20 or newer).
This is because all Ethereum tokens live on the ETH blockchain and the smart contract has access to data on its native blockchain.
To be able to create a universal DEX, you’d need crosschain transactions.
At the time of this writing there are many efforts to create reliable and secure crosschain interfaces.
Until these interfaces are up and running, it won’t be possible to mix several blockchains into one smart contract.
Conclusion
We hope this article answered your question as to why there are so many exchanges out there.
Sure, there may be many cryptocurrency exchanges, but you should choose wisely.
Early programmers enjoyed creating applications for their own wallets and most these apps involved some form of exchange with the outside world.
The “EX” mania exploded in the early years of Bitcoin and derived cryptocurrencies and lots of these early experiments are still around.
Programming your very own bank can be real fun.
That’s the origin of so many exchanges – to have fun developing software for the cryptocurrency revolution!