Oracles 101: Understanding them & the design trade-offs of Oracle networks

ETHTallinn 2024 · April 2024 · 23:08

Kos of Chronicle Labs introduces blockchain oracles and the design trade-offs involved in oracle networks. The presentation explains how smart contracts obtain information from outside the blockchain and considers the architectural choices behind that connection to external data.

Speakers

Topics

From ETHTallinn 2024, hosted by ETHTallinn.

Transcript

I'm my name is Constantine I'm working with chronical Labs uh and we building oracles first of all who knows what is Oracles so I just need to understand how deep can I just dive in this talk okay one person okay yeah then I will be light with you guys so I'm mostly technical person I'm not the person who is normally going like cheer cheering about everything so I I will go more on the technical side so the oracles the oracles itself what is the Oracles in blockchain in theory the oracles is something that provides you with the data that the blockchain doesn't know for example blockchain

doesn't know what the weather outside and if you need something on the blockchain you have a smart contract that will react on the weather or amount of people in the room somebody have to prove that there were such a lot of people or like it's sunny if I will say that it's sunny and committed to blockchain like it will go wrong for some stuff but the oracles the main idea of oracles is just proving the data that it's outside of blockchain to inside of blockchain for sure like mainly oracles are made for getting prices of different assets on different I don't know apis whatever pairs real world assets like gold

USD Euro and everything else uh and in reality the oracles it's a from the first perspective it's pretty simple thing it works very simply we have a tool that actually goes to different sources like coinbase kren binance FTX was on FTX yeah and get the price for some like data for example Etc usdc like m usdc usdt whatever then it Aggregates the prices from different sources and send it further to commitment to the smart contract on different

chains our oracles consist of like four steps so we have the source that produces the prices we have the feeds that consumes the prices from the sources Aggregates calculates median values for some range of data just because like for example if you are binance and you providing with a price you couldn't provise with a price every millisecond but some actors need this price so when we aggregating the prices from different sources we getting the seminormal price based on different sources in different time and this is how the feeds actually

aggregate the price then they saided to relays that actually verifies that the price was correct it does it like mathematically uh it has all the information I will describe it later and the relays then sends these prices to Smart contracts on the Chain so on chain you can actually get the price of some pairs oops Yeah and all these actors are communicating using Le P2P so if somebody didn't hear about Li P2P just uh communication protocol that is distributed so every actor it's named feed in our sources is communicating to bunch of different feeds so it's a sort

of network and if somebody couldn't communicate between each other the message will be relayed from the other actors inside the uh Li P2P itself so it's P2P network uh why we decided to choose it because it's distributed we don't need to do anything it's proven like there are a lot of projects using it it's selfhealing if somebody couldn't receive the data somebody else will reot the data to him and it's accessible for everybody we don't need to think about scaling so we don't need to keep servers and pay for the servers so different people could be could rote the messages and the data will be accessible to

everybody who need it so I already said that uh what is the oracles but the main like problems of the oracles is that most of the protocols and most of the users of oracles need exact the same data but on their chain where they operate you don't need you couldn't go to ethereum if you operate on like something else you need this data on your chain so this creates an issue for us because we have to support publishing all these uh prices to different chains even if we get the price from One Source we still need it to distribute it across

the chains and here we have a lot of problems for example the accuracy problem uh we need to be sure that the price is actual and like pretty good we couldn't afford to send stale prices like if the price was like 10 20 30 1 hour late it might affect every player in the game like with the Luna in one hour price just jumped completely and if we will re like uh resend again and again the old price lot of people will lose their money the relability it's another issue this is the biggest issue when you have uh something big using your

oracles currently we partnering with makers it's like one of the biggest real world asset company that like actually based in blockchain and they really need the reliable data they couldn't uh afford to lose data because it's like a lot of money and the protocol itself will die as soon as we will I I'm trying to find the board without like swearing but whatever you you understood what I meant yeah the security the security is another part it's for obvious reasons we have to be secure we couldn't off uh like offer ourself to accept the prices from somebody who is not very

