Building Scalable Dapps with the Ethereum Application-Specific Blockchain Framework
EDCON 2019 · 12 Apr 2019 · 17:40
Peter He presents ContractLand’s application-specific blockchain approach through a decentralized-exchange demonstration. He explains changes to consensus and contract deployment, then describes Terra Bridge for moving assets between chains, connecting application performance, noncustodial trading and the limits of ERC-20-only exchanges.
Speakers
Topics
From EDCON 2019, hosted by EDCON.
Transcript
okay so let me now announce the next speaker who is also a la speaker before lunch his name is Peter he and he is the lead developer at contract land and they're building chains for trading crypto thank you hi guys my name is Peter and I lead the technical research and development efforts at Contra clan and today I'll be talking about how we managed to build a performance yet fully decentralized
exchange you think aetherium technology along with the concept that we call application-specific blockchains so we're all familiar with the concept of the essential exchange exchanges and the benefits that it has compared to traditional eyes traditional centralized exchanges and but why hasn't decentralized exchange caught on to the mainstream when we see the trading volume between texas and central exchanges there's a huge gap and while the essential exchanges that caught on some some attraction in the past couple of years in the training community we still see that most traders still resource to centralized exchanges for most of their trading needs and we believe the biggest reason behind this is that in order for a Dex to
compete with traditional centralized exchanges it needs to have a user experience and performance that is just as good if not better than their traditional centralized counterparts so so when we set out to build contract land we set ourself with three three goals that we wanted to accomplish that we weren't gonna compromise and the first of which we wanted to build it Dex that is as fast as centralized exchanges and we wanted to be able to trade virtually any cryptocurrencies available and we wanted to keep is most important the most important property want to keep was this decentralized this decentralized properties which is that we wanted we don't want to have any kyc
we wanted to have at be accessible by anyone anywhere in the world so here's a preview of the decks that we've been building for the past year and what you see here is a pretty typical spot market trading exchange and every action you're seeing here is actually happening on Shane so you can see that trades are almost happening on a per second spaces and in this entire application stacks there's only two components you have the front end user interface that you're seeing right now which is built in JavaScript and the underlying blockchain that is connected to so all the components are be exchanged that such as this order book matching engine trade history order history are all
being done on chain so in order to build this we have to solve few major challenges the first of which was the performance and throughput bottlenecks up the under line blocking itself so as we know most of the blocking systems today does not have the same capability to support large steel applications as traditional centralized servers so the matrix we usually look at for block chains for his performance is usually the block time and transaction per second so Bitcoin for example has an average a 10 minute block time with five transactions per second while etherium does this a bit better with a 15 second block time with 20 25 transactions per second but in the context of a exchange where especially one that is targeting
the trading community where you have a lot of automated trading BOTS market making boss high-frequency trading BOTS the exchange system can be very demanding on the underlying platform so in order for us to build it the X that can compete with centralized exchanges we needed to have block times in the in the matter of seconds and the TPS in the in the matter of thousands at least and centralized exchanges of course mitigate this issue entirely by not having to make any unchained transactions at all well the most Texas that we know today are hybrid exchanges which combine both Alan Turing and offering solutions to delivery through their user experience however this we didn't want to go on this approach because we felt like that the moment you introduce any centralized
components to our decks you're we're then again exposing ourselves to all the traditional centralized risks such as data availability access availability and censorship especially if those components were offloading to off chain are things that like there are like order books or matching engines which are crucial components of the functioning of the exchange itself another problem that we had to face was the number of available trading assets on the decks so most decks we know today built on various blocking platforms are pretty much limited to trading the native assets on the blocking that they're built on so in the case of etherium for example most taxes built on a theorem are
limited to trading ether and ERC 20 tokens but when we look at the 24-hour trading volumes of all the Crypt cells we see that none of them are years 20 opens we have popular coins such like the coin ether us ripple so in order to build the decks that can face the mainstream trading community for crypto we had to we couldn't limit ourselves to just the are g20 tokens so we had to include other cryptocurrencies as well so when we started building started researching on the method methods that we can use to approach the building over decks we realized that the traditional methods of building gaps where the exes wasn't going to help us accomplish our
goals so we had to try something new we have to contain things out that outside of the box a bit and one of the concepts that we came up with was called application-specific block chains or ab chains for short and to put in simple terms an ab chains is a public aetherium block chain that runs a singular application logic and by doing this you solve the performance and throughput issuing in a few ways the first benefit is throughput and this is benefiting from without any making out making any additional optimizations of the blocking layer itself so when you're running an app saying we run ready an application on App chain you don't have to worry
about other applications possibly going viral on your network and congesting congesting up the networks for your users because the application chain itself runs a singular application logic but of course in order to increase the performance you have to actually make customizations on the lower level blocking layers and for the blossom layer we're using parodies eutherian client working rust and the reason we chose to use parody because it's one of the most robust and well maintained idiom clients out there but most importantly is because it's flexibility and modularity in design makes making customizations for app things very simple to implement and in order to increase the performance
of the option yourself we have to make some customization on the consensus layer for the blockchain and instead of using the traditional proof of work consensus mechanism I'll be theorem we're using a much simpler round-robin style consensus mechanism and how it work is that you have a set of validators and each validator get to produce a new block at each new Block interval and all the other validators will try to verify the block and create included in their own blockchain and once a block is included by and verified and included by more than 50% of all all validators then is considered finalized and from with the description you're probably thinking that it's very similar
to that of a proof of authority based consensus mechanism and that's exactly what it is and for a consortium or private change that alone would have been sufficient but our goal for app chains is to be able to deploy them in an open network that can be accessible and maintained by anyone without having to trust any centralized third parties so in order to do that we had to figure out a way to incentivize the validators and punish the validators in the case of correct or incorrect behaviors so in order to do so we developed a proof of stake based validator selection criteria that Valladares can actually join the validator pool as long as they have the tokens of the native native tokens of
the app chain depositing the staking contracts so anyone can become a validator of our in-app chain and or exit the validator Pro as they please and not the customisation we'll had to make four options was the disabling of the turing completeness of the EVM so the theorem was built as to be a generalized blockchain that can run any arbitrary logic but this is exactly opposite of what we want to do with app chains for app chains we just want to run a single or application logic with a defined a set of smart contracts so what we did is that we disabled on the EVM level to disallow the deployment of arbitrary smart contracts and this
allows us to without censoring the net as a whole to prevent the execution of arbitrary logic and in the possibility of congesting up the network so the first thing that we built using this methodology is called searching which is actually the plotting that's currently running our trading engine which we see in the preview that showed and the current metrics off this blockchain is running on two second block times with 3,000 transactions per second and these numbers are pretty flexible in the sense that in evey in AWS terms the current these numbers are pulled from T to small machines and if you scale up the Machine
size that you run these nodes on such as if you go to md5 and the medium and the large machines you can easily scale up or scale down the numbers and with the performance issue solved we then had to solve the token the token issue which is which was the number of available to help answer you can trade on the Dex so you want to do this we had to build out some interoperability solutions and different thing from the most interoperability solutions that we know today such as polkadot or cosmos or ions which are more focused on generalized intra blocks and communication are crossing token bridging solution which much simpler we just had a go to be able to transfer tokens across block chains
in a trustless manner and our Terra bridge solutions actually inspired by the original parity bridge solution which was that you have to plug things and sit in the middle you have a set of bridge validators that monitors the transactions on either side of the bridge in any transaction that is approved by more than 50% of the validators will be relayed to the destination chain and so this work this bridge mechanism works on a simple majority voting consensus mechanism and currently for Terra bridge the consensus mechanism is proof of authority based but we're also working on the approval
of stake upgrade for the bridge as well and a little status update on the current status of the bridge we built last year the EPM - EVM version of the bridge meaning you can use the bridge mechanism to connect any two EBM based chains such as aetherium or any AB chains or any Forks of aetherium such as cue thom ruhe stock and transfer token freely between those two chains and it's actually being deployed into production by several projects including ourselves and earlier this year we just finished the EBM - bitcoin version of the bridge which allows you to transfer a bitcoin between any EBM change any bitcoin like strings such as light coin - or Bitcoin
cash and we're always building additional bridge interfaces to connect to more blushing systems so here's what the bridge into user interface will actually look like on the decks and first of all when you log into applications there's no traditional signup or a registration process with emails you just input your mnemonic or your private key and then instantly you can start trading and what you see in the bridge do is that you have you can see all the assets on your address on different networks that the text has so you have on the left you have terror chain which is what the exchange engine is right on you have aetherium have Bitcoin and when you want to trade on contract land you
just transfer your tokens from one what one network to tear chain and then once your own tear chain you can trade as fast as you see in the demo and putting together the app chain concept and the cross chain bridge protocol concept you have yourself a more of the application blocking framework and we actually composed these two concepts into a single repository that you can easily use to spin up your apps your own app chain along with the bridge connected to the blockchain and we did this because we felt like the concept of the app chains is not limited to people that are building building these centralized exchanges but any application that have potential needs for scalability or
interoperability such as games payments social media and any financial do the systems so what can you do on contract land or more specifically we can't do you only that that's built on a ab chain concept so first of all you have wallet wallet security is the purely decentralized applications there's no centralized components at all so all you need to do to interface with the application is your public and private key and you have availability and there's two folds to availability one is that availability meaning that all the data to the application to our decks is publicly available and anyone can access it and availability in terms
of access meaning because it's running because all the components are running on the block's network as long as you can connect to the blocking network you have access to the application and because it's maintained in a distributed system the down the likelihood of down times is very small because we have to have bring down the entire network in order to bring down the application itself and you also have a limited token listing and this is the concept meaning that because it's running on the blockchain which is publicly accessible and publicly usable there's no limit on which token you can trade so compared to centralized these changes you have to usually pay the centralized exchange authority to let your tokens for a dex build this way you can treat virtually
and your token that the cross name protocol has enabled on and you have a centralized trading experience and this is very important because in order to appeal to the trading community you have to have a performance that is adequate for their trading needs and that is it if you want to try out the exchange for yourself you can actually just go on he exchanged our control and I oh and for those of you that are more that I already have accounts or have addresses on your Bitcoin can simply import your mnemonic and you can easily start trading without a no question ask essentially and if you're interested in the token bridge solution which is open source or any of the app chain framework the repositories
you can join our developer only chat on slack by going to dab the contract line thank you for your time thank you Peter I just have one question for you I I actually wanted to ask you about sort of what what set you apart from other Dex's but you said something really interesting which is that you sort of have unlimited listing which is obviously what you can do indexes the real question is now centralized exchanges are actually saying that well we only want to list certain projects that we back that we've done due diligence on so there's more business question do you think that that sort of that gives them a competitive advantage because they have a team behind them who actually vet for these projects and yeah this very good question I think though
the is very two different audiences that you're appealing to you so for central exchange is a very different business model what we're trying to do is to essentially build an open network that people can use to trade cryptocurrencies on there that is and can be very performant can be very fast but at the same time it's very open and very transparent and the question to answer your earlier question the difference between what we were building and some of the existing decks solutions already have in the etherium ecosystem is that we're more targeted towards the traditional trading community of cryptocurrency so not necessarily the technical technical savvy audiences or the people that are just holding or
exchanging tokens for utility purposes these are people trading community are people that are trading cryptocurrencies purely for financial incentive is in tips so performance and the user experience is very important for them thank you so much