Chronicle 🛠️ Opmtimistic Schnorr Oracles 101
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join Chronicle for their workshop titled "Optimistic Schnorr Oracles 101: Unlock Verifiable Data". From November 17-19 2023, ETHGlobal welcomed developers from around the globe to take part in shaping the future of Ethereum at ETHGlobal Istanbul. Over $600,000 USD in prizes were given away at the prestige Istanbul Congress Center... thanks for an amazing weekend hackers! ----------------- Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] thank you for coming to talk basically today I'm going to show you how to uh get yourself on boarded with Chronicle oracles uh real quick who am I my name is Brian bher I'm the front end lead at Chronicle um you can find me on Twitter JS Artis uh GitHub Brian belh humer my telegram I forgot to put on here but it's the same as my GitHub and I've got a Blog that I haven't updated in a long time so who are we we started life as the first ever Oracle on ethereum in 2017 we started inside of makerd Dow as technology that maker Dow created to secure all their die vaults so all the tokens that you can deposit into maker Dow uh to to Mint die uh our oracles are tracking and making sure that everyone has healthy Vault levels um so we because we started inside of an a true Dow and true defi project we're verifiable we're Community powered we're actually decentralized uh blockchain agnostic as long as it's evm based and uh really cost efficient so really just a real quick uh overview about how oracles work all right so we've got sources price sources um we use high liquidity price sources to make sure that Oracle manipulation is very difficult uh topic so we include coinbase Kraken uh binance uh few onchain sources like uh balancer and a few others but um mainly we get some high high quality reputable sources and then in order to pull those sources we have enrolled the help of really high quality and reputable names uh in the industry in the defi industry including ether scan nosis chain if you're a bunch of others I can show you more on the list later so basically each of those uh independently queries the sources gets prices and then they cryptographically sign these price messages and they send them on the network all right so the relay will pick up these price messages have been signed verify the signatures are correct and then when we have enough signatures for a given price pair uh we bundle it up we calculate a median price for it we sign that cryptographically and we put that on chain now this whole process from the fees all the way through to the price that appears on chain is verifiable um by you and you can go and make sure that all these signatures are what we say they are so the relays can push it to any of the the chains that we support currently we have um ethereum we have polygon ZK evm and we have nosis chain uh and we have plans for a bunch of more chains coming up in in the near future so uh this is QR code for all the info so anything that all the stuff that I talk about today it's all linked off of this doc so you can grab this here so don't you don't have to try and like Scramble for it later if for some reason this QR code doesn't work or you lose it or whatever you can always come by our booth uh or just go to docs. chronicl labs. org and then you can navigate to the Istanbul hackathon pretty easily it's not a lot of uh confusing things there so how do you use our Oracle for the hackathon right how do you use chronical Oracle first and most important our oracles are access controlled so uh you have to have access in order to use the Oracle so our off procedure is called a kiss right and on testnet oracles you can do it yourself so you you kiss yourself it's called a self- kiss uh on each Oracle contract that you want to use so each uh token pair that you have uh has a different contract address so if you want to get the btcusd price there's one Oracle address if you want the eth USD price it's another address if you want the nosis USD price it's another address if you want die uh eth price whatever and so on and so forth I'll show you those lists in a bit uh so for each contract that you want to use you have to um authorize yourself on that given contract on that given chain so uh I'm G to try to do this live if it doesn't work I have a bunch of slides that are step by step but it's a little nicer live so uh we'll try that okay so um this is our docs this is the link I gave you earlier from the eths tvil uh docs so it'll explain there's a lot of uh uh information about the bounties we have $4500 uh first prize a $2,500 second prize for uh projects that incorporate our Oracle in like Innovative and interesting ways um and then there's a a $3,000 uh pool prize for everyone that integrates one of our oracles uh we'll split this prize uh so there's uh details details details that we can get to in a bit um but basically in order to get yourself authorized on a given contract I'm going to do zkm because that's what I did in the uh in the trial you want to go to the self- kisser address and that's the very first address on the list right so that's the most important address right now once you use this address to authorize yourself um here are all the different Oracle addresses for all the different price pairs so these are the different price pairs that you can uh get on ZKA evm we have here's all the price the self kisser and all the price pairs for no's main net and then up here same thing for sepolia Network right so for here you want to click on the self kisser and it'll take you to the block Explorer for that given chain in this case ckvm um and then you want to go to write contract here uh and then you want to go down to number four self- kiss so the first thing you put in is the Oracle is this big enough to see or is that better okay so there's two things that it needs what Oracle do you want to be authorized on and what address are you going to be accessing the Oracle from right so for the Oracle that you want to be authorized from uh it's one of these addresses so let's say I want the uh a USD Oracle so I'll copy this address and I'll drop it right in here so I want want to be able to read of a USD price on my contract and then um for the purposes of my contract I'm just going to use my wallet address uh oh and also quick detail you got to connect to web 3 go to metamask say okay um so it's connected I'm glad I didn't have to type in my password in front of everybody uh so once you connect your wallet uh so you this is the AA USD address and then what address are you um going to be accessing it from I'm just going to throw in this address because it's an add it's a valid address address but basically it's going to be your contract address uh of your hackathon project so if you uh redeploy several times you might have to do this several times unless you use like uh was it call to what whatever the function name is to uh deploy your contract to a given address every time um so then you're going to click right metamask is going to say are you sure you want to spend this one penny of testet eth and you say of course it's well worth the cost and then assuming that it goes through um now I my address will be uh authorized to access the the a price and the way that we test that is we go back to this list and we go to the actual a contract on polygon zkm and you want to go to the read contract and again this is all written down in the docs so you don't have to remember every step uh but I just find that if you if I show everyone how to walk through it then when you read the docs it makes sense uh and then you want to make sure that you're told this is number 19 and say this is my wallet address that I just entered in the other one and you're going to query and it says true which means it's true that I have access to read this this Oracle um and then when you want to read it you read you just use the read function with your contract you get the price a read with age will give you uh price and the age the actual uh Unix Epoch timestamp of when the price was uh created so going back to my slideshow here is this it no that's not it here we are so I can skip past I didn't have to use my backup um all right so if you don't like doing all this stuff manually you can do it uh I mean via UI you can do it via um CLI um so you can grab the self kisser repo here this is the QR code for it uh and you can use cast uh and do it there you can even do it programmatically if that's your thing and it has instructions on how to do it as well so how do you read from Arc oracles once you've authorized yourself on the contracts um this is the the chronicle uh STD repo and this is where you get the solidity interface for our contracts it's the same obviously the same interface for every contract now I'll zoom in for you and I'll go back to the QR code in a bit oops so the two most important and interesting functions that you're really can be interested in are read and read with age so read will just return literally a value it's a it's a uint value and it's excuse me 18 decimal of precision so for the current uh bitcoin price it'll be like 36604 18 decimals and read with age is this sorry is the same valuee but also includes the uh the age thank you sorry for all the coughing I've been talking a lot at the booth wearing out my vocal cords and then sorry one moment and then also if you um have contracts that can't revert for any reason you can do TR read and TR read with age and then I'll also return the same values but the first value will be an additional Boolean that tells you whether or not that's a valid read so in edge cases some people have contracts that need to not revert under any circumstance and so these these two functions will not revert but that's only in edge cases so read or read with age so if you want these uh interface you can either go to this uh GitHub you can copy and paste it right into your project or you can import it with uh with h Foundry if that's what you're using um here's a QR code one more time just for a bit um just a quick note on naming convention these are the how we name all of our contracts so you can check them out on blo explorers um so for chronicle ethusd base will be oops base will be e and quote be USD btcusd so on and so forth and then uh the number at the end is the version so I think most contracts were on version two right now some of them might still be version one but that's not really important for your purposes important thing is that it's the the token pair that you're looking for I want the price of eth as expressed in USD so if you need help this is a QR code for our Discord you can go on there you can ping us on Discord we're also going to be at the booth uh you know today tomorrow Sunday um we're available to help you out kind of help you through ideas anything like that um we're happy to help you I mean it's very straightforward very simple kind of uh interaction with our contracts so uh if you have any questions on that or how you might be able to integrate oracles or how it works or anything like that we're we're happy to answer your questions um yeah so we're available on Twitter Discord LinkedIn send me email for my information at the beginning uh and now I'm open to taking questions for the next U 17 minutes or so yeah you offer any Tye a add of great question um we've gotten that question actually more than once today not yet but um but that's something that we uh are are considering either doing via um ens named you can just do like btcusd Chronicle eth something like that or perhaps just doing a kind of a regist contract where you do call read on that contract and just passes the token pair that you're looking for it'll do proxy that read to the proper contract uh on chain and then just return the result um but currently no you have to call the contract address directly right now and does the orle itself know the token address yeah right and return um no you have to you'll know the token address uh uh related to the Oracle because each Oracle has its own address so usually people do a structor a map when they put like btcusd this is the address uh so they can know that what token they're talking about the are not for contract yeah it's not exclusive to uh erc20 tokens yeah or um we also have one um to one uh contract that's um ibta is a i shares treasury bond ETF so you can track the price of one to three year United States Treasury bonds yeah any other questions chain EV yeah right now it's just onchain so basically uh you can call the contracts onchain um we do have the data available but not as a product offchain so if that's something you're interested in you can we can talk about that uh afterwards yeah let me show you the dashboard it might it might help um your understanding a bit so yeah so um these feeds have all been onboarded by maker governance so you can verify the Contra the feed address in maker governance forums so that's where like you can verify cuz otherwise generally know the feed address isn't doing anything um Beyond being a a verified like a verifiable address so our vocabulary is a little bit different feeds are chain EAS are EAS they are not on chain usually I I've seen in many documentations that people call what we call oracles they call P Oracles in our terminology contract and validators that do that that just sign just is a very important part but yes like and you see these are reputable projects that they State their reputation that everything's okay with that this is the these are feeds that these are sign for yeah the contracts are different addresses you can yeah these are the addresses of the data providers uh basically the feeds that cryptographically sign the data that verify like hey I as getcoin or I as defi saver or ether scan verify that this is valid data putting it on chain um so they they put that on our on our uh feed Network and then we pick that up with relays and then submit that uh information on chain um and because it's all cryptographically signed we can see that like you can be Asser assured that the data came from the sources that we say it came from and therefore it's verifiable all the way through onto onto the chain sure is there a way to access dat not not on chain currently it's only current price um but this we have all the historical data available uh actually actually yeah if you want to do on a contract if you want to do a VI RPC node you can you know just walk back to the chain and see with the call data it's all technically there but in terms of accessing it from a contract it's current price only cool any other questions yeah well in relation to that does that mean it's get gets updated every block or every certain amount of blocks or does it get updated when the actual being um no it gets it's a push Oracle so we update it at our intervals so and it depends on the it's Oracle so it's on a per Oracle per blockchain basis most of them are set to these thresholds so if there's uh well actually not this threshold this is 4% most of them the threats is set to 1% or 24 hours so if there's a price deviation more than 1% or it's been uh over 24 hours since the last update we updated um but basically it's just updated at uh intervals that that we set so yeah real quick I to show you real quick since we have a few minutes remaining um so for a given price say this is the current btcusd price uh you can go down and you can see these are the 13 feeds that were involved in uh creating this price so it takes all 13 of these feeds it sorts them in numerical order uh lowest to highest and then it takes the median price which is as you know the middle price so for example the defy saer price defy saer sourced its information from coinbase Pro cracken bit stamp and Gemini and if you click verify here you can see this is the price message that defi saers sent to us verifying the price that they that they calculated from those four sources this is the median price that they calculated the age is when they calculated this price uh what is the token that calculated for and then this is the rsmv uh of the ecdsa signature so you can uh verify this ecdsa signature does in fact match up to the defi saver uh EA address here and then then uh you can also go on chain here and see on ether scan um this is all the data that is uh put into this Oracle so you can see these are the 133 values in order these are the 13 ages in order and then these are the 13 signatures um of those feeds that provide of that data so if you want to manually do it you can manually do it or you can use our handy Tool uh on our website over here that does the same thing for you but basically it's all verifiable data and you can see exactly where it came from who it came from how it got there and how we calculated this price so that's really one of our main advantages uh having come out of makers we put a very high value on verifiability because that's really the nature of defi right it's not trust us will take care of it because you like that just go to trafi right um so this is where we get our data this is how you can verify it you can link out and see all the uh the different uh bits they go into making happen any other questions no all right happy building appreciate you coming out thanks a [Applause] lot
Automatic transcript — names and jargon may be misspelled.