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

Loading player…

The future architecture of Web3 & DeFi protocols with On-Demand Oracles by Marcin Kaźmierczak

Ethereum DenverMon, Oct 9, 2023, 12:00 AM

Stateless oracles are an interesting alternative in the DeFi money lego offering better scalability and lower refresh intervals. At this workshop, we will present the underlying architecture, security aspects, opportunities and flaws of this novel approach.

Transcript

foreign hey hey if Denver Builders how are you today um my name is Marcin I'm CEO At Redstone Oracle and co-founder of e4so hope you are not too bored and if you are I will try to energize you a little bit and open your head for some food or Food For Thoughts with the future architecture of web free and defy with on-demand oracles but before I start I would like to ask you three very quick questions if you will the first one hands up everyone who has ever heard of our weave the chain all right a bunch of you keep your hands up now the second who has ever used it okay a couple and who knows how it works under the hood okay smaller okay good so I'm going to chat a bit about Arif in a second but first let me tell you a bit more about Redstone and why it can be quite disruptive in the market so first last year we raised seven million dollars from a couple couple of uh tier zero investors so we uh basically conveyed our message to them and they believed this is like one of the futures of the architecture in web free our team has been to seven hackathons last year won five of them with adaptions of redstone this one is pretty cool it's called lenscore which calculates the score for a given user based on lens activities and then it gives you Unchained so you can use for example you can use it for example for anti-bots anti-spanning or airdrop like decisions who should get it or not um last year we've been to 16 in-person conferences this picture is from iforso so we always try to ask builders in physical world like what they need to be on top of the trends and right now we are a team of 22 people 80 percent of us are developers so heavy engineering team so that's where our focus goes before I dive in a quick recap on oracles so oracles deliver various types of data on chain for smart contracts and apps this statement is true however right now it's almost only price feeds if you look under the hood so how it works in practice you've got data sources the Oracle pulls the data from them and then delivers it on a target blockchain for example ethereum Avalanche layer twos and then dabs on these chains on these ecosystems can use it for any kind of application it wants to build okay so what's the problem over here same sound right so apparently we are in our opinion in 80s when it comes to oracles so this is a very simple idea of just taking the data and pushing it on chain in intervals but to innovate we have to basically stop thinking in 2020 D5 summer terms right it's 2023 we need to innovate we need to create something new so currently you need to cover gas costs even when you don't utilize the data it sits idle on ethereum or other chain you don't use it you still have to pay the gas cost right we cannot build the next generation of financial system using that right so the problems to put it on the slides first oracles have limited scalability because of the costs they cover only small subset of tokens right now approximately 100 price feeds so it's only price feeds with 10 minutes interval which is a very long period considering like the defy on top of that oracles push the same data to multiple chains so take BTC USD pair they have to push the same data to multiple chain so they have to cover the cost of multiple ecosystem D5 potential is limited by oracles especially on l2s like ZK sync which is one of our strategic Partners Arbitron polygon and speed optimized chains like Avalanche Phantom and also like ethereum so before I go into on-demand oracles I'd like to talk a bit about on-chain storage costs because my claim is that it's expensive so let me first break it down so cost of storing one gigabyte on chain on various ecosystems let's Dive In if you take Bitcoin storing one gigabyte costs approximately 2.7 million dollars which is extremely expensive but if you look into ethereum and evm it's almost 80 million dollars that's crazy I mean because these chains weren't created to storing data right but people keep pushing data on it so that's counter-intuitive if you look into changes that are specifically designed for data storage for example our weave it costs just three dollars so there is no m in here is no million is like regular free bucks so there are some references from which I took that data from so I would like to talk about the magic of call data for those who are not familiar with this field in the evm transaction call data is the read-only byte addressable space so this picture is from ethereum white paper if you look into State 1 and state two you have a transaction from Two and there is also value and data and for example in the call data you can keep function arguments in this case it's number two and Charlie so both optimistic rollups and ZK rollaps batch raw transaction data as call data and post it posted state to ethereum right so it's widely used pattern already by layer twos that revolutionize right now the space as you know so what generates the total transaction cost in evm so here you can you can see on a very simple price list it's also from ethereum yellow paper so the transaction itself is 21 000 gas called Data byte is only 16 so each byte so it's not just 16 depending on how many bytes you store in there but it's unparably cheaper than the other positions storage read is cheap but we are not talking about that over here storage right look the transaction costs almost the same as storage right which is like 20 000 gas and creating contract is the most expensive as you might be aware of that so now going to R weave so for those who didn't put up the hand app our weave allows you to store data permanently sustainably with a single upfront fee sounds like what tournamentally there's no something like permanently in computer right and computer science basically so it's a bold statement and they are actually committed to store your data for at least 200 years it's not like 200 years and it disappears it's calculated for 200 years they had to put a number over there so it's Affordable Storage compared to generalistic chains it's a long term it guarantees you long-term availability by data probing and endowment fund so how it works in practice if you want to store something on our weave and you have to pay let's call it two bucks first only 20 of these two backs would go to the miner to take that transaction into the block and eighty percent would be released over time to the miners to keep that data in a kind of like endowment effect so in comparison for example to filecoin in fileco you have to keep on paying as the data is stored on chain over here you just pay once okay you pay more but you don't have to care about that anymore it just goes there and stays at least that's the claim and so far no data has been missing so I truly recommend Aries yellow paper it's quite simple and digestible if you want to dig deeper consensus mechanism is called second proofs of Random Access and funny enough between the fifth and sixth of March so very soon they are going to update their consensus it's called like r with 2.6 so it's similar to the merge so at the certain block height they are going to switch to a new consensus mechanism it's also going to be quite important for the whole ecosystem and it's time tested so riff has been storing data for four years already on the mainnet and non-data has been missing to prove the validation of are we've recently Instagram and meta announced it would launch in-app nfts based on polygon but the images themselves and the files would be stored on our weave so what's the current market Trend in D5 defy has been getting more and more sophisticated with the growth of derivatives perps and options or everything that's happening right now these are the dominant players over there so despite the whole defy Market shrinked five times over the last year those types of protocol doubled in their tvl so you can easily see that the old boys are losing and the new guys are getting a lot of traction as you imagine more sophisticated protocols require high frequency diversifies data which is too expensive to put on chains so current players or increments on the Oracle Market cannot deliver that and now let me bring you quite a bold statement over here that hasn't been present so far in the Oracle Market there is no one solution fits it all approach truly guys like if you if we go to the conferences and we talk to builders it turns out that it's not like hey I just need data on chain because then it's about frequency the type of data how it should be stored how much it should be secured and so and so forth hence you should adjust your approach to the needs of Builders therefore Redstone offers three unique models to match user users needs and here let's look into them on an example of our strategic partner ZK sync so the first is the on-demand model called Redstone classic which I'm going to dig into the most it's best option for most of the Define web for use cases as we were testing it with the builders hence however it's not always the case that they like it sometimes it doesn't match as the needs for example we've been talking quite a lot with GMX which is for sure like a prominent platform especially recently so we created like a dedicated front running proof model which is fantastic and Tyler made for options and perpetuals where the price has to be delivered as soon as possible first last but not least we also have like the Oracle a classic Oracle model where we push data on chain it's for big players that would like to launch on other chains that current oracles are not present at so to give you an example we are going to be live on polygon zkevm from day one on the mainnet we've been the first Oracle to be available on ZK sync uh scroll and couple of other chains so we want to be very on top of the Innovation we don't look back we look up up front so let's go to the first model Redstone core model on demand Oracle this is the most important slide today it's kind of packed at the moment it's pretty empty but it's going to get packed so watch out first we have data provider nodes for example Redstone kaiko flow Traders bearing welders and others and these guys are professionals when it comes to aggregating data they take their price feeds or other types of data like volatility or others they put it as a package like a data package they sign it and they throw it to data delivery Network that we created it's our proprietary technology it's open source so you can check inside but to give you a high level overview it's consisting of streamer Network which is a kind of like a decentralized pub sub Network really cool infrastructure you can look at our weave or like consistency so once we use the data we throw it on are we so you can always come back to it and our own notes that work a little bit like a gateways so that you can easily access the data all right so the data is a data delivery network with the signature what happens next so imagine we have other like very known protocol and there is Homer Simpson our D5 DJ and I would like to create like a position with other or liquidate or whatever I have a front end so like Avid adapt with its eaters JS would fetch the data with the signature and to Commerce Sims in transaction it would attach that data to call data field and then it ends up on chain for example on ethereum on avalanche on Kanto so we are the first and only Oracle to be on Kanto arbit room ZK sync you name it as long as it's evm is going to be out of the box like this you just have to verify whether this signature checks but we haven't encountered any single problem with evm chains so far and you can use it right away so how much it differs from the original model once again in original model you would push data on chain and the dub would query the data that is on chain already posted over here it's on demand so only when there's a transaction that actually needs that data that's the moment the data is sent on the target ecosystem so for example the Redstone signs in data deliver Network I said are the gateways and so anyone can spin up their own so it's like an infra if you need for example a dedicated Gateway for liquidation balls or something else it's open source you can bring it up um so the data packages are also verifying on chain with the signatures so you've got the same level of security at the fraction of cost in the whole flow and as you might notice right now it's transparent it's open anyone can join and spin up their notes so we essentially change the naming over here it's not Oracle anymore it's rather oracle's Marketplace because we are one of the first provider like Redstone but we open it to everyone and if you claim that you have good data for example you're a market maker or whatever other party you can just join put your collateral in Redstone tokens that is subject to slashing in case you don't deliver the data and join the game and earn fees right because the dabs in the end so in this case Ave wouldn't pay to Redstone it would pay to data providers that it picked that it trusts and that it uses for its protocol and basically the whole flow for me it's pretty cool but I am biased of course you can check out as I said the whole code but it's not up to that only what about non-evm chains so apparently a month ago we announced our second non-evm integration for starknet we are very dedicated to that ecosystem as well as it believes in the ethereum atos we are right now working with fuel so fuel a network to create a dedicated connector to them it should be up very soon the first non-evm that we created was Stacks because Stacks came to us and said hey like current oracles cannot deliver to that to us can we bring your architecture to to our chain and they did it themselves so we didn't even use our developer resources they created themselves or out of zero if you have any other like non-evm ecosystem you would like to have Oracle at your feel free to DM us and we'll be very happy to you know also deploy architecture architecture over there later if I have a time I will show you our showroom.redstone.finance where you can easily Rose through ecosystems that Redstone has been deployed and you can basically go there and check it out there is one trick though there has to be a trade-off right in everything it cannot be just shiny and brighty as gold so basically in this model the dub itself before it uses Redstone has to adjust its ether's JS or other JavaScript code being able to attach to this transaction call data the data package so this is the main difference and also their own smart contract that is deployed to the destination chain should also have a two line of code enabler of extracting the data from the transaction so the integration is slightly different than traditional oracles but as the presentation is titled it's a new architecture because we cannot keep doing the same way over and over like you know what Einstein said like if you're doing over and over the same thing with a wronged effect and you keep on doing that and expect something else you're just you know not necessarily on the right mind how it looks on metamask because as you know it's in cold data so you should be able to visit like see it in the metamask transaction and that's exactly what you can do so if you in metamask go to the hex hex part you're going to see bytes delivering these data packages to on chain so it's very visible for the user over there however the user doesn't see it right away he or she can check it out if it's present over there but from the user perspective the usage of the dab itself is seamless it doesn't give any other you know like bottleneck over there so how it looks on our web app for example for ethereum you can go to our web app which is app.

