Oracle of Ethereum: adding native Oracles to EVM

ETHCC 5 · July 2022 · 19:36

Konstantin Kladko proposes adding native oracle functionality directly to the EVM, arguing that on-chain data feeds currently depend on external oracle networks bridging off-chain information into smart contracts. The talk examines what a protocol-level oracle primitive could change about how Ethereum contracts consume real-world data.

Speakers

Topics

From ETHCC 5, hosted by Ethereum France.

Transcript

yes okay hello guys my name is Stan kletko I'm the CTO of scale um today I'm going to talk about something really interesting and Oracle we have at scale a new generation Oracle which we just implemented released on our main net I'm gonna tell you the story how the saying appeared initially uh you know when you have a startup typically you don't have a like solve problems that they don't have you still solve problems that you really have and the story of this Oracle comes from a problem we solved for our system and then we realized that this same solution could be applied to many other problems and that's how this Oracle was

born uh so what is an oracle I I actually wanted to do something funny so I on internet I just you know there is like neural net and you can type whatever into the neural net and essentially I typed uh I'm a machine and I always tell the truth that's kind of a definition of the Oracle and that's how the AI sees the Oracle you know very pleasant face you know so that's that's the oracle uh first of all I just wanted to ask you guys question please raise your hand do you know what an oracle is like at least have a vague feeling right

uh does anyone know really really well what an oracle is can anyone Implement an oracle write a code compile okay I'll tell you it is okay there's one guy so it's actually not it turned out for us to be not not so complex although we did it the first time so first of all I'm gonna tell you about like typical oracles or like gen 1 oracles aesthetic Oracle is just something hopefully decentralized which feeds information into blockchain and typically it fits the same thing periodically you know something which is called a feed you keep on feeding the same thing in ninety percent cases of

cases this thing is a token price that's how people want to protect against Market crashes you know you have a collateral if the market crashes and the price goes down you're supposed to actually sell the collateral this actually never never goes well because at exactly the time Market crashes you won't be at work or will not be able to fit the data because the network is typically congested but that's kind of a different story so guys like maker synthetics are they many many many other guys use Oracle for this purposes just to report the the token price so we at scale when we started this Oracle you know our network is pretty complex because we have have an internet of

blockchains where at the moment have probably one of the largest ever sets of smart contracts in our Network many of them running on ethereum mainnet and when we started we pretty much have anything and everything in our Network so at some point we needed to have an Oracle and the reason we needed to have an oracle was that like moving money from one chain to another from ethereum mainnet to to scale chains and we need actually users to pay for it but when the user moves a token from one chain to another the destination chain doesn't know how much gas was spent on the on on the source chain so essentially the problem of transferring information from blockchains but in between blockchains and when then we said okay well we use

an oracle for this and we tried existing oracles and it just didn't work and then for our own basically purpose they created a different type of an Oracle and then we later realized that it could be used for other things and now it's actually running on scale mainly it so this is something that we called a dynamic Oracle a dynamic Oracle is where you can actually provide Dynamic real-time information about anything on demand so it's not like you're feeding the same information periodically into the blockchain it's more like a smart contract wants to file know something at this moment and you want this information to be in the smart code right that's what's meant by by being dynamic and then one huge application that we realized of these

Dynamic oracles is something which people now call so soul-bound tokens basically that's the idea that you have many nfts this nfts may be on different chains right and this nfts actually determine who you are they allow you to authenticate you they allow you to have some privileges in the apps you name it right but the point is that you are like sitting in your D app and this nfts are on other chains and the question becomes how does the smart contract know about nfts that may actually be stored on other chains and and that's where this Dynamic Oracle can be used Dynamic Oracle can actually tell a smart contract on chain a that the user has this particular nft on unchain B that's

one use of dynamic oracles and then as I mentioned many others kind of smaller users gas reimbursement prediction markets games whatever so now let's talk about how this so basically what our Oracle is first of all it's free you don't have to pay for it it runs on scale Network it's integrated into each scale blockchain it's decentralized probably secured as a mathematical model and under which you can prove security and it can retrieve any information from any web Json endpoint and also from ethereum mainnet and also from any from scale chain so it can actually pull information from a variety of sources so how does the Oracle work

