» » what is a decentralized exchange?

what is a decentralized exchange?

20 February 2018, Tuesday
7 135
0


Let's talk about decentralized exchanges. (intro music) In recent months there's been an absolute explosion of new tokens hitting the cryptocurrency market. These tokens are predominately linked to ICOs or Initial Coin Offerings that are happening and as a result, a lot of people out there are looking for liquidity of those tokens that they're purchasing. Now, as this was all new, things were going pretty smoothly the last few months with exchanges like Bittrex and Poloniex pretty quickly listing these tokens just a week or two after the token sales. To those unaware, Bittrex and Poloniex are centralized exchanges similar to the stock exchange, but you can trade crypto assets, so token A for token B, or token A to Bitcoin or Ethereum. So, things were going smoothly, but more recently with looming SEC regulation and unclear guidelines on what constitutes a security, these exchanges have been a little bit spooked and they aren't listing ICO tokens as quickly as they were previously. A good example of this is is that Bittrex haven't actually listed an ICO token as of early August at the time of filming. So, people are slowly starting to panic that they might not be able to sell these ICO tokens any longer on these exchanges. So, they've become essentially, non-liquid. In addition, centralized exchanges just have a pretty bad history in terms of security. When you're trusting an exchange like Bittrex, Poloniex, Coinbase, whatever, you're trusting them to hold all of your funds and very often they don't give you the private keys to access them. A simple Google search would show you the bad history we have here, but if you look at examples such as Mt. Gox and Cryptsy, there's definitely a precedent for centralized exchanges not being a very alluring or secure place to store your tokens. You really wanna get your tokens in and out of centralized exchanges as quickly as possible to reduce the risk of them getting hacked and your losing everything. Decentralized Exchanges aren't a new concept. The topic has been around for a while and they've actually been possible for quite a while thanks to Ethereum and Smart Contracts. They've also been possible on Bitcoin using something called a Hashed Timelock Contract. The adoption of this option has been low. Now that more and more people are getting familiar with coding Smart Contracts on Ethereum combined with a rush of tokens that suddenly need to be traded, is kind of a very good product market fit there for this decentralized exchange technology. So, today I'm gonna cover some of the big players coming down the pipeline as it relates to decentralized exchanges. I wanna preface this by saying, yes, I am aware that there are decentralized exchanges that exist on other blockchains such as Waves. I'm not gonna cover those today because most of the volume demand in terms of the trading tokens today is around ERC20 tokens, which are Ethereum based. So, I'm just gonna focus on decentralized exchanges in the Ethereum space for this video. The first I'm gonna cover is the decentralized exchange called EtherDelta. EtherDelta has actually been around for awhile. It was one of the first Ethereum based decentralized exchanges. That's been around since last year and it's currently active, so you can go and trade on it today. All of the funds on the EtherDelta exchange are handled by this unified Smart Contract. So, that means when you wanna trade something you send those tokens into this Smart Contract address on the Ethereum network. This has a couple of benefits that people like. Namely, you don't have to register for anything, but secondly, you're also not trusting a centralized server or company with your tokens. You're simply putting them over into the EtherDelta contract and you can pull them out at any time. So, that whole risk I was talking about with centralized exchanges getting hacked, goes away. This is gonna be a pretty common paradigm that'll apply across all the technologies I'm talking about today. The whole security aspect is taken care of because of Smart Contracts. There's no sending your funds to a company like Coinbase or Bittrex who could run off with them or get hacked. This is just kind of a stock standard expectation of decentralized exchanges. It's not a special feature and it doesn't really set any of them apart. What's going to set the platforms I'm talking about today apart is how they manage orders and facilitate trades between buyers and sellers. One of the tenants of EtherDelta is they try to keep as much of the trading on chain, and by that I mean they wanna keep most of this trustless and in the Ethereum blockchain which means that whenever an order is executed and settled, it's all happening in an Ethereum block and it's immutable stored in a blockchain. One of the challenges that these decentralized exchanges face though, is that Ethereum blocks aren't mined fast enough for high frequency trading. So, as such, EtherDelta actually has a semi-centralized service for an offchain order book. When you, as a buyer or seller on EtherDelta, want to submit an order you sign a message. You don't submit it to the blockchain, and then that gets stored in this offchain solution that EtherDelta has to replace an order book. If you've ever tried to use EtherDelta you've probably been pretty confused, because it doesn't function like a regular exchange. This stems from the fact that EtherDelta only supports what are called resting orders. There is no automatic matching between buy and sell orders. So, if you've used a traditional exchange like Bittrex, you're probably used to setting up a sell order and you say you wanna sell X many number of tokens, then you can kind of set and forget it and the automatic trading engine will match your sell order with a buyer once the price reaches what you wanted to sell at and everything will be filled. EtherDelta, and decentralized exchanges in general, don't work this way. Instead, everything is manual. So, when you place a sell order it won't be picked up unless a human on the other end of the equation manually clicks that sell order and says, yes, I wanna buy that up. Inversely, if you set a buy order, it won't automatically be filled either. A seller has to click your buyer order in the EtherDelta order book to then fulfill that order. This is kind of clunky and it has all sorts of impacts on liquidity and the way that the order book balances out. For a person who's familiar with using traditional exchanges, be it Bittrex or Coinbase or even the actual stock exchange and things like Etrade, it's very, very different and because EtherDelta has this centralized relayer for its order book, which happens offchain, but then the trades are actually settled onchain once somebody picks up a seller or buyer order. This often gets out of sync and things get slow. So, there's actually a chance that when you say, yes, I wanna buy this sell order on EtherDelta, somebody else might've already fulfilled that. Your order will fail when you actually pay the cost and submit it to the blockchain. This problem matched with the fact that everything's onchain actually makes trading on something like EtherDelta pretty expensive because remember, every transaction on Ethereum right now costs upwards of 20 to 30 cents and if you're submitting a bunch of orders that only have a 50/50 chance of actually being picked up because somebody might have already filled them, there's a good chance you're literally throwing money away. And, because of the lack of automatic matching there's all sorts of arbitrage opportunities that happen where stale orders can be picked up and manipulated. It's just not fun. Now, with something like EtherDelta, you can cancel orders once you've submitted them, but this actually opens another risk, which is called front running. And, the simplest explanation of this is that because all the trades are being settled onchain, miners of Ethereum have full visibility into them. So, if you submitted an order on EtherDelta yesterday, but today it's actually not a really good deal and you wanna cancel it, because you signed that order initially, a miner could still actually execute it. That's called front running, and be the counter party on the other end, so you lose money and the miners make more money because they're executing your canceled orders. So, EtherDelta is far from perfect, but it's an interesting experiment and it's out there and working today which is more than can be said for a lot of the protocols. As I said, there's a lot more development taking place and a lotta protocols coming through the pipeline. So, next in line is a protocol called 0X. 0X is actually a lot like EtherDelta in the way that it works. They didn't ICO though, so they have a token called ZRX and they claim that they're gonna use this token for the fees and decentralized governance. As I said, that's very similar to EtherDelta in that it uses an offchain relay system to match makers with the buyers and takers with the sellers for filling those orders offchain. It then does all the settlement onchain and it calls this a hybrid approach. The difference with 0X is that unlike EtherDelta which has the EtherDelta owned order book relayer system, which is just one, 0X, anybody can spin up a relayer and become a relayer themselves. As a relayer you get paid transaction fees for matching buyers and sellers. It's similar to mining in a way, but you're matching up people that wanna trade different tokens. It's important to outline that 0X is actually just a protocol. It is not necessarily a company that is offering the exchange. Using the protocol, other companies can spin off their own decentralized exchanges on top of it. There's one that actually just came out recently called Radar Relay. Just like EtherDelta, because it's using these resting orders in the system, it doesn't have any automatic matching, it's kinda confusing and it's just not as nice to use as a centralized exchange is today 0X is subject to most of the same problems I identified with EtherDelta, so I'm not gonna rehash them here. It also actually opens up a few other attack factors because of its ability to allow anybody to be a relayer in this equation. Something that EtherDelta does is it only supports something called broadcast transactions. I broadcast my order out there and hope that it gets relayed to somebody and that relayer is essential to that trade taking place. 0X also supports broadcast trades, but it also supports something called point to point trades. Point to point trades are essentially the same, but it means that you can bypass the need for a relayer. A buyer and seller can negotiate offline, come to an agreement without having to go through a relayer to facilitate that transaction. This is appealing to buyers and sellers 'cause it means that you can forego having to pay a transaction fee to do the trade. The problem here is there is a gaming vector whereby, a buyer puts in an order and submits it to a relayer and a relayer matches them up with somebody, but at the last minute the buyer cancels that order and just facilitates the trade offline with the seller. In this case the relayer has done the work of matching these two people and so by working offline together they're able to bypass the relayer who did the work and not have to pay them the fee. So, the relayer ends up out of pocket. If this gets exploited enough it could become less enticing for people to become relayers 'cause they could just be doing all this work and losing the transaction fees which could ultimately result in a lack of relayers and problems matching buyers and sellers together. Without a broad network of relayers it becomes a lot like EtherDelta with just a centralized bunch of people relaying between the buyers and sellers. There is also an attack vector called maker griefing. A maker is just a buyer. This involves a buyer placing an order, but then at the very last minute, moving the funds out of their account that were associated with that order, the funds they were going to trade. The network and the Smart Contract will attempt to settle that order onchain, but because the funds aren't there anymore it will fail. The side effect is that the miners still get the gas cost associated with processing that Smart Contract and if you look at the protocol of people that are paying those fees are the takers, or the person that's doing the sell, so the attack here is that a bunch of Ethereum miners could collude, submit a bunch and a bunch of bogus orders for buys and then move the funds at the very last minute. Those miners would then collect all the gas costs that the takers were putting up, but the trades would fail and the Ethereum miners wouldn't actually transfer the tokens. This would obviously involve a bunch of malicious miners doing this, but you know, anything's possible in crypto. So, in both EtherDelta and 0X protocol, there is still an order book. It's simply being relayed and communicated by these relayers, be they centralized or decentralized in the case of 0X. As a reaction to this, some people are saying, you know what? Order books are outdated, they don't apply to crypto. Let's come up with a better approach. This is exactly what a project called KyberNetwork is doing. If you have ever used the server ShapeShift or IO which lets you send one token in and get another token out anonymously, think of KyberNetwork as essentially the ShapeShift of decentralized exchanges. In Kyber the buyers know the conversion rate before they send their money across. They know what to expect in token B when they send through a bunch of token A ahead of time. And the whole promise here is because they're aren't relayers users don't have to pay any other transaction fees other than the gas costs of sending into the Smart Contract of Kyber. Instead of maintaining an order book, Kyber has something called reserves, and these are essentially just large stores of tokens that can easily be liquidated and sold to somebody. The administrators of the KyberNetwork are able to list and de-list different types of tokens, so they choose what tokens are tradable through the contract and in addition to that, they're also able to choose who is allowed to be a reserve on the network. To become a reserve operator you actually have to go through a KYC process with Kyber, which is kind of interesting. I'm not sure of the implications of that will be, if people will wanna do that. But, once you've set up a reserve people can then contribute to it and then become reserve contributors. These people essentially become the sellers in the exchange. So, a reserve operator will go out and set up one of these reserves and a bunch of people will contribute their money in, in the hope that they'll make a profit when that eventually gets sold. The interesting thing here is that the price that the tokens are then traded at is completely set by the reserve operator. So, the reserve operator is in complete control of monitoring the market and having to set the price when it updates over time. This, to me, feels a little bit tricky because markets fluctuate like crazy in crypto and the price can go up and down in a matter of minutes. The reserve operator is gonna have to be pretty responsive in terms of updating the prices when things change. Back to the way that this thing works, once you have these reserves set up, there's a big bunch of liquidity basically. The buyers come in and say, I wanna buy 1000 of token B The Kyber Smart Contract then goes out and finds the reserve with the best price that you can get for token B. It might say it'll cost you one token A per 1000 token B. If the liquidity exists on the reserve side, if the buyer accepts the offer from the reserve at a certain price, the whole thing is executed in a Smart Contract, the tokens trade hands on the Smart Contract and everything is secure. Any profits that are made by the reserve on that sale then get distributed evenly across the people that contributed to that reserve and gave it its liquidity in the first place. Again, this is really, really different to a typical centralized exchange, because as a buyer, you don't have a lot of control. You basically have to agree to whatever the reserve operators are setting as the price. The kind of theory here is that the reserves, because there will hopefully be many of them, will be competing to provide the best price possible and this market will bring down the price to something that's equal to what you'd see on other exchanges. This obviously, needs to be tested in practice, but it seems like a pretty simple approach 'cause it's the most like ShapeShift and maybe that's a familiar paradigm that people will buy into. I have some concerns. Firstly, the reserve operators setting the price. If they're not quick enough that could potentially result in arbitrage opportunities between KyberNetwork and centralized exchanges or other decentralized exchanges. Another thing that the KyberNetwork team haven't been fully transparent on is how long they're gonna require people that are putting funds into a reserve to hold them there. That could actually result in a liquidity issue for the people that are contributing to the reserves or the reserve operators because their funds can't be moved out of the Smart Contract. Kyber seems to be running on the testnet. We'll have to see what happens once they hit MainNet. Like most of these projects Kyber is also running a token sale. I believe that their token will give you some sort of membership access to the ability to even trade on the platform. It's kind of like paying an account fee up front with a certain token. Another protocol that's doing away with the order book is called swap. You may have heard of the referred to as, air swap, which is their for profit company that is building a platform on top of the protocol. The best way to think about swap is kind of like a marketplace. You have a bunch of buyers and sellers walking around trying to negotiate to come up with the best deal for both parties. Similar to EtherDelta and 0X, the swap team have realized that it's simply too inefficient to do any of this stuff onchain except the trade settlement. So, they're still doing the final order settlement onchain. Could all the matching of buyers and sellers and negotiations happening offchain and because there's no order book it actually means that this stuff is happening privately. It's kind of anonymous in that nobody's able to see your negotiations taking place like they are when there is an order book like 0X or EtherDelta. The swap protocol has a peer protocol built in with something called offchain indexes, and these indexes simply aggregate all the orders out there on the buy and the sell side and then match buyers to sellers and vice versa. So, an example workflow for this is that a buyer comes in to a swap protocol enabled app and they say, I wanna buy 100 of token B and I wanna buy it with token A. At this point they aren't specifying the exchange rate. They submit this offchain via the peer to peer protocol to an indexer, who then goes and finds the seller who wants to sell some token B and get token A in exchange. Those two parties then need to come together, again offchain privately, and negotiate a price which they'd both be willing to make the trade. The obvious question here is, how does the price get set? And, the swap protocol specifies something called an oracle. And, the oracle looks across the current network and determines what the recommended market price is for people switching token B to token A. So, both the buyer and the seller in this equation, when they're doing this offchain negotiation can consult with the oracle and then change the price that they're requesting based on the recommendation the oracle gave them. Once they come to an agreement, the price they're willing to trade at, the order then finally gets executed onchain. And, the swap takes place. By doing the bulk of this stuff offchain through this peer to peer protocol, they're reducing the inefficiencies and making it a lot faster, but they're also reducing the gas cost considerably, because the only time you ever have to do anything onchain is when the order is sold. And, because all of the negotiation is happening offchain, it avoids the problem that we talked about earlier, front running, because miners have no visibility into these private communications that are happening and these private negotiations between a buyer and a seller. There's no way a miner could come in and potentially mess with that. This means that ultimately buyers and sellers get a very fair trading experience. Now, that's not to say that this swap protocol doesn't have some potential drawbacks that I've identified. Firstly, out of the box, there's no automation so you can't set buy orders or sell orders that get executed automatically. And, my second concern is about that oracle service. Is there a way that that oracle can be gamed in any way to wildly fluctuate the price that it's recommending, to then push trades that people are negotiating in certain directions? Now, I'm only going off what I've seen in the White Paper, but I haven't seen anything about how they would mitigate attack vectors with influencing the oracle through submitting a whole bunch of bogus orders with ridiculous prices. Now, the last technology that I wanna mention and I think it's worth a mention, is Omega One. It's not necessarily a decentralized exchange per se, but it exhibits multiple traits of one with security, but gives you the speed and efficiency of a centralized exchange. Just like all the other protocols I've mentioned today, Omega One stores your funds in a Smart Contract so there's no way that they can be stolen. You're not relying on a centralized authority. The only time you do anything onchain is when you're settling an order and the swap is taking place. But, let's talk about what makes Omega One different. It consists of two components. The first is an internal trading pool. So, it's similar to other protocols in that it has this internal network and if buyers and sellers in there are wanting to trade the same thing and it can adequately match a buyer with a seller, then it will do the swap internally. So, if you wanna buy a bunch of token B for token A and there's a seller on the other side of that that's also on the Omega One network, then the protocol will match you two together and trade you in the middle of the market. But, if that liquidity doesn't exist which is often the case with these smaller decentralized exchanges, there isn't a buyer on the other end of your sell order, or there isn't a seller who's willing to sell you as much of token B that you want, Omega One as a platform actually goes off to multiple centralized exchanges and trades on your behalf to get you the best price available. So, it's going out when it can't find liquidity and finding more liquidity in these centralized exchanges. The real cool thing I see about Omega One is that you get all the benefits of the decentralized exchange. You get that security that's backed by a Smart Contract and you also get the ability for that internal trading pool to efficiently route buyers and sellers towards one another, but you also get the cost and time efficiency of a centralized exchange, plus the liquidity if it doesn't exist on the internal network. Omega One have really gone for the best of both worlds approach here, where they've kind of found a good middle ground and I think it's really interesting. One of the challenges it's gonna face is that if you're going off to liquidity and the token isn't listed on one of those centralized exchanges, as I mentioned, Bittrex and Poloniex, they aren't listing a lot of tokens anymore. If it's not listed, then Omega One's gonna have a hard time finding it because it's not gonna be on those centralized exchanges. My guess is that the internal pool will probably take care of that because the token will be listed there. The volume and the liquidity might just be a lot smaller than it would be on one of these centralized exchanges. Like everybody else these days, Omega One is doing a token sale and I believe that's gonna give you access to membership and again, your account fee to be able to trade on the network. So, that's a rundown of some of the technologies coming through the pipeline and I'm sure we'll see them hitting the MainNet sometime over the next six months. I think these technologies are really cool, but it's gonna take a while to perfect them and when you go to the real polar end of the spectrum in terms of decentralization, it's just too inefficient. I think they are gonna need to be stepping stones, where we accept a little bit of centralization and then a little bit less and a little bit less, to get to a fully decentralized exchange. Otherwise, it's not gonna be cost effective and it's not gonna be fast to use. And, those are the things I think most people have come to expect out of an exchange as just a base level of service. A common theme I was bringing up in this breakdown is that all of these protocols are storing your funds in a Smart Contract on Ethereum as a way of securing it and you not having to store it with a centralized authority or company. Now, while this is more secure, you're putting a lot of trust in the Smart Contracts themselves, and I would say the majority of people out there that are trading crypto assets probably aren't capable of auditing a Smart Contract fully. Flaws in Smart Contracts are not unheard of at all with the Dow hack, the Parity multi-sig wallet problem. Tens of millions of dollars have been lost in Ethereum due to bad Smart Contracts. So, one speed bump that I think decentralized exchanges will face inevitably at some point in the future is bad Smart Contract coding resulting in the loss of user funds at some point. When you're running a huge amount of money in liquidity through a Smart Contract, it essentially paints a big red target on it for hackers to go and try and find vulnerabilities and exploit them. Another problem facing some of these protocols is that they currently only support Ethereum. They only support a single blockchain. And, while technology such as Kyber have been talking about cross chain atomic swaps with something like Bitcoin, this is really far in the future and I don't think it's something we're gonna see this year or maybe even in the first half of next year. The technology needs to be proven out. I imagine Omega One might be able to get past this because it's sourcing some of its liquidity from centralized exchanges, so it will be able to do, I think, cross chain. And lastly, because most of these exchange protocols I've described kind of involved a shift in paradigms of how people are used to interacting with exchanges, then I think there's gonna be some inertia towards the traditional centralized exchanges and it's gonna be harder to pull users over, especially if these decentralized exchanges are more costly or slower to use up front. The benefits of using decentralized exchanges have to quickly outweigh that of centralized exchanges in order to shift the bulk of traders over from centralized to decentralized and build enough liquidity pull, so that it's worthwhile going and trading on them. If there's a load of liquidity in these markets I just think it's a real barrier to their success. So, that's my breakdown of decentralized exchanges. There's a lot coming in the works. I think we're still in the very early days and it's probably gonna be a good six to 12 months before we see one that's reliable and you can use on a daily basis. I hope you found this video useful. If you have any questions, just drop them in the comments below. I'd also love to hear about any other decentralized exchanges I didn't mention. Let me know. There's some coming on the market every week, I feel. Thanks for watching. Until next time, see you later.скачать dle 11.3
Comment:
Add comment
reload, if the code cannot be seen