redstone.finance and you can check for ethereum we have 4G sources all together we have like 70 for all the assets but for ethereum specifically you have 40. we give you median but you can check also choose other metrics that you want and you can also see the differences between different data providers it's not only up to that we also created something that we call Custom oracles so it's for testing purposes rather if you're a developer for example for a hackathon or any other purpose and you want to create a new data feed with low cost you can just go to our web Wizard and create a custom Oracle based on the API and Json path so for example here you can see temperature in Warsaw or my hometown how it has been changing and you can use it in your smart contract it's not super like maintenance ready I would say if you create it that way if you find it usable then you just come to our team and we make a Deployable on a ecosystem that you wish to to go to so with as I said Redstone is the First Data providing whole ecosystem so how would you see for example us as the data provider so we take data from reliable data sources first off chain so Enterprise data providers kaiko flow Traders coin gecko coin market cap and a couple of others we integrated with over 50 biggest taxes and we pull data all the time about various tokens it's not only up to that we also have on-chain data that you need for example we can deliver t-waps right now we are talk working on L webs so liquidity based LP tokens uh so for example staked avacs or staked other other tokens and liquid state tokens um nft data and much more so we have oh yeah 70 sources over one thousands of assets right now and over 4 billion four billion data points what are the benefits of such design so I'm still talking about the first core on-demand Oracle of redstone so first it's scalable what scalability means nowadays it means that you can add new things and basically the costs are not growing exponentially so in that case we are very scalable we cover over 1000 assets and non-standard data so for example if you need temperature or results of a game games or something else you can deliver that fairly easily we have 10 seconds refresh interval like comparison to 10 minutes it's quite an enhancement but we and we can go even sub seconds so right now we are experimenting on arbitrum if we can deliver data as fast as every block on arbitrary if we manage to do so it's going to be a sorry breakthrough like truly last but not least as I told you like other oracles take the same data feed and they push it to many chains and they burn the cost of the same data in our model we are cross-chain buying design and we have no gas waste so you only pay for the gas on the destination chain only when it's needed so it's like the efficiency to maximum if you see any like Improvement in the efficiency please contact me after the presentation I'm very happy to hear it hear that because that's what we optimize for and if you go to app.readstone.finance you can browse through the data that we have all right so so for now I was talking about the first core Redstone model now I'm going to talk about Redstone X it's a front running proof model it's very sexy it's a result of talking with a lot of Perpetual protocols like GMX so in this flow bear with me first user interacts with the DAP and sends the transaction to the chain example opening a short position so it sends to GMX open the short position then GMX sends the transaction on arbitrum uh it's recorded on chain but it's not executed in Block n then again we have this data delivery Network and everyone can create and act as a resolver that fetches data from this data delivery Network fetches this transaction from blockchain and connects to this cold data the the price feed so you see you have block n from a price speed to block n and then it goes back to GMX so the DAP which sends it to the the next block and executes in N plus one so we get a small delay like one block but considering arbitrary is super quick it's not that much of matter for the user but we get super efficiency when it comes to um making sure that the transaction itself and the protocol is not from Trend so it's Tyler made for perpetualizing options it's more expensive than the previous one because over here we have to you know like adjust for a specific dap it's not like generalistic but still if you're playing the perps game one thing you want to make sure is that your Oracle delivers up-to-date data on a short manner so as I said we cover all evm chains but it's not sexy we also go beyond as mentioned before what about adoption so one of the most sexy D5 protocol in the past two weeks or three weeks has been Delta Prime you can check it out on D5 llama so guys do um leveraged Prime brokerage accounts we also uh provide our infrastructure for a suit of protocols we are at the final stage preparing solutions for protocols such as bull shark on arbitrum and fuel Olympus dial that you might know fairly well so these guys actually in December last year experience price manipulation and they came to us and said hey like we cannot bear with that anymore can you solve that problem and we literally on hand sit down with their developers we created like a dedicated solution we did analysis of the previous hacks so we are very much aware of the whole course of history and mental apps it's also a huge protocol like a position 15 D5 ammo when it comes to tvl it's on sale and also ethereum we are creating like a Tyler made solution to them Redstone has been in production for over 10 months right now in mainnet without any interruptions for the past 10 months you remember there was like Terra there was FTX there was Celsius there was a lot of happening on the market itself and we didn't have a single hiccup when it comes to security our founder is X open Zeppelin smart contract auditor so he has seen thousands of attacks vectors so if he eats and briefs evm but also other architectures we got two independent audits from abdk and pack Shield also co-founder of l2beat did an audit for for our code and as I mentioned eighty percent of our team are developers so Tech first approach is definitely something that defines us so going to the end of the presentation let me bring up one of the use cases like real world use case Delta Prime on Avalanche right now so how their model works you've got a borrower like regular on other or something else that needs to put some collateral imagine one avax on the other hand you have a pool from which you have to take the the uh you know the borrowing and all of that is put into a single smart contract one smart contract is per user and it's called like a Prime account and where you can take up to 5x of what you put in so if you put in one avax you can borrow up to five FX right so their regular thinking would be okay that doesn't make sense I just run out I put one avax I run out of six avacs and yeah whatever however you cannot do that because this smart contract restricts you and Bots always look at your health Factor so if you go uh below a certain Health Factor you're going to be liquidated what you can do with this money so imagine you borrowed free avacs so you have four avacs you can go to various protocols that the guys integrated and Via this smart contract interact with them so on Avalanche for example you can trade on a Pangolin or Trader Joe you can stake or yield Yak so in the past weeks the highest API was on glp leveraged via Delta prime or liliac that was a crazy good strategy or you can do also liquidity Mining and for all of that Redstone delivers price feeds and I was talking with the CEO of Delta Prime and he explicitly said Martin but for Delta but for Redstone our model would never be so efficient as this as it is right now maybe it would be possible but for sure not so efficient so this is just to give you an example on hands and one thing I also want to chill slightly is this E4 so conference it's also like a huge effort of Shannon from if Denver because she helped us with the first edition that was last year this year it's end of August beginning of September so I would very much like to invite all of you to swing by so this is all for the presentation I still have three minutes 40 seconds so what I'm going to do I'm going to show you these apps I was talking about earlier so this is Abdul redstone.

