New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Building applications using fast Plasma asset swaps on Matic - Jaynti Kanani

ETHGlobalFri, Oct 9, 2020, 12:00 AM

Building applications using fast Plasma asset swaps on Matic with Jaynti Kanani from Matic

Transcript

hello hello everyone my name is giant economy and I'm a founder and CEO at matok so automatic we basically Matic is collaborative solution for each idiom we build a plasma based sidechain for each item and we are vm compatible for now like we have es is 20 and yes is Ren 21 state transfer plasma secure on sidechain for other state you can use directly proof of stake kind of security here I'm gonna explain like how you can use plasma and mattock to swap assets on on sidechain and make it very very posh for attacks so before before I jump into the automatic the swap I just want to give Rick order of architecture of mattock so we have like um so basically sidechain is basically simple as a parallel blockchain to the ETM blockchain and after a certain interval multiple validators who are relating the sidechain will push the checkpoints a kind of hash of the multiple blocks on the on the ATM chain so so let's say if you are like like 10 blocks on this i chain up to 15 second up to 50 minutes like say a thousand over 1024 blocks on the side chain all the validators will just validate all the blocks on the side chains and create a vertical vertical route of blocks and push it on the on the automatic chain on the on the edge theorem chain the thing is that the contract which interact with mattock chain on the it remains on the etherium chain and whenever you want to move your assets from the serum chain to metric chain you deposit and you kind of make a transactions deposit transaction on the serum chain and transfer your tokens to one one contract on the serum chain and validators basically means meant those tokens on the on the automatic chain so now user who deposited on the I'm chained we'll have tokens yessuh 20 tokens on the on the side chain on on their addresses and then there is a transfer or no interact with romantic chain with a token statically without no without any waiting for like a theorem block confirmation etc and and and and whenever they want to whenever they want to withdraw their tokens from the same chain to a pramatta chain to attempt chain they basically provide a proof on the item chain against the check points recent check point so it's pretty basically it defines like plasma plasma framework and plasma fever is basically nothing but like a kind of a framework where it says even if the sidechain holds a chain or stops or fails you can you can go on the theorem chain and withdraw your tokens by providing a proof one contract so thing is that we we changed plasma a little bit to provide a VM compatible plasma so for that we need to add multiple things at the receipt level on so EVM I don't know if you if you all know the EVM how EVM works so basically it has like at is it in transactions and where you can define a data of all as kind of logs and what we did is like creating a simple input/output kind of you TXO model on the on the on the receipt and with this it you can actually have like plasma kind of framework in the EVM so so why we are actually using plasma because is very secure and if the whole section fails you can actually go on the same chain and get your data out of it we also have like proof of stake layer multiple generators so we don't operate only on single operator it means like we have like good aliveness and at our availability available for our data on the side chain so even if let's say one or two related us goes polishes yo BB security dude you don't have to exceed from the from thematic chain now let's say SSA like we just use some of this state as a plasma secure so one of them is like ESA 20 and 71 but we also provide a way to swap those assets on the on the side chain so thing is that we have like a way we need to change es e 20 standard a little bit to make it work before I jump on to that I just like just the advantages of the SL swap is like we have like we deployed those assets web features and on medic we terminate like a loss ever you can use fab for like multiple multiple ways like nfg marketplace decentralized exchange ease and and yeah you can get like robust security kind of ATM security directly on automatic yeah and the so now the thing is that some of the some of the things when you make some of the things you need to remember is that when you make a sex web on the on the metric chain this is like how it works it's a little bit different than the 0x wrap on the matting on the only theorem chain because we need to make sure you how like a proper kind of proof you can create a new exceed from the magic chain so here is a simple flow how how assets web will work on automatic so so let's say we have like buyer and the seller and they just create order of chain of chain when I say off chain here it says like off chain to my dick like it's not automatic it's just off line to any any any block chain they just like peer to peer it can be peer to peer it just create a like buy and sell are just agrees on one particular asset and they just create order out of chain and then just say sign multiple sign signature on the both side and then we have transferred with sig method added in PSE introduced by o matic into the ESC 20 standard so it kind of extended that simple yes a 20 token standard and edit or transfer with sig and second method we introduced is this execute odor so basically one let us say all both both the science the transics a kind of order a buyer and seller and then just they just execute call the execute order on the on the medic medic site chain a swap contract basically contract will just verify the signatures on the both side and let's just call a transfer with C on the both kind of acid so let's say if you are if you're if you're transporting like ZRX with let's say some medic tokens both contract will have a transfer with seek method on the both contracts and execute contract on the marketplace web contract it will call both transfer with seek method and just do the swap on the auto mix automic way and here we have like partial confirmation of one second so that it looks like you are swept making the prayer in one second but actually it will happen like after a checkpoint goes on the theorem change so basically we have like kind of no partial confirmation notion and the finality on the theorem when checkpoint goes in the etherium so we introduced the transfer with primitive why because we can't use a peru standard on esa twenty-eight will how like so let's say if you if you approve some tokens and then you make a multiple transactions and you try to exit with your you with your older or older tokens in that case approve will have some problems where you create a proof on the ATM chain so that's why we actually disabled approve on the on the on the SE 20 tokens contract on the magic chain and we just provide a way to transfer tokens which this transfer be sick because transfer account to accounts webs are very provable and know both in both here's 20 and yes i don't do one you can use transfer method without any problem and also after updating microtransactions visi using a signature you can verify easily on the serum chain when you exceed or whenever you want to no challenge any transfers on the on the magic chain and yeah I mean so basically we have like extensive docks dock here let me it has basically everything you need to create simple vic-20 scrapping so here so basically we use VIP say over seven one two four four four simple signature and see how our transfer be sick so basically transfer we see takes signature amount data exploration so basically we also need expiration date for the for the signature so people don't like misuse after like signing and after let's say when they prove their this checks the expiration date is less than a block number or node and then they just pro just this is a simple a simple kind of no check of the replay attacks where we need to make sure simple signatures don't get no make a trade like multiple times then we just simply do the transport form and this transfer from internally will call transfer is sake for a simple transfer all the tokens for you yeah so and and for marketplace so this method will be on the both both contracts let's say if you are transferring or trading your ERC 20 tokens oh yeah see 71 token it both contract will have a similar same send method instead of in a situation 721 instead of amount it will be like a simple ID NFT ID and for marketplace it's just simple marketplace it will have a simple execute order method and it will take multi five things basically a data 1 data to a data 1 data do is pay nothing but data of your orders so basically let's say in some cases let's say yes if you are making a trade for se 20 vs. ESA 2 nd you need to make sure you have like amount and the number of tokens in your data in your order basically and we have order ID expiration date for the signatures and who is a taker so and yeah so basically just cause a simple transfer we see on the both contracts this is the contract 1 and this is the contract - and this is checks okay hey if both works exactly it's encrypted and then and then make a transfer make a swap happen right and that's why this is what I don't make simple swap and you can always use our predicates for it like and truffle we are using it if you want to deploy your own contract you can always go on deploy your own contract using a mix and we have like particular dogs at dogs dot Matic dot Network yeah and and we also have so basically we just we just integrated Moy beat as a data layer data storage solutions on on automatic so if you want to how like a simple so so basically this is a decentralized storage which directly supports Matic or to the box and if you want to let us say a store some data is a marketplace assets or etc you can use boy Pete and we have yeah we have a look fully fully documentation for it as well so basically it's we have likes multiple multiple libraries they say mo bit by bit medic and we have like Matic jst case where you can use statically to interact with Matic medic swap contract and you can we have like simple demo as well and yeah and you can actually interact with file systems directly here yeah we just initialize your file systems and you can leashed and add files and data and inter eight among your files and data directly yeah yeah so yeah and if you want to have like if you're if you're new to metrics metric network with serial network you can use to mate guide to get started on automatic it will have like everything you need for test net for said we also elect this is this will show how our deposit and withdraw withdraw box you also if you want to make a simple transpose on yes 20 you can use this simple ASE 20 example and metric J's SDK for it yeah and this is this is our team giving a demo on how you can use metric J's SDK directly on using estus on automatic so yeah that's it if you have any questions just and yeah of course we have like much the multiple future works on asset side so we have like currently it just supports a simple make maker and make and feel we have we also gonna introduce partial fill of chain we also going to remove the front running problems on automatic we also have gonna provide some kind of liquidity to to avoid depositing from ATM chain to metric chain and we we also working on multiple UX based no improvisations like Metatron Jackson's one click one click for etcetera vitiates we also working on regions where you don't have to worry about the deposit and I withdraw on the metric chain yeah and yeah that's it any integration I mean we don't have like any any p2p layer yet but you can use any kind of no firebase for now it will work so you basically signing your data so it won't be like a problem where you're someone else is using your order because you are signing so it is a trust less but yeah of course there are multiple p2p transfer communication layer like whisper is coming along so you can use that anything yeah yeah so basically it's the same as the ATM just an RPC you can just yeah it's a simple RPC and yes so we actually change a get little bit consistence part and how it interacts with our know kind of theorem chain because we need a data where you deposit your tokens in a theorem chain you need to make sure you deposited only coelom challenge after that you need to mint on the gate fault right you need to update the state on the yet not so we have to change a little bit on the gate side but mostly on the on the RPC side it's the same yeah so basically what we do is we wait for some confirmation like 12 confirmation before we depend on the on the side chain because otherwise is it's very difficult where you need to know let's say if you mean and you need to again born and then mint again it's very difficult so yeah so basically we have let's say we have like hundred milliliters on the variator layer after after sometimes we use 10 demeaned algorithm right Enderman a simple consistence where there is just choose proposer or leader after after a certain number of time so what we do is like let's say if a person a has a is a leader in this round to create for the proposing checkpoint after next after proposing one chain point it will upgrade the next select the next proposal for the checkpoint yeah and everyone just agrees ok hey you are the leader you can do the checkpoint yeah yeah so basically it's a simple decentralized storage systems on ipfs which this is a simple decentralized storage systems where you can actually use no simple payment depending upon your storage or you want to store something on the kind of orders will say if you want to store orders on the on the storage you can do that and you can use mattock for this well and for the contracts let me show you the route chain so basically route chain is a contract simple on the deployed on the ECM chain which which has a kind of knows everything you need deposit manager so it just deposit you just call this deposit so basically you are transfer your tokens to this contract and the validator will check okay hey are you deposited and it just means on the side chain yeah for now yes yeah a big so basically we had option where we thought about like why not create DAP specifics I chain but really we realized that it's very difficult where to own board users for your new DAP right and now let's say if you left five taps and one gets bigger you people can go ahead and try the second app on the same chain without any problems and without Hewitt's problems and it good for network effect plus we have like composability on the same chain when we interact with multiple kind of contracts it is pretty cool interesting yeah so we're starting with this one and then we will let us see in the future we have like multiple chain but we have like same dabs on the multiple that multiple chains yeah yeah so it's a simple it's the same as the currently the same as the etherium where is a guess yeah that's it so basically we don't fix any gas prices on the only sidechain the thing is that we at the check point basically allow 65,000 transaction in one block so if you let's say he'll like huge number of projects in England block your your price will sink significantly decrease in in debt sense right because later have good amount of appease in one block so so it absolute of alligators how much they will accept its September of time so it will be like very well less than cerium but I am yeah kind of yeah so basically currently yes answer is yes but the thing is that you can actually improve by creating a liquidity pool on the metric side where you just do this and get liquidity directly on matter yeah so we are working with wire to onboard directly on mattock to for just say if you USD and if you want like some rep BTC or the eat on the automatic chain you can directly go on wire okay thank

Automatic transcript — names and jargon may be misspelled.