Decentralized Oracles: Reliably Triggering Smart Contracts using Decentralized Computation and Trusted Execution Environments

EDCON 2019 · 13 Apr 2019 · 11:34

Daniel Kochis explains the oracle problem and Chainlink’s approach to combining independent data providers and node operators. He then introduces Town Crier and trusted execution environments, using private credentials and off-chain computation to show how smart contracts can interact with external systems while reducing data-source risk.

Speakers

Topics

From EDCON 2019, hosted by EDCON.

Transcript

I'm so next up we have Daniel coaches who is Europe here ah who is global head of business development at chain-linked and he will be talking about decentralized Oracle's hi everyone thanks for showing up today and taking some interest in chain-linked and what we're building we're gonna be talking about decentralized Oracle's and sort of their intersection with trusted execution environments to sort of set the stage of sort of the Oracle problem what exactly it is having some issues with the slides here oh cool

so with the current state of smart contracts there's a connectivity issue that they have natively they can't communicate with off chain endpoints api's and payment systems and with sort of the advent of aetherium and all the different use cases that we've been able to approach with the scriptable smart contracts that a theory impress you know we really need to access those different data points and payment systems for smart contracts to have meaningful events in the in the real world and so the way we approach that and solving that problem is through blockchain middleware it doesn't sound that sexy but it is what it is and what that middleware does is that it sits between

or the smart contract code executes and then those off chain endpoints and payment systems the other thing that it allows is for cross chain communication between different blockchain protocols and so when you're writing these smart contracts what you want to consider is end-to-end reliability so you've got this deterministic immutable record for smart contracts they're going to execute as they should as long as they have the inputs that they need to execute and so it doesn't really make sense for them to be you know completely decentralized hosted on thousands of nodes and then it's relying upon a

single data point or node for someone to take out so what you don't want to do is have a centralized Oracle that someone could come and attack as a single attack vector what you really want to do and this is our approach here there's a few levels of decentralisation that we bring to the game ones at the the node operator level so let's say you've got a smart contract that needs a single endpoint or data point what's called the price of some cryptocurrency you could have multiple independent third-party node operators query a single endpoint let's say you like really like coin market cap for some reason and then have them do a commit reveal scheme and aggregate that data on

chain if it's all the same then you can feed that into the smart contract but you can take the decentralisation a bit further you could have multiple data providers that are independent so let's say you know coin market cap crypto compare great new coin there's a ton of them and then you could layer in the decentralisation of the node operators on top of that so you're getting to centralization at the data level and then to centralization from the node operators themselves so a real-world example of this you've got a delivery for goods smart contract you can actually some of the the nodes and sorry the Oracle's that I've been talking about are actually live on our site and if you go to Doc's don't link you can

see them they're so easy post is a carrier tracking API so you have to track where a Goods being delivered so upon delivery you know you can feed that confirmation into a smart contract and then you could have a redundant data feed for that as well which is where like flight stats could come in most of the smart contracts and the in the world today are still denominated in fiat however they're being settled in a cryptocurrency so in lines with the example that I was just talking about with the different sources for cryptocurrency to make sure you have the right exchange rate you're going to need that to calculate how much cryptocurrency to transfer between the the smart contract parties

when something you know let's say it's a thousand bucks for delivery you need to know how much if the sense you need to know the value of eath so the ultimate goal of our body of work is to create hundreds and hundreds of these nodes and to make it really simple for smart contract developers to come in and essentially build stuff the way that we've traditionally been building things for instance let's say if you were trying to build uber if you were to try to build that full stack you'd have to build your own GPS system text on this SMS payment system and it'd be a much more complicated process than coming in just writing your code and then connecting to

an SMS API a GPS API a payment gateway it makes things much easier and so that's where we come in we want you to be able to build really meaningful smart contracts and so come in we've got hundreds of different data points and payment systems that you can integrate with and if there's something that you want it's really easy to come to come to me or anyone on the team and we can get them spun up so so far this is sort of the the software approach that we have and so that the next layer of what we can do we sort of called a adaptive defense approach is adding an trusted execution environment with them you've got sort of these independent computation enclaves

where you can have a bunch of code operating in their smart contracts can operate in there and we've been working with Cornell and ic3 where we have acquired town-crier in October of last year and we're taking over the project it's been developed by re Jules who's former chief scientist of RSA and a lot of other very smart academics we're running it on Intel SGX from talking to those academics you know there's a there's a few different trusted execution environments out there but everyone's been being on sjx the most and that's the one that we've chose to go with one because it works it's been in production for nearly two years

providing data for gasps token and then you know here's sort of a an approach to the approach of town crier and some of the benefits of it so you know a current attack surface today someone could come in and look at sort of the hypervisor or OS level however with these new T E's it minimizes that and the attack surface is much smaller than it traditionally has been and so just to take a look at it it works pretty much like a current smart contract does you've got a user requesting contract that talks to the town-crier contract you then have smart contract code running in Enclave there could be a few different options of

what's in there I'll go into a few but in this one it's talking to lots of datacom and talking about a bunch of data points and then it feeds that back into the smart contract so there's a few different levels of confidentiality that you get using these trusted execution environments you've got no one can actually access what's going in on them going on in them so you've got multiple independent third parties operating these nodes they don't actually know what's going on in those enclaves so everything is private this is really good for managing credentials for payments you know those credentials are

essentially worth whatever is in that like payment for that smart contract or like your bank account so it's great to have them confidential and then I also can control your private keys in there for signing transactions across chains and then moving along we've got private smart contract code execution off chain along with smell sorry scalable smart contract code execution on chain so there's a sort of a good example here would be threshold calculations let's say you've got a smart contract that an option or derivative with the underlying asset being crypto currency so it's going to be really inefficient and costly to continually send the price of

that underlying asset on chain let's say you want to trade its eath when it hits two bucks you know sending it on chain every minute it's gonna add up so you can actually have that code running within the trusted execution environment pinging those off chain endpoints and you don't have to worry about those gas costs so once it hits 200 bucks it'll send it on chain and so the the private part about that that's really good and I think it's been talked about a few times is a front running so you know if you've got an eight-figure smart contract for this derivative you don't want people to front run it you can actually have that code running in there and as opposed to sending oh yet 200 bucks on chain of the smart contracts it executes you can just send a binary result on chain so no one

knows what that threshold point is for your for your derivative other thing it so it's not just some other computation that can happen in there you know you can have trusted libraries execute in there given that a good chunk of the main net traffic currently is lottery contracts I can just go through a quick example of that so you've got that lottery contract there with the blockchain middleware or chain link or an Oracle operating there with the trusted execution environment you can have you know a tested ran in this library that's operating within that SGX Enclave and then it can send that data back on chain into your smart contract so combining that with the the software

level of decentralisation that I was talking about with the multiple independent node operators and then the different data sources or you know computation running in those enclaves you start to get a more reliable decentralized oracle network and so just sort of to summarize that you know I was talking about end end reliability earlier you know if you don't have that reliability all the way through the data source and origin through payment you know it doesn't matter how decentralized or deterministic your smart contract code is if you've got those weaknesses and then you know really the ultimate body of our work which is what I was

talking about before is creating all these different chain link Oracles and nodes to make it really easy for developers to come in we're actually focused on you you're our end user we want you to build meaningful smart contracts you know that have real-world events triggering them and having meaningful outputs and then if you want to check out some of the Oracle's that are currently live you can go to Doc's chain link and they're all listed there and feel free to find me after the conference if you've got any questions thank you [Applause]