finance you can see over here that there is over a thousand of assets we've got crypto assets but we also have nft floor price we've got stocks from various exchanges mainly us we've got Forex we've got ecosystem specific tokens this is something that we see a lot of interest right now so yield bearing tokens or tokens that are only available on a specific chain custom Oracle so you can check what others are building and they're trying out we've got grains we've got energies Commodities you name it and this is this lens score I was talking about so for example if you go to stani.lens on lenscore on lens you can see like how much Stannis activity on lens has been giving up giving him more and more score in this particular sense all right then when it comes to this showroom the Redstone is fine as you can see a suit of pro ecosystems that you integrated with it's not all but it's majority so for example over here I have a my wallet and a demo contract on girly test net on ethereum if I click get prices what happens I'm sending a transaction to girly if together with my transaction to call data the price feeds are attached and then from the smart contract this front end just reads what's over there what's been delivered so I click get prices the transaction is sent and then you have displayed the block number the timestamp when the price has been delivered and a sample of prices so over here BTC if B and B and so on so you can check it with all of the other ecosystems over here and here you can see a specific for starknet because it's not in VM so the flow works the same however there are some slight changes underneath and last but not least maybe what I would like to show you is this Delta Prime so uh basically I would have to switch to Avalanche but you can see how much you borrowed what's your collateral and you can browse through various tokens and maybe I will do it quickly oh okay so you can even see that right now I have a position over here I don't remember on this account yeah the internet is not the best so here it calculates the API that my account like all together gets here is my health Factor so it's 40 it cannot go to zero and at the moment you can see that I have a borrow position of 200 usdc and I went to farms and for example for this specific account I took glp and I staked all of it so right now current apy is between 23 to 75 77 percent it has been way way higher but basically the capabilities of this platform are really really huge so I've got half a minute left so maybe okay still this if thing if it go it's going to load but here we are going to see like the history chart of price feed for ethereum for the last hour so this is all I wanted to convey to you guys thanks a lot for everyone that hasn't gonna sleep and if you have any questions please do come and chat with me after the presentation thank you okay [Music]

Automatic transcript — names and jargon may be misspelled.