like true about the price or something so from malfunctions malfunctional players in the oracle Network the same issue with the scalability it's also pretty obvious that we have to be scalable we have to like have a lot of load we have to accept it we have to deliver our prices and the cost this is probably the biggest issue with all the oracles that actually exist at the moment because uh you have to pay when you sending the price to on chain and all these payments is taken from our pocket so we have to pay for like applying the price not people who is receiving the prices and the cost of this data it's like pretty

big and like right now it's a lot of oracles and everybody says that they actually know how to solve this issue but in reality like nobody actually solved it they have assumption that they did solve this and yeah the next point is that you have to trust probably oracles but not one of them and you have to like deliver stuff and how base Oracle system works as I already explained it like collecting prices signing prices uh storing prices somewhere onchain offchain whatever and the player who needs the prices consumed these prices from the

store and there are a lot of companies who actually consumes the prices at the moment and all they couldn't rely on one concrete like Oracle or something and right now the oracles uh companies who provides oracles is mostly like based on the reput reputation so they working for a while and how history showed us it's not always very good solution to trust on reputation uh we also like trust our reputation we trying to do everything good and we actually developing oracles from starting of maker Dow and still we uh involving right now we completely

separated from maker so we just completely separated thing and issue is that so if somebody is not relying on the reputation that they have to verify the data that you send us that's why we actually went with a uh approach where all the prices when we send this price to onchain everybody could open the website like chronical Labs org go to dashboard pick any price message and click a button verify and it will make a mathematical verification on on the sign uh sign signature of the message with

the price and you will see if this price is valid and it was sent from valid Pier inside the network and if the price was like bad you will also see this if you want just open chronical la.org dashboard yeah how we consuming prices we consuming prices from different uh apis not only apis but basically like it's a very very basic like uh tool for consuming prices we using GQ some other stuff we using a lot of self software to consume the prices from different points

and this is how it looks inside our configuration files so we actually getting the prices from API bance we getting the symbols prices volumes timestamps and everything then we aggregating these uh prices and for example for uniswap because they don't have API we have to go onchain and ring the onchain data on these contracts and every contract is corresponding to the concrete pair that we need the price from uh so right now we have uh ability to consume prices from onchain and offchain and we aggregating all these prices because the onchain prices has some issues because it's couldn't be done very like rapidly you couldn't rely

on them if you need like every second updates because the block verification uh cost of pushing the data to the blockchain so your prices will be always a little bit stale it will be still useful for most of the players and US users of oracles but not always yeah the first approach how I already explained how the oracles are working was like this so every feed have to collect sign store the data then we went to the next approach where we have uh the second version of oracles where we still have the feeds who collecting signing the data but publishing the data to the onchain was separated from the

Feats itself that's why like the relays from the first slide appeared who actually pushes the data they aggregated the prices from different feeds and then stored them on a blockchain with one transactions so we just starting to save money in there I have to hurry up uh yeah and that's how we got ability to implement everything only once for every chain we don't need to reimplement something from like different chains we deced the oracles and we deced from feeds so right now the price fing is completely independent from the price publishing and we saved money for

us then we decided that it's actually a good solution to save even more money and decided to go to the oracles version three where on some chains for example ethereum where we have like uh gas and the cost of computation and the cost of storage is pretty high we started to approach optimistic Oracle push approach so when we started to implement this we had to find the ability how to sign different messages not separately like it was like in normal oracles and it was working before we decided that we could

combine the data then we can uh use different Rel layers so diff different uh things software in the network that will collectively sign bunch of messages and publish it to the chains and actually it helped a lot we saved a lot of money and on the chains where the we have a cheap compute Powers but expensive call data mostly L2 chains we like use using this approach and all the prices is publishing there uh with the one signature for multiple prices so we happy but we didn't still solve the issue with ethereum because it like the

