The race to build a scalable decentralized exchange (DEX) is on.
DEXs match buyers to sellers and facilitate trading without a third party. 0x and Loopring are both attempting to build protocols for DEX on the Ethereum blockchain. As such, they are not DEXs in themselves, but are more like toolboxes for building them.
0x was founded in October 2016 with the hope of making almost anything tradeable on a blockchain. Its next update will be to provide a decentralized version of an order book—which matches trades made on an exchange—to make the experience more closely aligned with that of a centralized exchange.
The key benefit is that the trades themselves do impact the price of the asset being traded, allowing supply and demand to organically affect the price of the coin. (Other DEX’s rely on algorithms to artificially keep the prices current.)
Loopring is getting a bit more experimental. Its approach also addresses one of the primary weaknesses of the Ethereum blockchain, namely, its limited capacity. While developers are working on scaling the network so it can support thousands of transactions per second, it currently can manage around 15.
Loopring’s solution: zk-SNARKs, a cryptographic shorthand that verifies data without revealing its underlying information. It aims to use these to provide a much more scalable service while keeping its security resting on the underlying blockchain. According to Daniel Wang, CEO of Loopring, the zero-knowledge proofs solution will be rolled out in the next few months.
How does it work?
First, the DEX batches thousands of transactions together and submits them as one. That’s where zk-SNARKs come in: they can do this without requiring tons of data to be stored on the blockchain.
Zk-SNARKs are a form of zero-knowledge proofs invented in the 1980s and fundamental to modern cryptography. One common use in digital money is to allow a person to prove that they are eligible to send funds to someone else, without revealing all the transaction information. Loopring uses zk-snarks to prove that all the transactions in a batch are legitimate, without uploading all of the transaction information to the Ethereum blockchain.
“With zero-knowledge proofs, we can go up to 450 trades per second on the Ethereum mainnet—and compete with small-medium sized centralized exchanges,” Wang told Decrypt. He said this was a breakthrough: “With the previous three versions of Loopring, we were just based on Ethereum. There was no way to compete with centralized exchanges.
Obviously, some information is uploaded to the blockchain, so that everyone can see that the transactions have been made and are able to check their balances. But, it doesn’t upload all the verification information attached to it. Instead, this is verified off-chain.
Performing this off-chain verification of the transactions does require intensive compute time, which incurs a cost. Wang estimated the off-chain cost per transaction at one cent, though he said it’s hard to calculate because it depends on the machines used and the price of electricity. He said he hopes to bring it down to half a cent.
Similarly, he said that in testing, Loopring found the cost of uploading the batch of transactions to the blockchain can go as low as a tenth of a cent, meaning that the majority cost lies in the off-chain verification. The total cost would be around one cent or less, which is about eight times lower than the current price.
What’s the catch?
In order to provide a more liquid service, Loopring uses market makers—known as “operators”—who batch and upload the transactions. These are wealthy people or companies who hold large amounts of each cryptocurrency and allow DEX users to trade against them.
The operators are needed to batch the transactions and perform the off-chain calculations to create the zk-SNARK proof, which can be verified off-chain, and then uploaded to the blockchain. Without a responsible party, everything would have to be done on-chain.
Unsurprisingly, this raises fears that these operators could be a centralizing force within the network. However, Wang said that the worst-case scenario would be that an operator could block a transactions—but he or she can’t make a false transaction or take anyone’s money.
“We give the flexibility to the operator to drop the requests [trades] if they want to,” he said, explaining that this stops them from having to make an unprofitable trade. He added, “If they do censor trades, people have to not use the DEX. It can’t steal money but it can refuse service,” Wang said.
While this isn’t ideal, it shouldn’t be too big of a problem because the operators have incentives to fulfil all trades and this is just a stopgap solution until Ethereum becomes a scalable platform. And on that front, progress is being made.