Trustless Confidential Bridging With Secret Network | Alexander Hertlein - Secret Network
Ethereum Denver·Wed, Oct 9, 2024, 12:00 AM
Snakepath is a cross-chain trustless bridging solution that uses Secret Network smart contracts to build any dApp that requires confidential computation on the EVM. Encrypting payloads has never been easier or more accessible. APPLICATIONS FOR ETHDenver 2024: #YearOfTheSpork ARE OPEN APPLY NOW https://ethdenver.com/apply
Transcript
[Music] all right what is up eth Denver 2024 how's everybody feeling today incredible wow we did not expect this amazing turnout hundreds of people in the audience my name is Sean Conrad I do devil for secret Network and I'm Alex I'm also doing def at the secet Network Foundation welcome welcome everyone and we're very excited to be presenting today our talk on trustless confidential bridging with secret Network so what is secret network if you've never heard of secret Network before we're the premier layer one privacy chain of the cosmos um we've been around since the beginning of the cosmos and we now have an evm developer toolkit where our tools can be used on the evm seamlessly and we're extremely excited to be presenting that technology for anyone who's here today you're going to be able to learn how to drop our code into your code with proxy contracts with a single contract address so now let you know about secq Network the question is how do we bring in the Privacy Tech from secq Network and confidentiality Tech into the evm space and into out into other chains the way we do it is something that we call snake path snake path is a cross chain trustless bridging solution that leverages networks privacy preserving contracts the idea behind it is we can use this to basically build any dab that requires confidential computation on the evm hold on not done yet we're not we're definitely not done yet with snake puff it allows you to do a broad range of things it was originally developed by community members and it was such an amazing solution that it's now being used to do a whole bunch of things in secret to bridge uh privacy preserving computations into the evm idea behind it is we will have encrypted and we have encrypted payloads and call data basically that we can Bridge into evm so for you this is the most easy way to use encrypted payloads and call data and to leverage this to build your privacy preserving da or just to leverage confidentiality as you want yes there's two main things you can do with snake path which is as Alex just stated any encrypted payload you can imagine so you can kind of just think of secret as like a side chain where you can have composable privacy on the evm or two we've developed something called secret vrf where you can have onchain verifiable Randomness that is faster and cheaper than chain link vrf and we're super excited to do a demo today to show you exactly that and if anyone here is in the link Army please come for us afterwards because we want we want the heat we're bring in the spice exactly um what we what we wanted to do is to essentially have something that's super easy to use for you chain link VF has a lot of complicated stuff for secret VF you want to have something that's super easy to use for you we are deployed on a lot of test nets for example on ifra sepolia polygon Mumbai optimism sepolia a bunch of test Nets we also deployed on a lot of main Nets etherum mainnet arbitrum optimism linear base you can name it if you have chains that you want to have support for and it's not supported yet um you can check out the docs to see if your chain is supported yet if not please come to us we're really happy to extend our support for these chains as well the thing that you need to take a look at is basically one thing is just the gateway address that's all basically that you need the gateway address is all that you need to call to leverage the full privacy preserving features of seek Network snake puff will do the rest for you and we have extensive tutorials for you to make the most out of this yeah so if anyone here is like worked with Axel GMP before you might be familiar with pointing to Gateway contracts same exact idea we have these Gateway contracts that abstract away all the complexities of working with snake path all you need to do is point your smart contract to these addresses and you'll have access to comput uh to these private computations as well as Secret vrf so now the only question now is since we want to make vrf very simple for you using snake puff nice question is since snake puff uses a lot of a broad bunch of cryptography to pull this to pull this feet off actually what we wanted to do and secet network is The Following we want to make everything complicated just go away abstract it away from you so that you as a de can only you know concentrate and focus on something that you just drop into your contract less than 10 lines you drop in secret in less than 10 lines into your code and we abstracted everything else complic that's complicated away from you so this is what we're going to claim we're claiming essentially that we have secret VF unless when basically just 10 lines of code for you nothing else that you need to do drop in the code and it will all work of course if we support you on your net on your on your um chain if not please come to us afterwards shoot us an email shoot us whatever or um come to us when you see us yes so now for this Sean we're going to do a brief demo where what we do we're just going to show how easy this is to actually work with so if you've ever worked with chain link vrf before you might have gone through their docs they have a contract that's like you can it's already open in remix we've already uploaded their contract we're going through chain links exact Docs to request Randomness they you receive two random numbers and they're going to do the exact same thing with secret stocks and show what it's like to receive two random numbers and show that you can do it for a fraction of the cost and speed of chain link vrf and what we're so excited about this is like you know secret is a cosmos chain and one of the big Promises of the cosmos is interoperable programmability with these blockchains right but it right now we're at state where we haven't seen a lot of interoperability everyone's kind of their own chain everyone's kind of siloed we found away with snake path to bring this not only to IBC to other chains on the cosmos but also to ethereum in a way that's extremely accessible and also familiar for evm devs you've worked with something like chain link before so you can do this for encrypted payloads but you can also do this for vrf which is what we're going to show right now with our onchain verifiable random number generator so what we have is we have two instances of remix open one is chain link vrfs code from their docs that requests two random numbers can you uh yes make it a little bigger whatever the people want if there's any requests from the audience please shout them you can read it it's perfect now it should be readable all right perfect so we have two instances of remix one is for chain link VFS their docs and then we also have one for in Secrets docs and both our resources are uh at the end of these slides you can pull this up and you can go right to these this documentation if you want to do this on your own and experience how simple this is um so we just pulled this straight from train link docs we took their contract we uh compiled and uploaded it to seoa testnet and now we're going to do that with with secret vrf as well so first let's just request Randomness with the chain link contract let's confirm and let's see how fast this and then while we wait for that what we can do is go into the secret contract do you want to explain this code really quickly Alex absolutely so the important things that you need to look at here is the following you can go up yep exactly so at first as we as we claimed we're claiming to get secret VF in just 10 lines of code for you first what we need to do is just Define an interface in this case we're defining interface for you to request Randomness so that's the interface that you basically Implement and that's what you're going to call on the Gateway contract you're requesting Randomness that's it basically three lines that's it then we're going into our sample contract now the next line comes in which is just you defining the gateway address in this case we use a storage variable then on the next stage we go a bit lower here down here to set the gateway address in that case what we do is we just you know you basically do it as a contract owner you set the gateway address to be um that's pointing towards the vrf Gateway I can show that right now too so yes of course you go to secret stocks we have all these Gateway addresses for both testet and mainnet and as Alex stated if you have a chain that you want to work with to request secret Randomness and you don't see it listed here just DM us and we will get it up and running so you can have it for your chain on the evm um we're doing this for sapoia though just to match and mirror what chain link stocks do so we're going to all you have to do to work with this on sapoia with secret vrf is copy the Gateway contract address go back into our instance of remix and then just set the gateway address for our contract so I'm just setting the Gateway calling this function and confirming the transaction and then from there we are able to request Randomness let's just make sure that our chain link transaction went through already okay great so we're going to look at this chain link Randomness request in one second here we're going to look at this event but first let's just request Randomness with secret vrf so if we go back into our remix instance let me make sure the Gateway transaction went through okay great so we have this transaction showing that our Gateway was set successfully for sapoia test net and now we can just request randomness of course you need of course you need to make sure to pay enough gas uh yes for for the call back um that's what you you just basically send in a little bit of extra gas to pay for the gas on the way back that's what we Define with the call gas limit that's everything of this is explained in the docs thoroughly so you can make sure to not miss this all right so we just requested Randomness let's see if it's gone through with metamask it's pending let's see right and now at this point the amazing thing about this is this is works as quickly as the chain on which it's deployed so we're just waiting for this to go through with sapoia but whatever the block time in in this case we actually didn't pay enough gas make sure to pay enough gas guys the contract doesn't like it if you don't okay so now we're being a bit more generous by the way the exact formula on how to calculate the gas fee that you need to pay for the way back is also mentioned in the docs with an extensive tutorial on basically on how to automatically calculate it it's going to speed this up nope it went through all right perfect so so now while we're waiting on this we I can actually explain the other part of the code the last bit that we just did for the can we just switch to the screen again yes so now basically what we just did is execute the last part which was um actually requesting this Randomness test and as as you can see this basically are the last lines that we need to do which is first just Define our VF contract next we are requesting our Randomness we're just basically calling of contract make sure to also give over the value so the contract actually gets to have its call back gas and lastly we just Define how many words we're going to have how many random numbers you're going to request and how much the Callback gas limit is and next we just for this test we just emitting a request a lock exactly that's all right one second here oops are these the same instances give me one second see the transaction was so fast we even lost track of how fast it was to make sure I have the correct contract address up here we go it yet yeah yeah let me get the one as well all right our core Dev is checking on the relayer to make sure this went through so one of the amazing things about secret vrf with chain link or with uh with snake path is that the relayer is trustless everything that's trusted that's happening it's all just happening with the smart contracts so you can design a relayer to actually put the transaction through you could do it manually we just have one relayer spun up right now for this uh for this demo but basically the only way this could fail is if the relayer itself fails to pick up the transaction but the smart contracts themselves are trusted and verified so that means that essentially you don't need to trust the relayer in the future we'll have multiple relay relaying this so as this demo basically just runs on one relayer and we're improving relay performance every time we want make sure basically that in the future we will have multiple relay relaying this but you don't need to trust the Rel layers that means you only trust the Gateway contract that lives on secet network that's the most important thing that you need to know give us one second does anyone have any questions on what you've seen so far while we spin up this relayer uh yes it goes as fast as the latency of the blockchain on which it's deployed so like what we've been seeing on seoa testnet is about it takes about two blocks for the randomness to be returned TR again okay so for example if we look at the um chain link Randomness request we can see that it took about five blocks from the initial request for Randomness to when it was returned we see it was block 74 it was returned block 79 and then we can go in here see the transaction fee and the gas price and then if we go into secret vrf we have this request for Randomness going through yes let's see all right we're just going to try this one more time see if it's a relay error I'm just going to compile and deploy a fresh instance of the contract as you can see and as that was one of the most important things for us is essentially this stuff is so fresh out of the printer press for you that we specifically wanted this to show you at e Denver so you can try it out in the hackathon that was one of the most important things T So as you can see you're basically right at the Forefront of what's going on and what we're doing and that's why we wanted to get this into the hands of you as fast as we can all right deploying an instance of the contract and then we're setting the Gateway once more all right so that Gateway was confirmed and now let try requesting randomness let me see if it pops up on the relayer all right we got the relayer open Live crost you connected to the Wi-Fi yeah all right just going to make sure we pay enough gas didn't pay enough it was it was it double function yes and how much here all right we going to try this one more time but as you can see this is this is the most important thing actually you need to actually also pay enough gas for the Callback and you need to Define this one but this is all mentioned in the dogs for you so we're basically showing you on what not to do right now and for the demos um we're actually really happy to just help you out because this is so extremely easy to do and we got more infos for you for the evm toolkit docks for the demo that we have here and a QR code if you want to do four more for the docs all right thank you so much we've been secret network uh stay tuned for our evm toolkit to learn more how to use this it's still just being like worked on right now as you speak but it's it's really incredible and we've seen how it's faster and cheaper than chain link vrf and other vrf Solutions on chain currently thank you so much
Automatic transcript — names and jargon may be misspelled.