Confidential EVM? ROFL! - ETHGlobal Bangkok 2024
ETHGlobal·Thu, Oct 9, 2025, 12:00 AM
Join us for a workshop with Harry Roberts from Oasis Protocol titled, "Confidential EVM? ROFL!" Oasis Sapphire is a production-ready confidential EVM chain. But there's more. The next-gen dApps can now run computationally expensive tasks offline, while being integrated with Sapphire, preserving trust and confidentiality. Here comes ROFL! ETHGlobal Bangkok 2024 was a 3-day hackathon that took place November 15 to 17, 2024, and brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ----------------- Follow us: https://x.com/ethglobal Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] hi everybody uh I'm Harry I work at Oasis and uh uh before we start I'd like to show of hands in the wonderful crowded audience we have um but yeah so so today I'm going to be covering uh the Oasis protocol what kind of projects can you build with it um so first there's an evm compatible chain with a confidential State and contract so that's Oasis Sapphire uh and then we also have a uh ruffle which is the offchain runtime uh compute with uh verifiable compute and internet access and uh again it also has confidential state so we have a evm ecosystem and an offchain ecosystem where you can run lots of compute pull data posted onchain that that kind of thing um so the QR code here goes to the cheat sheet please we have physical cheat sheets as well and know you can come visit our booth uh so for Sapphire the easiest way to get started is to go to the Explorer and request some tokens so we've been in production for the past uh two years but the test net is free to deploy in and test on uh on the test net Explorer there's a request test tokens button and you'll see the tokens appear in metamask or whichever ethereum compatible wallet you're using and uh we have a handful of different prizes here uh so um if you're thinking about what to build uh we we have several different tiers uh for Sapphire you do have to deploy contracts on on chain um but for rule um while you can communicate with sapphire and it has an authenticated verified link to PO transactions uh you don't necessarily have to deploy everything on sappire you can run offchain logic but it it is powered by our our infrastructure also to get help you get started we have a playground uh so that's lots and lots of ideas and projects from hackathons in the past where if you're a thinking about uh need some boiler plates or want to Fork something and uh see how they solved a problem uh this is a really really good place to start because there's there's lots of uh resources available so I think I I'll very quickly cover Sapphire so it's a confidential evm that enables a private smart contract execution it's ethereum compatible but the contracts have encrypted storage so the runtime state is encrypted which means the node operators can't see what's going on uh so if you mark a BRI a variable as private or internal in solidity only the contract will be able to access it as users can only run public methods and uh access public variables it also has a call data encryption so you have an endtoend encrypted uh Channel between the DAP that's in the user's browser and the smart contract so this gives you meev protection for free because no one can see the contents of the transaction uh of course we have six second block times and because we're using a delegated proof of stake architecture so we are an L1 um you get a finality as soon as the block is winded which can be really useful so behind the scenes we we're using Intel sgx which is the hardware based security for privacy and confidentiality so there's no proving time um and there's no complicated MPC and importantly because it's in a trusted execution environment you have instant onchain randomness of available inside Sapphire solidity contracts so on the cheat sheet we have a few different examples and one is a uh the sapphi Das contracts package on mpm which gives you solidity libraries to uh you know generate promiles but also generate key pairs verify signatures sign transactions do encryption and doing decryption uh if you have any questions about more specifically uh I can get into this afterwards um so the the test net which you may want to deploy contracts on here a QR code for the foret um so uh we also have a testet Explorer and here's the chain ID as well so you can add that into your metamask and um I think to to illustrate what we're doing with with sapphire is uh we have the the sapphire. soul library that can be imported and so we have the sappi do s Library which can be imported so you can generate a random number by calling sapphire. random byes uh and they're all pre-compiled so they're built in and they're they're very cheap to to execute versus implementing this all in solidity um one of the interesting things is if you can generate an ethereum transaction and sign it on chain using a key pair that's managed by a contract then uh you can get gasless transactions so the contract can sponsor your gas for you uh instead of needing the external infrastructure like er C4 uh 773 or is it 47 um and so so those of you who might have uh followed the account abstraction debates you know we're working to uh make it much more simple and straightforward and uh for us this is it already works on production we're using gasless sponsored transfers um so um I Al also thinking of uh one of the main differences with confidential evm is you have to authenticate your users so on the ethereum ecosystem everything's public every everybody can see everything but when you come to confidential evm you don't want people to be able to impersonate you so how do we verify the users's authenticity that they control a wallet and this starts to look a lot like the web 2 world where you would log in it gives you a cookie and the cookie proves who you are and you can then send this through to the uh to the the contract so in this example we using sign in with ethereum um which allows you to sign specifically for a domain name with metamask integration that will warn people if they're on the wrong site so it has like a anti- fishing built in and this is really easy to integrate with your smart contracts but it it shows you have to think a a little bit differently about how to solve some problems or take advantage of the confidential State and the runtime um what what we're working on now though um is we thought it would be really cool to use these trust execution environments uh to do things that you can't do on chain so instead of being limited to solidity smart contracts what if I want to retrieve data from the internet I want to pull information from oracles I want to submit RPC requests or interact across different chains and uh it's obviously much cheaper to perform the compute offchain and uh you know we can use the blockchain part Sapphire for uh runtime signaling communication some locking token transfers that kind of thing um so we combine the Two Worlds you have the performance of the offchain world uh and the trust of the onchain world and uh we're calling this this Ro so it's a runtime offchain logic and uh on our road map at the moment we're looking at well this is perfect for AI you know we want machine learning that's confidential so you can prove that your model was trained on a specific set or you can verify that um inference is running deterministically uh but it's not just uh High compute workloads you can operate across lots of different chains uh by accessing the the rpcs directly you can manage keys inside you can ask the contracts to manage keys for you and there's a lot that you can do um so for gaming um a lot of chains are trying to increase the block speed and we're saying we should actually move this logic if you want real time logic let's move this offchain uh so that you can have you know 30 millisecond 60 millisecond responses um so any anyone familiar with Oracle uh with dexes you do need an or behind the scenes uh to be able to fetch information from other chain such as price quotes uh and now you can run this inside rle uh and you can trust it because uh it runs inside the trusted Enclave so you get uh verifiability and to a certain extent you also get uh uh privacy and censorship resistance uh and that's all because it's running inside the trusted Enclave so um each Oasis node can run rule apps inside the trust execution environment and and they all have a a light client and they're verifying the attestations of the network and of the consensus level so uh the ruffle app will uh communicate with sapphire so uh any storage such as you know storing the private key the the rule apps don't have storage of themselves so you would want to store that and manage it in the smart contract and uh you can also open a https connection uh which is something you can't do inside a smart contract and that means you can connect to Amazon or Ebay um indirectly via solidity uh or you can prove that you connected to Amazon and prove that to uh solidity uh but that's because the offchain logic is non deterministic whereas the onchain logic is deterministic um so with here you've got the example where we're opening a https connection uh we can do whatever programming we want we can process the data use Jon seore XML extract whatever you want summarize it and then maybe you can uh store it again on chain just the summary or you can fetch some extra information from onchain in order to process it so we made a a small example of this uh this is how you build an oracle using rle that will fetch the price information from binance and every block it will submit a transaction which stores this data on chain so this is the solidity part uh you know uh when say if you want to authenticate the the ruffle component um each rule app has its own app ID like it's in the App Store so that means uh you can put the app ID of the offchain component into the smart contract but you can also update the offchain components so you can publish updated versions which means you don't have to worry about upgrading the smart contracts to point to the new new offchain component um so what we do here is we we've got it builtin as well to uh verify the identity of the offchain component and uh uh then enforce authentication so that only the offchain component can submit new uh new information and of course uh the the submit uh observation submission is in the the main function uh it basically just pushes the the observations and price quotes uh which um yeah you could also include things like a Time stamp if you wanted uh so uh it's all written in Rust unfortunately so if you want to build off chain components uh this is the rust side of things uh which fetures the price quotes um I because uh you know ethereum doesn't know anything about the floating Point operation we're multiplying it by a million to convert it to an integer uh so you have to be wary of encoding it for solidity for the the in theum environment um and we saw this price by submitting a transaction to invoke the uh submit observation method in the smart contract we also set the gas fee and then sign and submit transaction um which is using the built-in CER with rafle so that's uh the account that was running the rfle that ends up paying for the gas although you can submit transactions and pay gas from other accounts if you want uh and behind the scenes we got a light client that's broadcasting it to the network and here's the boiler plate so if you're going to deploy your rle app you will want to uh anchor it to some some chain um verify that it's started and then we have the hook here which is uh on every single block We Run The Oracle and uh error out if uh that fails so if you're running rawful and you want to test your components we have the the full St back running inside a a Docker image um we have the the local net which is the same as test net and Main net where if you want to use pre-compiled to do any of the cryptography stuff or Randomness uh you can test this locally and it has a instant mine or you can use the test net which has uh 6C block time so unit tests will run quicker locally if you want to do that but it doesn't mean that if you just start up hard hat you won't be able to use uh the vrf for example um so here we have the the RPC Gateway on 8545 and we have the the local net Explorer on uh 8548 and yeah it works the same as test net and Main net so uh for local net you can add this into your menam mask so again Local Host 8545 we have a uh the chain ID there and you can change the pneumonic or use any pneumonic you want and uh you will be provided with local net tokens if you use the uh standard test test test junk uh neonic oops um so secondly uh yeah uh for the hackathon here I I'd like to point out some resources you have the The docs. Oasis iio which is like the the Holy Bible for everything uh we have the daps Sapphire sub page for everything related to Sapphire and building Taps uh there's the rafle sub page for everything related to rafle so how to build a full tutorial uh and if you're building a cross chain app we have information about bridges on the d/ opl page so opl is the Oasis privacy layer where we have uh two different Bridges one is router protocol and one is seller IM um and finally here's the cheat sheet uh so we do have physical paper copies of those at the booth or you can see the the blue sheets of paper and you can scan the QR code uh so it's you know what a cheat sheet is it's 8 for crammed with QR codes and uh useful information so we got the wallet the Explorer the foret and uh you know how to run the docket container some code examples all the package names it's really really useful and you've got a cheat sheet there um so I think at this point if if anybody has any open questions and feel free to ask uh if not we can talk afterwards I can uh bounce some ideas around that kind of thing um so thanks everybody um so I'm not sure if I understood the connection between rafle and the sapphire uh main net like the is the idea that the contract on mainnet will verify that only the uh contract on the te can call it like there's a sixc block time you know the in the te uh in a Rawls running instantly so how does that work okay so um uh in terms of uh like how does the sapphire main net verify by the uh rule components so we we have a verification of attestation built into uh uh the ois ecosystem uh so that means that uh uh instead of having to verify the the ruffle component on every time every call um we have that behind the scenes and then we have like a a different type of address uh that shows that this has come from a specific rawle app ID um then that means that uh uh as long as you put the app ID into the contract um then as the when you're publishing your your rfle application uh you can keep the same app app update app ID but update the version so that means that you can have uh a lot faster developments with very stable contracts on on solid or Sapphire mainnet does that ask a like with the binance Oracle example what would the flow be would someone be calling the contract on rafle and then that's being automatically posted to Sapphire every 6 seconds or like yeah um so uh in the example every block is posting a transaction is fetching the information posting a transaction to Sapphire but that's just one of the examples um the the second thing is well you can run long running tasks in the rfle so uh you don't have to submit transactions whenever you you can run Chron jobs you can do multiple threads have some processing in one thread have a Chron job in another thread um it can query the chain so you can have a contract that will uh uh that will notify the offchain component that there's work to do um or you could have the offchain component connect via socket IO to some kind of Pub sub and you can distribute work to it there uh the main thing is uh uh the the main thing is that um uh yeah it there is the authenticated link and you can access access the the ethereum ecosystem with gas payments and stuff either via signing your own transactions or going through Sapphire and using the ecosystem there fantastic so do we need an INT based system to run role or uh RL needs sdx right so do we need an Intel based system to run or can run on um so so the question is uh do we have uh do we need intel sgx to be able to to run uh Sapphire or to be able to run Ruffles um so if you're developing them uh you want to run them locally but if you want to deploy them uh you will need sgx so yeah yeah so so for the if you're developing for the hackathon then as long as it works you can run it end to endend locally uh you restart the docker image and it will automatically load up your Ruffles and there's a command to build build it um and then you've got the local net Explorer where you can see your transactions coming in unfortunately cuz it's confidential you can't debug it on chain yeah [Music]
Automatic transcript — names and jargon may be misspelled.