Hi everybody! I’m a long time follower of OMG but first time poster here so thanks for having me. I recently spent some time comparing properties of Tendermint vs Plasma for decentralized exchange and this seemed like a good place to share.
*This is particularly about decentralizing consensus without sacrificing performance, not the exchange mechnism itself which comes with its own set of problems.
When we say we want a DEX that can compete with a centralized exchange, one of the biggest challenges is speed because decentralized consensus is so much more complicated. Cosmos and Ethereum both have good tools for creating a good user interface, but speed in an on-chain exchange is still a big problem. In this case speed is really a combination of two factors: latency, which is the amount of time it takes for a transaction to process, and throughput, which is the number of transactions that can be handled in a given amount of time (in our case, how many tx can fit into one block). Obviously the goal is low latency, high throughput, but the Ethereum main chain is pretty much the opposite of that, which is why we have layer 2 solutions like Plasma.
There was a Bitcoin.com article 6 months or so ago (https://news.bitcoin.com/order-speed-analysis-reveals-the-fastest-cryptocurrency-exchanges/) that compares latency benchmarks (average order execution delay, % of orders executed within 10 milliseconds and % that took longer than 1 second) for different centralized exchanges.
These numbers are a little bit erratic between different exchanges but we can see that all except Bitmex have latency of less than a second.
Throughput is harder to know because it can’t be tested by a third party in the same way as latency and exchanges don’t necessarily publish that data, but we can make an educated guess by dividing the number of transactions executed daily by the number of seconds in a day. Here are those numbers for a few major exchanges:
- Binance 1,400,000 tps
- Bitfinex 2,500 tps
- Coinbase 3,333 tps
Bitfinex and Coinbase also both rolled out major increases in tps capacity in response to problems during the ICO boom.
So that’s what we’re up against. For decentralized exchange I looked specifically at Plasma and Tendermint since those are the two main options for an OMG spoon.
Tendermint has a consensus algorithm where validator nodes cast votes to determine which blocks are canonical. A block attested to by 2/3 of the validator set is considered finalized. Tendermint doesn’t work like a PoW chain where anybody can just participate. The validator set has to be decided by on-chain governance or a fork. You can have one vote per validator, or use PoS so that the validator’s voting power changes depending on their holdings.
You also can’t have as many validators with Tendermint. Bitcoin has more than 9,000 nodes today, whereas Cosmos (which is the only Tendermint chain in production right now) only has 100. Cosmos may increase to as many as 300 over time but that’s still much less than Bitcoin or Ethereum.
There’s a good reason for this: since Tendermint requires signatures from 2/3 of Validators to achieve consensus, latency gets worse the more validators you have. Right now latency for Tendermint is about 1-3 seconds depending on the number of validators and can fit about 10,000 transactions per block without negatively impacting throughput.
In Single Operator Plasma, one entity is responsible for processing transactions into blocks and relaying them to the root chain where they are stored as commitments. There are some limitations on the functionality of the child chain introduced by the dependence on the root chain because the complexity of the child chain’s state machine is limited by what the root chain is able to support. But overall Single Operator Plasma can have very good performance characteristics because it’s only limited by the infrastructure that the operator is using. The operator can decide their own block time and fit as many transactions per block as their servers can handle.
The problem with Single Operator Plasma is that it’s very centralized. The Plasma exit mechanism means that user funds should be safe as long as the protocol is implemented correctly, but the operator is still a single point of failure and having one owner definitely wouldn’t be an option for a community project like the OMG spoon. Single Operator also means no PoS!
You can mitigate this problem by decentralizing the operator with either a non-BFT consensus algorithm like Raft or a BFT algorithm like Tendermint. That means the performance characteristics of the consensus algorithm you use would be inherited by the Plasma chain. The Raft algorithm can support tens of thousands of requests per second with low latency, but isn’t Byzantine fault tolerant so it isn’t very censorship resistant. If youre more worried about censorship than direct attack, then this might be fine because your validators are all known and trusted anyway.
One more thing about Plasma is it requires Watchtowers or Watchers who are supposed to watch the operator for malicious activity and exit on behalf of their users if there is a problem with the child chain. It’s not clear who would do this or why. OmiseGo says they expect wallet providers to do this in order to protect their own interests, but the incentive model isn’t very clear. Users could run their own Watcher but right now it’s not simple enough for an average person to do easily.
So we know Single Operator Plasma can have low latency and high throughput, but Multi Operator Plasma that is actually decentralized, secure, censorship resistant but still has low latency and high throughput is still a long way away.
If we were going to do a spoon to Cosmos as a community then I think we should start over with no assumptions, since what works for Ethereum might not work as well on Cosmos. We sholud think about what we want out of this DEX, which I think for a lot of us means Proof of Stake since OMG could have massive volume and it still wouldn’t do us any good until PoS gets implemented. We should use whatever works best to achieve that quickly, and then keep looking at things, like the Plasma with multiple root chains that @tousthilagavathy is researching, in the long term to interoperate with OMG and other chains. For building a real decentralized exchange with multiple validators right now, Plasma has a lot of problems that aren’t really solved yet. Tendermint on the other hand has a working multi-operator consensus mechanism with SDKs and other tools to make creating a Tendermint chain with multiple validators pretty simple if you know what you’re doing.