DappCon 2023: Improving DeFi Security With zkOracles And Zero Knowledge Proofs - Marlene Ronstedt
DappCon 2023 · September 2023 · 20:56
A talk from Marlene Ronstedt at DappCon 2023 on improving DeFi security with zkOracles and zero-knowledge proofs. A zkOracle is an oracle, a service that feeds external data such as prices to a smart contract, that uses zero-knowledge proofs to attach a cryptographic guarantee that the data it delivers is correct.
Speakers
Topics
From DappCon 2023, hosted by Dappcon Berlin.
Transcript
okay one second we just need to get my slides ready there they are awesome cool [Music] um okay just pressing on this one yeah okay cool yes it works okay awesome thank you so much hi everyone thank you for coming here today this morning um yeah my name is Malena I'm leading Communications at hypo Oracle we are a z K Oracle protocol and today I would like to talk about the differences between staking based oracles and ZK oracles and how a ZK Oracle can improve di security um due to some specific properties I would like to
talk about today um and then later on in the presentation I'm also going to show you a quick video demo of like a um um an interface with which you can build your own ZK D apps and then I would also like to talk about some use case es that are already being built today on hyper Oracle so let's get started first of all what is hyper Oracle we're a fairly new project so some of us uh some of you might have not heard of us quite yet so we are empowering smart contracts with arbitrary compute and internet data um we are a ZK Oracle protocol that unlocks different kind of Oracle use cases so we're not only doing the kind of standard chain link use case um of
internet data but we're also doing arbitrary computation so that means um heavy computation that means statistical analysis or that means even AI inference so all the things you cannot do right now in solidity because you're too limited by smart contracts you can do that with us in our ZK VM um and for that we're kind of similar to how ZK rollup is working we're leveraging ethereum security um so we're similar to an L2 in that sense but we don't have a ZK evm but but a ZK wasm VM um yeah and like this we want to extend the programmability of smart contracts and very soon we're also going to unlock um historical data use cases so we're also
going to kind of offer different kinds of data for um the ZK Oracle notes that you can then query through them so um as you probably all know um oracles have really had a problem in the past and I might even dare to say that oracles are broken um if you look at the history of oracles uh we have really faced a lot of hacks maybe some of you might have even been affected personally by some of these hacks and um the reason for that is very often that a lot of oracles are staking based so the problem with staking based oracles is that in some cases um the stake that you have to put down in order to safeguard your Oracle
it's not high enough um if you compare that against the kind of money you could be making if you're hacking an oracle or if you're manipulating a price um so therefore the incentive has always been there to manipulate oracles and um oracles have tried in the past to mitigate against that so for instance there are even some oracles where you have to sign a legal disclaimer to run an oracle node however that's not really the kind of permissionless defy that we are intending to build right so we don't want to have a network where you have to sign legal disclaimers to be able to participate um the same also goes for like challenging the kind of data that the Oracle brings to you so in some
cases if you want to challenge the data that you have received you have to also put down like quite a significant amount of money or tokens um in some cases for some oracles so once again that's not really ideal and then also these challenging periods they take quite a long time so instead of that we want to really try a totally different approach where we're instead of like creating our own network with our own security that is secured through staking we are just leveraging ethereum as our base layer by um using zero knowledge proofs of ethereum and therefore we can kind of extend that security to our own Oracle Network um and I think like another
thing I want to mention in regard to that is that also these existing Oracle networks are not really that decentralized either because in some cases um there's this um Nakamoto index that was introduced by BAGI and basically the idea of the Nakamoto index is that you have a certain number of nodes you would need in order to manipulate a network and in the case of like some of these staking based Oracle networks the Nakamoto index is very low it's like as low as three nodes you would need in order to start manipulating the data of these oracles so um what we want instead is a decentralized Oracle right um that is fully trustless and permissionless and that's what we're trying to build at
hypo Oracle um so if we now compare these different workflows of how staking based Oracle Works in comparison to a ZK Oracle then we can see that there are a couple of Choke points in the case of chain link where we have to where trusted third parties are coming in either they're based on reputation or they're based on tokenomics and then eventually um they bring that data on chain where it's being aggregated in smart contracts whereas in the case of hyper hyper Oracle we have a fully trustless Network um that is just based on cryptography so you don't have to trust anyone in that Network because it's always just going to create a proof
for you you can validate that proof in the um verifier smart contract and then you can instantly see whether the data you've received is correct or not um so I think that's basically the biggest difference that you can take um take home today as a takeaway from the differences between the staking based and the ZK based Oracle um yeah and I think also in addition to that I think what's important to notice here is that um so far in the uh staking based oracles if you want to do any kind of computation or run any kind of automations you're really just found what you can do in a smart contract and in solidity today whereas like with the hypo Oracle node you can really do a lot
more things like I mentioned before you can do AI interference for instance or you can do statistical analysis so you have a lot more opportunities in that case um and here's like a little comparison if we look at the differences between like um the costs of the security but also the finality of the two different kind of networks so um for instance um the finality for the data in a staking slashing based Oracle would be one to two minutes whereas like in our Oracle notes the finality is um just below 12 seconds so that's as long as the ethereum block time so you can actually build like a lot more exciting applications with that because they're kind of well it's not real time but it's real time in the sense of
ethereum and um also when it comes to verifying the data that's a lot more cheaper as well we're just looking at around like $50 in a ZK Oracle node and then also because we're creating ZK proof of the data we can give you 100% guarantee that that data is actually correct um so for that I would like to take a closer look now at like the Oracle Network that we are building so we are soon going to open up a test Network where people can also start running their own Oracle nodes in our Network and these nodes are um performing what we're calling proof of Oracle work so in essence what happens in that network is
that you um kind of um put down a bounty contract in which you outline in what we call a ZK graph the specific computation that you would like to be executed by an oracle node and then an oracle node comes in and picks up that job and it's like um trying to compete with other Oracle nodes to um deliver the result of that computation for you and that all happens as said in a ZK VM so that um eventually a proof is being created off that computation which then goes back on chain into the verifier contract and um then basically the result of that computation is being put into the ethereum me pool and um there we have
like a special little thing because then somebody could front front run you in theory because they could see that you have submitted the result of that computation but um actually the result also includes a proof of your wallet address so no matter who eventually submits the result of that computation if you were the first one to submit it into to the men poool then um because your wallet is inside that proof then the uh the reward for the computation is always going to go back into your wallet um so I think that's like a really cool way to make sure that the note Runners are always being rewarded accordingly and um yeah so I said I think um we're going to soon in the coming weeks start announcing how you can start
participating in the test net and then we're going to have a series of different test Nets and then probably next year we're looking at like launching our main net um and another thing I would like to talk about is ZK graph studio so basically ZK graph studio is a web IDE in which you can build your own zkd app and the best part about this is you do not have to have any clue about how ZK works you don't have to write your own circuits you don't have to learn like a specific domain specific language or anything like that you can just do all of that directly um using assembly script which is a variation of typescript um and we have a web IDE for that so it makes it very easy to start
building already now we are not on ethereum mainnet yet so we're just on spolia and on girly test net but you can already take a look at this today and start like experimenting and see how you could include this um going forward in your D apps and build what we call ZK D apps um so I would like to show you a quick demo I'm not sure if it's actually going to work because of the um internet connection we tried it out a little bit earlier but um I have a video where basically my colleague is walking us through um this IDE and shows us how we can create a proof um without having to know anything about how zks actually work under the hood so let's try and see if this is actually working we can see
the Cod picture at the top there are two files mapping. TS and library. TS mapping. TS is the core logic of CK graph it defines the offchain comp utation that will be used to round and generate proofs in ZK aome so let's addit to this file click start button after completing all the code you can see our compiled web assembly code in the editor go ahead and click the setup button in the botton right corner and after a while you will see the created ZK wasm image ID in the step we deploy the wson file we just generated to the hyper orle node for execution and proof generation
then we click execute to generate the output state for our ZK graph this step will execute and generate Z graph outpos state in the contest of the provided transaction now we have everything ready for ZK proof generation for the ZK graph run click generate send it in wallet start ZK proof generation and after a while we can see the proof details finally be generated and confirmed for illustration purposes the waiting for the ZK proof generation is skipped in this video now we have our ZK proof generated and we can view the details of this proof in the final stage we will do the verification of our ZK proof after selecting the target Network for
deployment click deploy to deploy the verified contract on the blockchain and then click verify to send our ZK proof to the contract and the ZK proof is verified as valid yeah um so as you can see you don't have to understand pretty much anything about how to create your own um proofs and it's running again um so it's very straightforward and I would like to invite you to if you're like a builder or if you're working on a protocol um to take a look at it and see if there is like a specific use case for you because we're really unlocking a lot of new use cases that so far have really not been
able before so if we look at the sort of history of defa um it's a short history but I think we've seen like quite a lot of very exciting developments over the last years right so if we look at like defi 1.0 so to say then um that was basically just when you were able to create your own erc20 tokens and then we would trade them on Dex uh centralized exchanges and we would maybe use them for like icos right but that was pretty much the only use case for def5 back in the days and then amm came around with def defi 2.0 where we suddenly have like decentralized exchanges and we can provide liquidity in a decentralized way and we can of course still also issue
erc20 tokens and all kinds of other tokens by now and um now we would like to kind of Usher in like a new wave of D5 3.0 where we have a lot more different possibilities um because of CK and um some of these possibilities could be for instance like derivatives or it could be um ETFs that are both fully onchain and fully permissionless and fully trustless so that's something that hasn't really been possible so far right because if you want to do a derivative you'd have to check at every new block if the derivative would actually trigger the conditions um under which the clearance would occur but that is no
longer the case you do not have to program it in such a very gas inefficient way so what you can do now is you can program a derivative um through a ZK graph and run that Automation in hyper Oracle offchain in our nodes and then um trigger with that eventually the conditions to then make the clearance for the derivative happen so that makes it a lot easier to like unlock a lot more exciting use cases that are um yeah that have just not been possible before the same goes for like a decentralized ETF so there is a team that is building a decentralized ETF with Hyper Oracle and um basically they want to create the equivalent of the S&P
500 but like fully on chain so they're taking the top 50 tokens because I think taking the top 500 erc20 tokens would probably not be a good idea at this point um but they're taking the top 50 erc20 tokens um and they basically have a ZK automation running which um rebalances these tokens every 1,000 blocks and um then you can just like buy into that ETF and hold it and the cool thing is that this smart contract that is holding these tokens doesn't have an owner at the main so it's also once again um fully trustless nobody can like change that smart contract or temper with it and um that is probably going to be the first decentralized ETF that we
are going to see um what else yeah oh another really cool use case that is being built with Hyper Oracle is called zerx hack and um basically it's a wh hat hack tool so um what happens occasionally is that like Hecker finds a vulnerability and then they go to a protocol and they're like hey I found a vulnerability could I get some money and then I will tell you what this vulnerability is right and then often what unfortunately happens is that the hacker is actually not being reimbursed accordingly so what zerox hack is doing is that they're running an evm logic inside a hyper oricle ZK VM and inside that evm logic they can basic physically
create a proof that they do know that a vulnerability has um that they have found a vulnerability and that they've also found a way to exploit that vulnerability so they create a proof of that and then in that evm logic they're also simulating how they would do the exploit and how they would drain certain funds from like a wallet for instance and um they create a proof of that they can show the proof to the protocol and be like hey you guys better give me some money otherwise I'm going to execute that actually like on ethereum for real so that's a really interesting negotiation tool that these guys are building right now it's a team out of Hong Kong and I think uh they soon going to announce some kind of a hackathon where you can start getting involved and start experimenting with that and yeah
and I think in general what is really cool about all these use cases is you can already build them today um some other use cases that are being developed are fully on chain uh 100% collateralized stable coins or also aigc nfts so basically that's a kind of nft where a proof is being created that an nft has been AI generated so um that could be very interesting I think going forward with like a lot more AI generated images um coming out into the wild and we we can't really decipher anymore what is real and what is not real so I think that's going to be really interesting nft standard that also once again uses hyper oricle CK
nodes um we also soon um announcing um some actually opml use cases so that's slightly different so stay tuned for that we're going to soon um put out like a very long blog post on that that describes some new ml use cases and um yeah I think that's probably it from me um thank you everyone for coming here if you are interested in building with us then the clicker is not working then I invite you to okay this is also not working anymore anyways um then I invite you to um follow us on Twitter uh go to our website hyperoral doio try out our ZK graph Studio application there if you
want to build any zkd apps um yeah join our Discord and come and find me afterwards if you have any questions or I think we still have 1 minute 30 seconds so if you have any questions right now then feel free to ask me now thank you everyone thank you uh we do actually have more than this one minute this was just a talking time so it's plenty of time for questions uh in case anyone um um has any not maybe one question from my end I mean you shared a couple of use cases right and you mentioned Also earlier um that that um hyp arle enable some use cases which are harder to do uh maybe
impossible with classic staking based oracles uh which is like one of the use cases which you personally most excited about which is maybe less known um you know besides the ones you mentioned um so I think I mentioned already quite a bunch of the use cases I guess what I didn't really speak that much about in detail is um the zkl use cases that we're also unlocking so for ML inference so that's not training an machine learning model because that would be like ridiculous that would take up like a lot of space and it wouldn't be possible but we can do ml inference which is basically like the execution of a machine learning model and we can then generate proofs of that and we can prove that like a certain execution has
happened so I think um that could be really interesting and that could be also an interesting way to like once again combine like dii and ml so you could have or you could just it wouldn't even have to be ml maybe that's even too fancy but you could just have a statistical model that determines like hey if this happens and um we have multiple data um sources coming in we can like do some statistical analysis on that and based on that we then want the smart contract to trigger certain conditions and do certain things so that's definitely something that you can now build with Hyper Oracle and that wasn't really possible before at least not in a fully trustless way so yeah cool right thank you any more questions from the
audience then thanks again my right thank you