the first step you have a client try it typically a client is a browser or mobile app and so the first thing that the mobile app or the browser needs to do is to request information let's say in this example you want to find out the current time right you want to uh so yeah you want to run from Real Time API you want to to pull the current time in a particular time zone and Pull and push this information into a smart contract so the first thing you you format Oracle request and it's kind of a Json request and you send this request into all nodes of of a blockchain so essentially your blockchain becomes also an oracle it's an integrated thing Oracle and

blockchain become glued together so each node of the blockchain gets this request this very simple request you just want to pull this information and then the second thing happens that each of those guys each of them sends the request so in this particular example There are 16 nodes in the blockchain so there are 16 requests the same 16 requests and then then what happens uh after each of them gets a response this node signs the response uses using its key and sends it back to the user so the user potentially can get 16 responses back although there's no needs to actually wait for so many responses because it's a very simple

mathematical theorem let's give you an example let's say you know that in a group of these people that we're sitting here five people are liars right and the question is you want to find out what the current weather is you need to 6p ask six people and if all of them give you identical response this will be correct result because out of 6 only 5 can be Liars so the one of them was honest and then you get got the correct response so basically it means that the browser on the mobile app needs to wait for tipler of some unidentical responses where T is the number of layers in the system the maximum number of the zones to Byzantine nodes in in this particular system that we have the mathematical

model is that one third of the nodes maximum five are bad guys so if you get six uh identical responses which are coming from the nodes then you know that the result is correct and then that's basically the Oracle result so that's how the Oracle result looks like you see it's on the right it's basically the result of what the current time is and there are at least six six signatures so of each of those six nodes so that's the Oracle result and the last thing you do you push now this down you have this result the current time you push it into the smart contract and then the smart contract can verify six signatures that's step number one step number two

the smart contract also verifies the time we have in every response we have Linux time because information can be stale right like the current weather is not the same as whether two months ago or two months in the future so Oracle result only means something if you know the time and there is sometimes Jitter allowance that a smart contract can make so the smart contract actually gets the result verifies the signatures verifies time and here you are you actually have the current time so in this kind of a toy example but you could actually get anything you can get current time you can get which nft a particular user has on a particular other blockchain you can get information how much money the user has pretty much any information which

can be pulled either from a centralized uh uh endpoint or from a blockchain and in addition to that let's say you don't really believe this trust this time server you could also average out you could say okay there are 10 centralized time servers in the world you could actually pull information Oracle results from all of them and then inside of your smart contract you can do additional averaging you know calculating the mean whatever so there's also a way to make things more decentralized by actually accessing multiple independent endpoints let's do Oracle so as I mentioned the Oracle is already running on on scale Network one additional kind of interesting thing about Oracle is that

there is also one thing which when you send the request you also add a pure w a little bit of a pure W that your browser computes and the reason for that is that we don't want to protect against general service essentially our Oracle is free but to send Oracle requests you need to actually provide some pow proof of work just not just to be able to protect against uh General series uh okay there's the Oracle so last thing I wanted to tell about scale the name coracle run some scale mainnet version 2.0 it's fully operational you guys are welcome to try it try it now so we have some improvements coming soon in version 2.1 on scale people asked for

in the first or edition of Oracle we had Json based results now people asked us for API encoded results just because CBI encoding is easier to use inside smart contracts and then you can get more info on our documentation dogs that scale Network uh that's it I think and I would like to thank you guys and if you have any questions [Applause] okay I think not asking you um were there any nuances for the

integration as it like regarding it being evm on scale as opposed to an oracle on the main net uh we actually the good thing about scale is that that uh we have this set of public keys so scale scale chain knows about all of the public keys of all nodes that the scale chain is composed of and that's why it's easy to verify the signatures but in general actually the funny funny thing about scale Oracle you you could actually use the Oracle for the chains like you you can get this result there are six signatures if you uh before that if you actually push the public Keys into your chain or into zero magnet this Oracle could also be used on a Serial mainnet if you trust the public keys so if one wants to do a main internet application

the only thing about one needs is to actually push this public keys from a scale chain to to the mainnet okay were you saying the pow field protects the nodes from being dust off the downstream Ur uh API service from bnos because if you've got like 10 000 nodes running and 100 users all requesting that API at once like how do you protect the downstream service from sort of being dosed yeah that's a good question so then I mean essentially the downstream endpoint needs to be cooperative right the downstream

