A New DeFi Primitive - Private DCA Trading with Aztec Connect
Devcon·Mon, Oct 9, 2023, 12:00 AM
Visit the https://archive.devcon.org/ to gain access to the entire library of Devcon talks with the ease of filtering, playlists, personalized suggestions, decentralized access on IPFS and more. https://archive.devcon.org/archive/watch/6/a-new-defi-primitive-private-trading-with-aztec-connect/index Trading on decentralised exchanges is missing a key primitive, **privacy**. In traditional markets, an OTC desk enables large orders to trade without moving the price on chain this is missing and everyone can see everything. ZKP's deployed in production allow us to implement private trading on Ethereum. This talk looks into: 1. How to uses ZKP's to give privacy on Ethereum 2. How to build a private dollar cost averaging smart contract using Aztec Connect 3. A code walkthrough and a demo Speaker(s): Joe Andrews, Jan Beneš Skill level: Intermediate Track: ZKPs: Privacy, Identity, Infrastructure, & More Keywords: ZKPs Follow us: https://twitter.com/efdevcon, https://twitter.com/ethereum Learn more about devcon: https://www.devcon.org/ Learn more about ethereum: https://ethereum.org/ Devcon is the Ethereum conference for developers, researchers, thinkers, and makers. Devcon 6 was held in Bogotá, Colombia on Oct 11 - 14, 2022. Devcon is organized and presented by the Ethereum Foundation, with the support of our sponsors. To find out more, please visit https://ethereum.foundation/
Transcript
foreign [Music] and this tokos original is supposed to be held by our CEO but he decided to escape through this burden is up to me and I will talk how D5 is missing a key primitive which is privacy and how Aztec connect fixes it fixes it so many of you probably remember that last year there was this GameStop Saga and basically what has happened is that this information about The Big Short position of one hedge fund leaked and then since internet is kind of random like people decided that it would be fun to just ape into the stock and pump the price and the fund got liquidated and this was caused by the fact that like the information leaked and so the situation in web 3 is even worse like basically anyone who is able to use a web browser and can go to Ether scan and search like what anyone is doing and this is made even worse by people's views of ens so we can see quite commonly that people use their ens names with trading because they apparently have no idea that is not private and to drive this point home like basically there is this ensname docs.if and if I want to spend some time on it I can just like basically figure out that the user has units web position I have a position and how amount of USD available for collateral and you might be asking why this is bad because like plenty of the times it's considered the transparency is like a nice feature but when we are talking about financial information it can be bad because like it allows basically anyone to assess solvency of any entity on ethereum and this information can be used by adversarial parties like Mev Bots and then there is also of course a risk of doxing and consequences in the physical world this can be as innocent as your friends shaming you for your bad trades but it can also make you a target of crime so the solution at Aztec we think that the solution are privacy preserving roll-ups and our privacy preserving group is called Aztec connect it is live on mainnet and we like to call it VPN for ethereum and I think this is quite a nice mental model because essentially what VPN is doing in the webto world is that it replaces your IP address with the IP address of the VPN provider and essentially what we do is that we replace your ethereum address with if ethereum address of Aztec so I wanted to show some demo but of course it's not very possible here so I will just show some screenshot so this is our website ZK money and when you come there you can click Shield and then you can choose an alias this is like an analogy to ens name on ethereum mainnet then we will create your account this will take a while because there are some complex computation happening behind the scene and then you deposit the amounts of funds and behind the scene that actually happened quite a few things that happened two transactions on ethereum one deposits the funds into a royal processor contract another approved this approves this hash and then there is like a generation of cryptographic note on L2 and this cryptographic node allows you to spend those funds so once you deposit this is what it looks like it's like a normal wallet and then there are opportunities so you can deposit into an arbitrary Bridge we've implemented so for example if I deposit to Euler I have this screen and there are quite a few interesting things here which I want to explain first one is a batch so there is quite an interesting feature to us the connect and that is that we allow for this thing called patching and basically what it means is that when there are multiple users which want to do the same interaction on ethereum L1 we basically do only one interaction on L1 and on the inputs of the interaction is like a sum of those token amounts so basically when there are like 10 users which want to deposit each to Lido and let's say for Simplicity each user has one if we only call the stake function on Lido contract once with the 10 ether and then later on WE distribute the results to the users and in this case like the results would be the output tokens which is staked yeah I would like to briefly pick what is behind the scenes and we use utxo model it was talked about by quite a lot in the Aztec 3 presentation before but basically what is a utxo model is that you can imagine when you have banknotes and you want to go to a merchant and you want to pay with the banknote so what happens is that you can like split this banknote but you give the merchant the banknote and he gives you the money back and this is essentially what we do as well and we do it with this thing join split circuit and essentially what this allows is that you have two possible nodes on the input which get destroyed in the process and then there are two nodes on the output and for example in the example of of the bridge interact of the D5 deposit to Lido uh on the input would be for example 0.5 if and in case the original value held in your account was one note with one if this node would get destroyed and on the output would be this claim node and another volume node that value node would hold the remaining heat balance so it would be 0.5 if and that claim node would allow you to later on claim the funds resulting returned from the defy interaction yeah so you might be asking how is this possible that like this is private when the settlement like the interaction actually happens on ethereum and this is a good point and uh here in the left bottom corner we can see what it looks like like what token transfers there are and this looks pretty not private but the thing is that thanks to zero knowledge proofs nobody can distinguish like who is actually originated this interaction and also there is this aspect that there can be multiple users per interaction and so these balances get even more obfuscated and currently there are more than 50 000 unique users last time I checked it was like 51 000 something and it means that like the amount of people you get height with is spiritual Arch you might be wondering does it scale roll up is quite a common password and it does scale and one reason why it scales is because there is that one L1 transaction per multiple users but of course everything is always more complicated and there are overhead costs to roll ups and this costs are cost of posting overall up and per transaction cost of call data luckily this cost of posting a roll up gets split between many users so when there are many users in develop this goes down and the cost of call data is fortunately going to down a lot with this ethereum Improvement proposal for 844 so hopefully like in a not so distant future the cost of interacting privately with D5 will actually get very close to the gas cost of that one L1 call divided by the number of users uh now you might be wondering like how do we integrate is there like some integration needed and unfortunately yes but it's not so complicated and we have this thing called Bridges but Bridges nowadays have quite a bad connotation and in our case the bridge is just a simple smart contract so there is no multi-stick risk and the smart contracts tend to be fairly simple so here on the left we see the ID vibration interface and there we basically just Define input and output tokens then we have total input value which is the sum of those two users input balances and aux data which is arbitrary data which can be used to pass to the bridge contract and on the bottom right corner we can see the implementation of the con of the function itself and in this case it's an implementation of an erc4626 bridge and we see that it is like a relative we basically just call deposit if deposit flow is executed or we call redeem in case withdrawal flow is executed now you might be asking if there are some limitations and there are quite a few I would say the biggest one are the longer settlement time and that is because when you you we have to wait for the batch to get submitted to to ethereum like luckily you can pay if you are really in a hurry so you can pay for the full roll-up block and in that case you could get the instant settlement time but most users don't want to do it because it's fairly expensive and this causes like some problems with slippage so for example you can imagine when you trade on uniswap you define a slippage parameter which basically protects you from Mev Bots exploiting you or in general it can protect you from Market movements and the longer settlement time can also cause issues with liquidations because you can imagine if we are close to being click related and you need like fast to exit the position or something in the that is problematic but always you can pay for the instant settlement then there is the limitation by the amount of data which can be on the input like most of the time this works quite fine because it's 64 bits of data and with like a bit of smart encoding we can actually put a lot of information there but it can be problematic when we for example want to pass in ethereum address because that is 160 bits then another limitation might be that the system doesn't work that well with esoteric tokens because those esoteric tokens might have insufficient anonymity sets and basically what that means is that there is unlike one esoteric token you user and he would deposit into Aztec and he would be the only one like working with the D5 protocols it would be pretty obvious that is that one user but in practice I think this is not that big of a deal because usually users want to use the high liquid tokens and I don't feel personally that is such a big limitation then another limitation might be that some Protocols are specifically designed to work with message sender so for example when when those protocols just work with tokens you can imagine that there's like token on the input and token on the output which is for example the case of Lido like this works perfectly because there is no limitation we just have tokens on the input and then we distribute the results but when the protocols work specifically with message sender which can for example can be when we are borrowing LUSD from liquite oh it's pretty complicated to do the implementation and how we've solved it is that we deploy these multiple Bridges and each of the bridge has fixed collateral issue and like if the bridge was like close to being liquidated user can't add more collateral but the user can always repay the depth and exit so even though there are limitations usually there is like some way how to work around them now I would like to talk about advantages and I think those advantages are pretty huge because Aztec connect doesn't need redeployment of smart contracts on L2 because we work directly with smart contracts on L1 and this means that for example liquidity is not fractured and I did my own personal experiment when it was blue market and I checked like how much it makes sense to do for example swept on L2 and it turned out that for not so large amounts like over five thousand dollars even with the high gas fees it still made sense to use ethereum L1 and that is because the liquidity was just so much higher so the slippage would be just so much slower that like the piece would be worth it and another Advantage is a lower risk for integrated protocols and that is since we don't need to the Target protocols don't need to like redeploy again on on our L2 uh there is no risk for them like for example the risk of fracturing liquidity then I would like to mention that there was of course 95 cases but the fire is like a nice password so we mentioned it here and I think very cool use case could be private doll voting and that is because in all the voting systems privacy is very important and another interesting use case might be nft mending yeah thank you for the attention [Applause] thank you John we still have questions time for questions so here to the right Nicole ah yeah I can I can put that I can let you know but I must put it allow ultimate light before the presentation yeah um just a quick question uh how expensive is here here sorry yeah you're looking for me how expensive is each operation because it seems like you are doing complicated cryptography and solidity uh so on on ethereum L1 it was like the same as I mentioned before like the color itself and then there is the cost of call data and processing the roll up uh so is does it answer the question like I I have to admit I'm not a cryptographer I'm just like a basic solidity engineer well as well so yeah um so it's not very expensive a second can this work on on alternative chains like uh like other in other l2s like having when it has taken okay so our contract is implemented in solidity so we can deploy it to any evm chain and like our L2 infrastructure just uses generic Json RPC so like there is no fundamental issue why that would not be possible but like an interesting note is that it might not make sense because usually those other l2s have also like have to post the call data on ethereum L1 so it means that if you for example were running over optimism we actually would not save much gas we have one there on the left side then there and then the third one uh thanks for the talk um you mentioned you have over 50 000 users um on Aztec Network um a couple questions like who has integrated besides Euler um like who's on the docket and like what are those 50 000 users using it for currently yeah so we have quite a few Integrations I think the most important are for example Lido Oiler than we have for yearn um we are working on unisfab click with the yeah we have a grants program where we basically give some developers money to build the Integrations and yeah that's it and where are the users are using it for currently mainly uh I think that like in general the farming worlds are quite popular so we have quite a few users of Ian and we've also built this thing called DCA Bridge which allows like users to DCA into eth or die and it's also becoming quite popular pci's dollar cost averaging for those two you don't know um I got the mic ready uh so uh one of my my question was around what you're doing to try to deal with this settlement like waiting times and stuff um and I was wondering if like as you integrate with other protocols if that's like a breaks Community or brings in composability challenges and kind of how you're thinking about solving that in the long run yeah so there are no composable it is challenges because it's running on ethereum L1 like the calls and like the best how we can deal with the settlement times is basically having enough users that it the that it makes that it's profitable to submit the roll-up blocks frequently but as we said if there is like some user with your origin plan needs it to be settled he can always like pay for those instant settlement much does it usually cost if it's just like one user or it depends I mean when it's badged like tour and play it costs like one dollar to deposit into Euler um thanks for the awesome talk um one example you gave at the end was like a private nft purchase does that mean the nft will be owned by the Aztec address yeah exactly it would be on by the Aztec address but there is this thing called we don't currently like support nfts directly in our UI but we have this thing called virtual assets which basically allows like a representation of any ownership so like on ethereum of course it would like stay within ether within the bridge it would stay within the bridge contract but yeah the user could then interact with it by using the virtual assets virtual assets basically what it does is that it like doesn't exist on ethereum L1 but we create this another value note on our L2 which contains the information which can then be passed to the bridge and worked with so yeah though it would stay within the contract on ethereum um my question is uh can you do scripting Logic on the L2 itself so like not on a bridge but within the L2 or I mean it's not accessible to like developers but it's possible to like build circuits but I mean it's not the goal of Aztec connect it will be the like we will have generalized smart contract once Aztec 3 is available which will be in a year or more so like things like multi-6 on the L2 itself that's not really possible yet attack actually there is an implementation of multisig it works with like those account cryptography so yeah we have multi-6 awesome thanks more questions and then here test us up so the the always a fun question about regulatory risk um obviously this has like a sounds like a mixing component similar tornado um what are your thoughts about that and uh that that that risk yeah so currently how we approach it is that we limit the deposit side size and basically like our goal is to avoid the use of hackers avoid users hackers using our platform and like the big issue with tornado cash was that like 70 percent of the money there was elicited so basically we are just trying to make it impractical for hackers to use our platform what's the limit I think currently it's like 10 each per deposit but we might increase it in the future okay thank you can you share a little bit more um I'm over here on the front right your 50 000 users can you give us a sense of like before Aztec what were they doing are they doing the same thing just totally in public or as a result of Aztec are they now doing things that they previously weren't doing oh I'm not so sure how to answer but I would say it were like General like defy users and they just wanted that privacy so they deposited to Aztec but I actually didn't do the analysis we have four minutes more if you have any questions you have John has been really Brave to substitute the CEO congrats big round of applause just prepare this thank you thank you
Automatic transcript — names and jargon may be misspelled.