most cost like unefficient chain that we have at the moment that we're working and we decided that we actually will go with the same approach but we will not wait for everybody in the chain to completely approve and confirm that the signatures from the feeds and the data in signers is valid and we will just publish the price as soon as we get the first signature but then when we deployed it and tried it it saved a lot of gas it saved a lot of money but there was an issue what will happen if the signer will just change the data and signed the invalid data

here we uh went with the situation where we created The Challengers it's a separate bunch of people you could just run this tool it's open source you have to pointed to the smart contract where the data with the prices goes and it will constantly monitor all the blocks all the events on this smart contract as soon as the new price will appear it will get the data it will get the Snore signature it's a signature of the price it will get all the list of historical places where these price came from and it could verify that the price is real and the signature is valid as soon as the signature is invalid or the price is

invalid it could send the challenge and said that okay this concrete pier was pretty bad guy so we have to punish him and the feat will lose portion of his Stak money and the Challenger will receive it as a reward for finding malfunction from the feed so it's a sort of way of making money so right now we have situation where everybody could rely on this stuff or on the prices of course with some delay in the time because you you have to spend some time when somebody might

find like the price as false but still we have a lot of validator probably nobody will try to like do something bad with us and they're working and right now we can have up to 255 validators in one chain based on one contract so they will uh work and verify and sign the messages with exact the same cost as we have right now with the 25 validators so because of these optimistic schnore signatures and updates we like we could ignore amount of validators when they growing so we don't

need to spend additional amount of gas and it showed it of course it's our calculations based on only our data that we got from the dashboards from all the possible oracles that we found and we found out that this approach saves huge amount of money it's like up to two up to four times less than others and like when the gas price also grows we still saves a lot of money for us uh we still thinking of uh we didn't implement it yet but we uh thinking of

implementing the pool pool oracles it's a type of oracles that works when not we pushing the data to onchain with the price but users of our oracles who need the price can ask this price from us and publish it to his smart contract and they will have always the latest price verified by them and they will have to like pay the gas for publishing the price but they will pay way less because they need for example only one pairer price for one pay not for everything we have like 200 payers and we're paying for 200 but the user who need only price for one pair can save a lot of money for

himself and for us yes but uh yeah so the taxes is for users not for us uh and we we will still have all this data in C data on the Chain so all the other users would also rely on this data on the pool oracles there is one big issue with the pool pool oracles and that's why we didn't start with them because like from the business point of view it's very efficient when your users paying for you not like you you don't spend your money but as soon as somebody decide that they will go with for example chronical oracles and creating

smart contracts that will get the price from us and publish this price they wouldn't be able never to switch the oracles ever because they already baked it in their smart contracts so it's only like one step decision one time decision and because we need to just make for the market working first and then come up with some solution that needed not for everybody because most of the protocols most of the uh users of our oracles they don't want to like change their smart contracts often they just needed prices so that's why we uh actually found

investors and started with the approach where we paying for publishing money at the moment but we will involve and yeah this is the another issue with the pool Oracle as soon as your smart contract or your infrastructure has some issues you couldn't get the prices and everybody else who is relying on the prices might go wrong that's basically was very fast brief in like oracles one onone what is Oracles how everything is working and what what is it and our plans and I'm pretty in time so I have five minutes more any

questions uh right now we don't but uh as soon as we will release the PO pool oracles and as soon as we will reach the market and we'll start to work with more and more and more users for sure we will because because somebody need to pay us and at the moment we're thinking about this at the as as a subscription service where we they will stake money and pay for the prices so this will be the time where we will need our token to manipulate with everything and we need to make a governance decisions that might be another token but it's like it will depend on how everything will go right now we don't have any tokens uh we

have it in plans but not like in the near future as soon as we will have a very stable oracles working then we will think about how to get money from so it was pretty good speech then if you don't have any questions oh yeah and I could show you how to verify [Music] okay chronic collapse

so yeah we have a prices and we have on chain price updates and we have the history of prices and we have list of the prices that was pushed from different feeds and in reality you could just take a look on the price and click like verify and it will mathematically verify that this price was valid or invalid so yeah this is how it implemented in the dashboard I like just this thing