Launch Your Project w 0x
ETHGlobal·Wed, Oct 9, 2019, 12:00 AM
The team from 0x explains building on the 0x protocol at a workshop at ETHNewYork. ETHNewYork was a hackathon organized by ETHGlobal and a team of hackers, developers and enthusiasts interested in building and creating in the ethereum ecosystem. ETHNewYork ethereum focused hackathon took place May 8-10, 2019 at New Lab at the Brooklyn Navy Yard. For more information visit https://ethnewyork.com/ and https://ethglobal.co/
Transcript
so just a show of hands who here has heard of Xerox before or maybe built something was your house okay so pretty much everyone cool great good crowd so I'm here to talk about on Xerox launch kit move Xerox launch kit you can start your own Xerox we layer in under a minute so what you what does this mean what is 0x well we sorta had this vision that the world's assets are becoming tokenized meaning different assets of value are gonna be placed on a public blockchain to improve liquidity and ease it access and zero X is gonna be sort of this exchange layer that underpins all the different types of tokenized assets being betrayed all these different types of items that might exist as well as different modes of exchange that might be required to trade something you can imagine you know auctioning off your crypto kitty is gonna look much different then you know trading you know one stable coin for another stable coin but luckily 0x is flexible enough to support all these different modes of exchange so we sort of provide this court settlement layer for trades where people signed orders off chain and then relay that and then settle them on chain when they find a counterparty and you can use this this free free to use open source non-custodial platform to build any sort of different relay that you want so you know in the top here we have an example we have pair decks they had sort of employee one different style of relaying of exchange we have radar relay sort of a different style of model and you avail as well they're relaying shares in Agra markets as opposed to just your standard you know your c20 utility tokens but they're all using 0 X under the hood to settle trades between two different people without having to you know have a centralized exchange custody their funds or or execute the trade on their behalf and so this is so we mean when we talk about having a relay for every different market um you know trading collectibles on relay or like 'man looks much different in trading commodities on a relay or like radar relay which looks much different than trading you know shares in a prediction market on a relay or like Vale many different modes of exchange many different types of assets so all using 0x under the hood so if you want to use 0x today you probably interested most likely and using it to build your own relayer maybe you have a new type of asset that you want that you've created a new token you wanna create a first party marketplace for it maybe there some new motive exchange or some you ask that that you discovered and you have a really good idea for creating your own relayer and we wanna make that really easy for you to do so a couple months ago we launched to Xerox launch kit which has this tagline of being able to start your own relayer in under a minute so it's this open source sort of bootstrap template for building your own relayer and we provide this this get a brief uh that you can clone and you know with under in under a minute start you're sort of around sort of server that's going to post orders from different users and then sort of them up to people who might want to trade them it comes with the typescript energy JavaScript code base we include an API that complies with our sort of standard relayer API spec so really easy to share orders or for traders to plug into your API and start filling orders that you might be serving we automatically validate and prune orders on your behalf so you have to worry about you know writing code to verify that orders are correct or not expired we take care of all of that and it means a sequel like database for storage but previously people had to develop their own UI's for launch kit so it was just a server um and if you added one to go build your own you know stable coin relayer for particular locale you would go actually write that on front-end and one of the largest pieces of feedback that we got with that people want a sample front-end as well so we've been working on two new front ends for Xerox launch kit that we're really excited to share with you guys today one for trading near RC 20 tokens and sort of looks like maybe your standard you know commodities exchange on the left as well as a front end for trading crypto collectibles or a RC 721 tokens so this looks more like maybe like a tea day or something like that but both using launch kit to sort of serve store those orders and serve them and then all using Xero X under the hood to actually settle these trades so it's a free relayer for you Jim it's convenient professional react code base and that you can use as a template for building your own relayer so we support different types of orders we validate your orders to 7:21 real air comes with a dutch auction so you can actually auction off different crypto collectibles that might need this sort of mode of exchange we take care of rapt ether which maybe you've heard of or familiar with we sort of abstract all that complexity so you get a really nice user experience and we sort of default using meta mask but it works with any web three providing wallet so we're actually gonna do a little demo for the remainder of this time um so if you guys want to follow along I have links to both the launch kit UI they'll launch kit back end as well as a live running demo of launch kit on Kevon that you can play around with if you want to get a sort of a feel for how this thing works so if you go to bitly or Lee slash launch kit UI or badali slash launch split launch kid be4 the back end you can clone both these repos and follow along if you want I lent you on JavaScript as well narrate what's going on and even the instructions inside of both the repos as well so just like a couple different commands that you can follow along so to start so to start we have that the typescript and JavaScript folders so you can sort of choose your language obviously we use a lot of typescript @ 0x but we you can also compile the script down to JavaScript if you want so I've cloned the launch kit backend that's what you're looking at right now you're probably going to want to install all of your dependencies so you can just run yarn to do that language folder that you want to use so I'm use typescript and we're gonna look at the same source and so there's a couple different parameters that you want my mom might want to set for your own backhand for your own kid I'm sorry you might wanna check out the whitelisted tokens so these are different token pairs that you're going to want you want to allow trading on your relayer so by default we allow any sort of asset pair that you want to be traded on your relayer so anyone can make an order for trading you know a token effort oh can be and will accept it and store it validate it and then serve it up to new users but if you only want to restrict trading to a few term types of token pairs you can set those contracts in this parameter again we sort of default to coban but you can set it to main that or Rosten or whatever your preferred network is we also have instructions for making this work with ganache if you want to do some local development as well you can take your maker and take your fees this is how most real Ayres monetize is they charge a fee for hosting orders and you can sort of set those parameters there and then your RPC your URL it comes with a inferior come on endpoint which is helps it work out of the box but obviously you can supply your own as you want and you can sort of see the logs we started one with the Conte and you deserve verify that is actually running on for 3,000 and serving up orders that are being stored on this back-end we can switch over to files what we do include sort of a simple server just so you can get started so you know three or whatever you preferred you can choose to either you use the ERC 20 or ERC 7 21 interface they just refer to different paths when you actually end up serving files but they both come in the same repo so um you you sort of get those for free but you can choose it when you actually end up serving to users so this environment parameter environment parameter the react app relayer URL right now I'm pointing it at local Lowe's 3000 v2 which is where our our current back-end is running here you can see my order creation form over here market order if there's already orders on the book and then we'll just match find out which orders you actually want to buy and then fill them for you or you can post your own limit order if you maybe you're a market maker or even specific price in mind that you want to see so right now we have zero x zr x wheat and maker wheat by default but obviously you can set whatever sort of token pairs you want a lot of trading for and then you can also check out your wallet and check your balances so you over here with this really nice conversion dialogue for trading moving between Keith and we--the this is maybe something that you have experienced in the past and been very frustrated with transaction confirmation dialogue and then we're good now we have as much as we want or as much as we want no longer fiddling with different numbers in Co it balances updated real time so we to see this new back to having a couple week first launch kit front end will determine if you've actually if your allowances set if not will prompt the user to you can see down here we use di p7 one to two actually so you actually see what you're signing you're not normally signing some arbitrary hatch and hoping the real layers doing everything correctly you can actually see the content of the message on see how much you're actually selling see what you took in a contract you're using etc so I'm gonna go ahead and sign this placing the order and now we have a live order on Cove on for you know selling some CRX and buying some wheat and we can verify on the backend that oh we actually did see this request come in to the backend so you know somewhat the front end was able to post the order and then that we start serving up to new users so going back to for a second cool so now let's say someone else comes along and they want to actually fly this is your ex so let's switch accounts real quick and oh I actually see you know there's some some ZRX in the order book and actually want to fill this so I'm gonna do a market by 400 ZRX and the launch gate you I will open the backend calculate which orders actually need to be filled for a market buy and then generate a transaction through filling those orders for the user of course I can also always place a limit order but you know it's always really convenient just do a market buy if you're if you're pretty pricing I'll stick so let's say I want to actually buy this CRX so I'm going to confirm this transaction and you may have noticed that you know I actually don't have any week on this account right if you look up here I have zero wheat so how is this actually happening right so I don't actually have any wheat um so how is this transaction actually happening um we determine if you don't have enough wheat and if you do we automatically route your orders through what we call our forward or contract which will wrap eat on your behalf and then fill the order and send the result back to you so we remove that one extra complicated step of you know using using 0x we're using Vinay these other d5 products by you know optimistically determining like what the best path is for the user and I did not do enough sacrifices to the demo god and we're hitting a small snag but trust me this works and it's really really slick so I think that's about it actually any questions so far yeah yeah yeah so if you look in the back end we have some like handlers that we that we use a type Ora so we default to using sequel Lite and we some types to find that will you know write to the database for you but you can use any sort of database that you want as long as there's like a handler yeah yeah really good question um so this particular so the launch get back end uses what we call it hope in order for model and some meaning that these orders once you're being relay it can be filled by you know anyone else who finds them and wait is usually done is via pinging in your view layers API getting their order book and then videos another layer you know downloading it locally and then serving it back up the standard real layer API makes us really convenient it's a common API spec that you know we could propose that many relays implement and many actually enough do and many of them do so in this example let's say you're running your own version of launch cake and I'm running my own version of launch kit you would you know using some of the standard libraries that we put ping my real layers API download my orders and then serve them back up to your own users on your own interface um so having this comment API expect makes it really slick and moshpit comes with this out of the box we're actually working on a new project called Xerox mesh which pretty sort of a cute peer-to-peer order routing network um that makes this entire process much slicker so we have some some details like that about out about that right now we think Ruby giving a talk about that later at New York actually um there should be out the coming months yeah so let's say you were relayer and you're charging fees for those fees are paid in the order itself so if you your my orders and some user pulls it I actually collect fees on order and you get the additional benefit of having deeper order folks and more validity so as a real I really incentivize to make sure that you know orders that get posted on my book get spread everywhere so they can be so I can collect fees on those orders notes they get filled and what's really interesting is this sort of enables is the concept of what we call contact bill validity where it's not just other relays and other users actually filling these orders but on the other key by apps like dy/dx fillings your ex liquidity or it's different interfaces like Xerox instantly where people on a different application or a new site or an adapter can fill orders were relayer and their customers so this is this pool of nobody really enables like all these different use cases so there's no more questions about this and we'll also be at our table during give New York if you have problems or questions or anything like that you know [Music] you know new addition to launch kit provides new tooling and scaffolding so you can I'm really gonna jump start on some of the new products you might be you shouldn't working on for Keith New York so you know you ness is now you know stands are now OSI 721 assets maybe you want to use our of 721 interface to build it yeah enos marketplace maybe you want to build them your trading platform or a secondary marketplace for CBP's we could have a bunch of blog posts with a bunch of inspiration about new ideas that you can build using under the hood and we're giving away two different prizes won $1,500 prize for the particle to 0 X and then we're also doing a joint prize with wire for combining some of these guys at wired robots along to see relax so launch kid is also just sort of the tip of the iceberg when it comes to different projects and tools and Xerox provides definitely go to our website it's your except org check out some of the tutorials documentation tools that we have we really want to make it easy it was just like a few lines of code for anyone to use exchange and indeed from boat that they want so yeah looking for it is here for you guys and [Applause]
Automatic transcript — names and jargon may be misspelled.