Chronicle Oracles: Dont Trust, Verify - Niklas Kunkel (@ChronicleProtocol)
ETHMilan 2023 · 23 Nov 2023 · 25:33
Niklas Kunkel, founder of Chronicle Protocol and an early member of the MakerDAO team, argues that oracles should be verifiable and scalable. He explains the oracle scalability problem, where cost pushes providers toward fewer validators, and shows how Chronicle's dashboard traces a price back to individual validators and exchange sources. The talk introduces Scribe, which combines Schnorr signature aggregation with optimistic updates and a challenge period, and describes how searchers help catch invalid updates.
Speakers
Topics
From ETHMilan 2023, hosted by ETH Milan.
Transcript
okay hi guys um I'm Nicholas skunkle uh and I'm the founder of Chronicle protocol and the chronicle um essentially is uh an oracle protocol um and we just launched kind of uh last month and so I'm really excited to kind of be here and tell you all uh a little about it today so uh you've probably never heard of chrc uh but you probably know us by our previous name uh I was part of the founding team of maker Dow in 2016 uh and kind of the story of maker is that we wanted to build the stable
coin die uh but there was nothing in terms of infrastructure and so we had to actually go build a bunch of things first just to be even able to to attempt to build die and so many people don't know this but like maker actually made the first decks uh maker made the first oracles so I don't know if you know Marano Conti but Mariano and myself uh kind of made the first oracles and uh we kind of went live in June of 2017 with those oracles right kind of to coincide with the launch of uh of Sai which was like the the Prototype of of Dy and so you know
back then right uh you know why didn't we use chain link well chain link didn't exist it wasn't even a white paper back then right you have to think back right June 2017 so that kind of you know makes us uh one of the not just oldest Oracle protocols but one of the oldest protocols period on uh on ethereum right um so uh we kind of secure uh uh the Assets in maker Dow right we've been maker Dow's Oracle since launch uh and we're still makerd Oracle today and so uh in maker right you have uh have to kind of think about market prices a
little bit I think there's around six to S billion dollar in tvl right now and Chronicle is uh is securing all of that right so it's a really battle kind of tested uh hardened kind of protocol that is meant to you know operate at uh at at you know and be secure uh to a very very high standard right when we're dealing with very very large quantities of of money so um want to tell you a little bit about you know what kind of makes uh Chronicle unique and so in order to do that I want to kind of take a let's say a sobering look at the Oracle landscape
right and so what do I mean by that well like when you think of an oracle right uh what do you um what do you see what do you imagine well you probably just imagine right uh a price like a price pair right and uh a number right and uh that the the problem here right is that uh this Oracle is kind of like a fortune teller right you have no context for this data you have no provenance for this data you have no indication of where did this data come from or why why should I trust this data uh furthermore right oracles don't scale it is incredibly expensive to run
an Oracle and uh you end up having this uh kind of what what I think of as like a sub problem of the Oracle problem which is kind of the Oracle scalability problem and the Oracle scalability problem says you know you can be either secure and decentralized or you can be cheap and you can't be both and so uh this is like a s this is kind of a problem that is suffered by like every Oracle protocol today right so suffered by chain link by Redstone by pith um and and really what happens here right is that uh uh all oracles kind of work the same way in that you have kind of n
sources of data or end validators generating n signatures and then onchain you have to verify those n signatures right and so there's this linear relationship between the number of data sources or number of validators um and this this cost to to update the Oracle right and this is very broken because it kind of leads to this moral hazard of uh the Oracle providers basically using a smaller number of sources or a smaller number of uh validators in order to to keep the price low right and uh this effectively means right that we are compromising on security we're compromising on
decentralization right uh what does it mean to have a small number of validators well it means that like if you have four validators then two of them can collude and your entire Oracle blows up right so uh when we when we say like you know it's less secure like we really mean like it is less secure but the problem is also on the DAP side because if you give a Dap an option do you want to pay you know this amount of money for this Oracle or uh this lesser amount of money for this other Oracle they will always choose the lesser amount of money so even the daps are kind of complicit in this moral hazard so um at Chronicle we've
developed a new primitive which we call scribe and Scribe kind of really addresses all of these challenges of one data verifiability uh but two scalability right so we don't have to make these compromises anymore between security decentralization and cost so um in order to like uh explain to you kind of uh how stripe Works uh I want to talk a little bit about validators so the validators of an oracle are extremely important um they are the uh all things all other things being
equal right all of the trust assumptions of the Oracle fall on how much you trust the validators right so when you think of an oracle protocol don't think about that Oracle protocol's brand or you know market cap or anything what matters is they're validators and what matters is uh quantity is certainly a factor but the quality of the validators is equally important right uh why should you trust an Oracle run by validators that you don't trust right and so um we've kind of Incorporated this ethos to say well we don't want to like get some infrastructure companies to run these validators we don't want to get some
like um you know uh kind of like institutions that that nobody really knows right what we want to do is create a Oracle for the community kind of powered by the community and so the only validators that we really look to have at chronical are kind of projects that um users have some kind of implicit trust relationship with uh because they use they've used these daps in the past or right you know use them daily right so you know maybe you know you have a nosis safe or maybe you hold some die or maybe you look up all your transactions on ether scan or you use matcha swap like to do your Dex trades right so you have already have kind of an implicit trust relationship
with a lot of these validators and uh because kind of scrip is able to um have much better scalability properties than other oracles right we can expand this validator set by like an order of magnitude which is something that uh other Oracle providers really can't do so um first up I want to talk about verifiability so when you go to uh chronical labs. org uh there's a link to a dashboard and you can basically see the the same thing as up here right and so this is for example our our Feats page and Feats are kind of like uh what we call validators right and so you can see uh essentially the Feats reporting in real time right all of the the latest
uh the latest price updates for for all of the asset pairs that they're that they're responsible for um so right we talked about verifiability um this concept of right being able to prove the provenance of your data right where it comes from why you should trust the data well if you go to the dashboard um this probably looks pretty familiar right Oracle price right uh take it or leave it but where Chronicle is kind of different is that we show you how we got to this price right so how did we get to 16981 well we got there because this is what all the different validators
reported right uh and so when you kind of sort uh the validators in uh in order by by their price you have kind of a shelling point you have a median right and that's the value that's selected so that's why in green you see here right there's 1619 uh 81 right but we can even take it a step further and say well why did this particular validator why did they report you know that uh price right and here we can see well Argent reported this price because it went to binance it went to Kraken right it went to coin base it went to uh Gemini right it went to bitstamp right and so now you really have this like end to ends traceability
of like raw Source data to this value that you use on chain like you finally have this like verifiable context for Oracle uh data and what's also really cool is that you can verify all of this data right whenever a validator right kind of does a report or does an attestation what they're really doing is signing with their private key right so we can cryptographically prove right that this is a legitimate attestation right so when you're looking at this dashboard right it's not just uh telling you like a pretty story right uh you can verify all of this data is correct for yourself right so for example here we have what an attestation looks like for margin
right and if we click verify it will run the same exact verification computation that the smart contract does but locally in your browser now what happens if we change the timestamp by 1 second and then try to uh verify the message again well now it won't verify right so uh you really have uh this way of like proving to yourself right that all of this data is is correct and so lastly I want to talk about scalability right and uh this it it is hard to understate how important scalability is for an oracle uh because it's really what is holding uh us back as an industry right like we uh you know
in in the Oracle landscape right we're constantly trying to find ways to cut costs um but the engineering piece of it is so difficult that we come up with like Band-Aid fixes like oh what if we R and right we talked earlier about like what if we reduce the number of validators right then we have less signatures to verify on chain then the transactions cheaper great right um another thing people do is like oh well let's just update the Oracle less frequently right um great you do less Oracle updates now it's cheaper right so there's all of these kind of like Band-Aid fixed workarounds to kind of cover up the fact that like the Oracle itself is not scalable um my favorite is actually uh right the pull Oracle uh
pull Oracle is a marketing meme to basically say that it's way too expensive to run this Oracle uh we can't afford to run it from the Oracle provider perspective the DAP can't afford to pay for it from the DAP perspective and so the beauty of the pull Oracle is that it basically allows you to offload all those Oracle costs to the users of the DAP right and frequently they don't even know that they're paying to update the Oracle because the Oracle update is bundled into their transaction action that they're doing with adap so it's almost like a hidden tax that users are paying that they're not even aware about but uh and so there's certainly some use cases for a polar Oracle but uh for the most part it's more just like a clever kind
of product marketing trick right to basically have Oracle providers and daps basically just be able to wash their hands of uh of having to sustain these uh these cost and you know this is all just a symptom of the underlying problem that oracles don't scale so like I said Oracle scalability is kind of the key that you know will make the Oracle be able to actually be secure right with a really really robust validator set right be more accurate because you can update it much much more frequently right um so that's the key so how did we do it so uh if you were looking at the slide earlier right um we came up with an algorithm
that we like to call optimistic schnor um so uh what does that mean well schnor cryptography is a signature aggregation uh scheme uh used in Bitcoin for a number of years now um and essentially the benefit that we get from it is Data compression so you can instead of having n validators produce n feeds and having this onetoone relationship of validators to feeds uh sorry uh validators to uh to signatures uh you can essentially have this many to one relationship where you have many validators right producing like a single uh schnor signature and then uh we say it's
optimistic because verifying these schnor signatures can still be quite expensive um and so uh We've we've kind of have this uh this optimistic configuration of it uh to just optimize it uh that much further so let's kind of go go into it um what are the benefits that we kind of get you know from this uh this uh this implementation right is we wanted uh an implementation that works like on every chain right we don't want to you know to have an implementation for salana and a different implementation for uh evm and a different implementation for the move VM chains right we wanted one implementation that works
everywhere um right we wanted to decouple this Oracle C like update cost from the number of validators right we wanted to basically solve this Oracle scalability challenge of security and cost trade-off right and we wanted to minimize the gas right we wanted to make it uh super cheap so um two main obstacles we ran into is that different chains have entirely different context in terms of how their environment works so uh on L2 for example uh data is quite relatively expensive uh because all data needs to kind of be published to the data
availability layer right which in this case is ethereum layer one right and so the more data you push right uh the more kind of uh L1 gas costs you're you're going to be you're going to be paying right so um the amount of data you send right the amount of uh signatures you're you're sending right is uh is uh really going to be a factor in how expensive your layer 2 transaction is Right conversely uh compute is relatively cheap on layer 2 now on ethereum layer one you have the exact opposite problem right where data is relatively is a relatively cheap part of the transaction and it's the compute that is like super super expensive so you have like these
polar opposite kind of contexts and you know we were like well we want to make one solution that works amazing on both right and that's uh it's a bit of a a bit of a paradox um the other thing we ran into is that we like to say like oh all these chains are evm um that's complete BS uh no two chains are alike um when we say when we compare like a polygon to an avalanche to a BSC to an ethereum to an optimism to an arbitrum to a ZK sync um all of these chains are different um you know terms of how certain things are implemented in terms of uh pre-compiled
that are like available um and uh a lot of things that you know in the ethereum community were like kind of handwave away is like oh there's an EIP it's going to be included in a fork it's going to fix this big problem that we have um but then from a pragmatic standpoint it's like well are the other you know evm chains going to adopt that pre-compile uh maybe we don't know um and if they do how long is it going to take a year 2 years maybe never um so it's extremely difficult to um optimize something right without abusing pre-compiled uh which
would actually not make it usable on on chains that don't have those pre- compiles so um I want to show you kind of the hard numbers on like what we were ble to achieve so uh the first line is the amount of gas right that we're using um and then um we can convert that to like a dollar cost if we assume you know uh the eth price and the gas price so I kind of updated it uh the numbers to correspond to $1600 eth and a 16u gas price right if you double the price of eth right if you 10x the the gas price right these uh these numbers well uh the gas doesn't change right but the uh the
dollar amount right scales uh scales linearly so um you can see that uh what we've managed to achieve uh with Chronicle I mean it's like monstrously more scalable than what anyone else has been able to do I mean you know compared to chain link we're like 80% lower uh in terms of gas right and uh you'll notice that we can do this at a much much higher validator count than anyone else can right so instead of having you know 10 validators mean like whoopy dooo like we hope you know five people don't collude to compromise this Oracle that's securing 8 billion right uh instead we
can have you know hundreds of validators right and we can say like okay let's go grab like you know the top 200 like projects uh protocols players in the space right and create an oracle where theoretically an oracle attack is still possible but from a practical or pragmatic point of view right it's uh it would be like the equivalent of cannibalism right where the industry is like swallowing its own tail right uh it becomes much less feasible when you need to coordinate you know hundreds of validators um to uh to collaborate right and and try to like say like destroy an entire industry that they all work in so
um I I want to be cognizant of time I think I have like uh two or three minutes left oops um so I'll just like run through the technical stuff really really quickly in terms of how it works um so uh we have our feeds right which uh basically generate do this like signing ceremony and generate right a uh a schnore signature um then we have one feed uh which then does a uh one kind of vanilla ecdsa signature on top of the schnor signature and effectively is that one validator just making a promise saying I promise that this schnor signature you know represents the consensus around some price at some time
stamp for some ASA pair um and then you know you can do this in a push configuration you can do it in a pull configuration it really doesn't matter but uh basically the schnor signature right and the uh ecdsa signature that represents the promise and the corresponding data is pushed to the Oracle contract and uh what does the Oracle contract do it does not verify the schnor signature uh what it does is it just verifies the one vanilla ecdsa signature representing the promise of that one feed of that one validator and right and it'll check one was the promise made by a legitimate validator right um is the price you know more
recent than uh the the last you know known price right um and now that price is accepted optimistically and so now we have like a 10minute kind of like uh challenge period right where anyone can effectively challenge this optimistic price and uh so what happens when uh someone challenges well all it does is it just goes and verifies the actual Shore signature uh and so the verification of the shore signature is like um is about 140,000 gas more or less um at the the validator account that we're using right which you'll see is like you know double the 66k that we can do the optimistic
update in uh but still like less than pretty much what every other Oracle is is paying anyway right and we do it for way more validators and this should be you know a a false optimistic price rate should be a uh very very in in frequent event right like uh if you see one right uh alarm Bell should kind of be ringing because it's like wow like a validator is actually trying to to launch an attack so what happens during this challenge right is the the shore signature right gets verified um if the challenge is successful what happens is the Smart contract will automatically ban the feed right the validator that made the invalid promise right so that
uh that validator is just they're done right they get one shot uh one shot attempt to do an oracle attack right and then then they're dead um and then they also the person who called this challenge right gets an eth reward and so now what we can do is we can go to the me Searcher Bots and say hey look if you can ever call challenge successfully right you get all of the uh ether reward and so now um you know what we kind of see is that uh you know we've kind of been collaborating with a bunch of the Searchers is that uh when these invalid um kind of stage fire drill uh but the like these uh invalid uh optimistic
updates come in uh the me Bots are already racing in the same block right to uh to uh to do the challenge right so um in in the test that we've done like the invalid price doesn't even last a block because the me Bots are already catching it in the men pool before it's even push on chain and that's uh that's really really cool so um when are we launching well we actually launched uh uh last month so we're live in production right now uh so you can check it on chain and uh confirm to yourself that it's working uh take a
look at our code like it's uh it's pretty cool uh I see one of our Auditors in the in the audience uh he's he's quite familiar he can probably tell you a lot more about it than uh than I can about the intricacies um but uh yeah if what I said interests you um if you want to you know maybe join our team you know we're always hiring uh if you want to integrate us you know please get in touch with us uh if you want to find out more you know check out our website uh follow us on Twitter join our Discord uh I'm also happy to talk to you I'll I'll stay for for a few minutes afterwards so uh thank you very much much
Related talks
- Don't Trust, Verify: The Next Generation of Oracles | European Blockchain Convention 9
- MakerDAO Oracles: The Backbone of Decentralized Finance by Niklas Kunkel (Devcon5)
- Connecting Capital Markets and Growing DeFi
- Building the Data Layer for Ethereum's Institutional Era
- ETHWarsaw 2023: Niklas Kunkel, Chronicle - Verification is the ultimate form of trust
- Using Holochain as a Validated Data Layer for On-Chain Transactions | Joshua Vial - Holochain
- Why Web3 Needs More Oracles - Chandler De Kock
- Building a World Powered by Truth
- Building the future of Smart Contracts - Sergev Nazarov