endpoint needs to be accepting lots of requests potential is so this I I think it's kind of a thing which is a little bit beyond what what we can do we can just tweak pow a little higher I think but uh I think in we really need at least endpoints that are able to process a lot lots of requests but the interesting thing about this Oracle actually you could actually use it for many many interesting things because literally it could like pull information from anywhere on internet so you could do things like prediction markets like pool some news sources uh essentially anything from from Real World you can

you can put in pull into into a smart contract and high level how do you calculate T Bad actors you know so we've actually you know because scale by itself is a problem probably your blockchain so they have a pretty secure consensus our consensus uh is probably secure and the Assumption of uh less than one-third of the nodes being malicious bft Byzantine fault tolerant I mean the reality is like three t plus one so influence of 16 nodes T is equal to five so you have three times five is six plus one is 16.

so we already have a mathematical model for for the security of consensus so we just take the same model so if there if there are six uh nodes in the scale net which are malicious then they will be able to not only kill the Oracle but also get the chain to stack so that's why we're taking the same mathematical model which is basically the same mathematical model as the one which is accepted by th2 actually there's a mathematical proof of the fact that in the asynchronous model of a blockchain it's not possible to create a proof of stake blockchain with more than one-third of Byzantine fault tolerant nodes so it's actually this one third is the highest possible thing mathematically because there's a

mathematical proof if you have one more than one third they will be able to at least get it stuck the blockchain so asynchronous model means that your network can be arbitrarily slow you know so that in this model once you're the maximum if the network is has probably fixed latency then you can go from one shot to one over two but then the blockchain becomes less more less robust because if there is a period of a longer latency then the model completely breaks cool another um malicious nodes are they like slashed or punished in any way or just ignored

so actually it's a really interesting question so it turns out that you know in our blockchain there's no need to punish malicious notes or slash them because if there are one less than one third of them then they even if they are malicious they cannot they can do no bad the the the mathematics protects so we don't exercise notes because of this if there are more than one third then there's no point in slashing them because they will just kill the blockchain so you're listening on a blockchain so there's really no it's really no point of actually slashing if the blockchain is already killed so so that the slashing is really actually not such a powerful thing because especially like you know flashing is a post factum thing you

already did something bad and you're supposed to get slashed but actually by the time you're slashing someone they may be this thing may not be existed already so you're welcome thank you for the question all right time for last one last one all right let's do one last one thank you for the presentation hey one question why have you spent because a building an oracle is not an easy thing why have you spend a lot of time building an oracle instead of use one of the different Oracles that are already existing now they are just focusing on solve that problem I can tell you the story like when Steve Jobs was already really sick uh the guys from Dropbox actually got to

him and they wanted to sell Dropbox to Apple and so there was a conversation like it's a known story there was a conversation between Steve Jobs and and Dropbox guys and the guy said whatever three billion dollars oh Steve Jobs said like three billion I don't remember the number but three billion dollars and and the Dropbox guy said no four billion dollars and then Steve Jobs said no I'm not gonna pay for four billion dollars and then Dropbox guys like why not gonna pay for billion dollars and he said You know guys because what you have is not a product it's a feature you know file storage is it's not an independent product it should be a feature of larger thing so there are actually you know

it's excretionable it will we have all kinds of oracles at scale but there is a argument that some people want to have integrated Oracle integrated with inside of the blockchain because if the Oracle is integrated then if something bad happens it's easier for the Oracle to report results there were multiple cases where the market crashes oracles are trying to report the results because the collateral needs to be sold but that's the time when the network is is overloaded and congested and Oracle is not just not able to pass the transaction essentially don't report the result so there is there are arguments that maybe Oracle needs to be part of the chain in some cases yeah so but this is just the thing that we created also

as I mentioned because there were no solution like existing oracles didn't provide us that even to solve a problem of gas reimbursement so we just created because we needed it I think in general you know people will see some people use internal oracles a good thing about external oracles they're just like specially designed maybe a more better code whatever but time spent so I think that's going to wrap it up but thank you again so much for your time in the in the talk today thank you guys thank you very much