Smart Contracts Securely Connecting
ETHGlobal·Wed, Oct 9, 2019, 12:00 AM
The team from Chainlink explains oracles at a workshop at ETHNewYork. ETHNewYork was a hackathon organized by ETHGlobal and a team of hackers, developers and enthusiasts interested in building and creating in the ethereum ecosystem. ETHNewYork ethereum focused hackathon took place May 8-10, 2019 at New Lab at the Brooklyn Navy Yard. For more information visit https://ethnewyork.com/ and https://ethglobal.co/
Transcript
I'm gonna be speaking to you folks about chain-link and how it can help get rid of that horrible sound or doing that sound but okay so essentially I'm going to be speaking to you folks about Oracle's and the value of Oracle's in in terms of smart contracts and what it expands their capabilities to fundamentally I think the useful thing to just understand just so we have common ground to think through this problem is what you know fundamentally speaking the problem the problem is that you can't get access to data feeds so if you can't get access to data feeds you can't write contracts around the data feeds that have contractual outcomes right so what this basically means is that the only contracts that you can write today are the ones that know information that's already in the smart contract Network they're running in like etherium this means you can only write contracts about tokenization about token movement you can't really write contracts about anything else because if you you can't ask any theorem smart contract or smart contracts on any other platform to talk to a data source and since you can't talk to a data source it can't know what the data source knows and the data source knows that a market event happened that an IOT event happened that a shipment event happened and the knowing of all these different events and actually the events themselves are what the con what many contracts are written about right so like the multi trillion-dollar derivatives industry is written about market events the multi trillion-dollar insurance industry is essentially written about you know various insurance related events many of which are shown through IOT so the fundamental problem is that if you want to go beyond to organization you need this connectivity but you don't you don't have this connectivity out of the box this seems like a relatively technical group so you know fundamentally the reason you don't have that connectivity is that you don't you don't have a capacity for the miners that secure the smart contract state to go out and get data you probably won't ever have them to have that capacity because it introduces all kinds of security concerns so if we look at you know this question in historical context how would solving this problem help the space evolve so realistically the way the space has evolved is we went from vidcon multi signature has programmable money and then we went to protocol smart contracts which were these smart contracts that were built basically by interacting with smart contract but not with smart contract developers will do protocol developers so you had to get the protocol to add a new smart contract type that took anywhere from three months to a year between testing and deployment and everything else this is a you know us going from the only smart contract type as multi signature to protocol smart contracts was the very big leap forward in like 2012 and 13 this is something that got me very excited about the space and where we built some of the first decentralized applications then what aetherium did is it took us from this protocol smart contracts world and it brought us to the scriptable smart contracts world and that world is much more exciting because the capabilities of the types of contracts you can build are greatly expanded so instead of creating a new smart contract and have you know taking three months to a year and you having to interact with a protocol developer to do that you can now sit down in a week script up your own contract get it running with you know certain set of conditions right so this created a huge explosion in what people were able to do created a huge explosion and you know the useful capabilities that basically smart contract infrastructure was able to to allow people to build we think fundamentally solving this Oracle problem or smart connectivity is more contract connectivity problem will take us from just scriptable smart contracts that can be written about tokenization in the movement of tokens to fully integrated smart contracts that can interact with all the relevant data feeds and by interacting with all the relevant data feeds that means now you can build all of the necessary derivatives insurance trade finance all these other types of contracts you know probably 90% of the decentralized finance stuff that people are excited about all those types of things they need reliable inputs in order to get built right and so fundamentally we think there's going to be another another big shift from just scriptable smart contracts that can only move tokens descriptively smart contracts that can do everything else now fundamentally this is what we we offer as as a body of work in a project we we seek to make a very reliable secure middleware that provides inputs to data outputs the payment systems and eventually connections to other chains fun fundamentally in the process of building such a system we've come to the conclusion that what you really need from what's essentially a blockchain middleware is a highly reliable middleware so you need something that maintains the reliability of the smart contract as you expand what it does all right so we're fundamentally expanding what smart contracts can do from tokenization to these many other classes of smart contracts but as we expand what they're capable of doing we want to retain the unique property of a smart contract which is its reliability right so if you if you build a smart contract that's reliable and its state changes but then it's triggered by an insecure system that's easily breached or manipulated or stopped then the entire smart contract isn't really reliable and nobody's really gonna put substantial value into it this is probably why we don't see a lot of these more complex smart contracts housing a lot of value because what's really needed is both smart contracts they change layer like aetherium and some reliable Oracle liable blockchain middleware that allows you to make a reliable contract end-to-end now in the process of building this type of system we've arrived at certain ideas about you know what you should and shouldn't do I'm just gonna walk through one or two approaches how you can't approach this problem how you may not want to approach this problem and then you know a few examples to illustrate how those work so fundamentally the the approach that that doesn't really make sense to us is the approach where you have a single centralized Oracle because fundamentally that centralized Oracle can be taken very easily and at that point the reliability and the value of the system is very low right so it's the value of the system is only as good as the weakest part that people can kind of stop or tamper with or or make not work and fundamentally you have the centralized computation layer running on thousands of nodes you have the data sources which have been many around many of them around for decades and they have hardened like you know reliable systems and realistically you could probably would want to probably select multiple data sources if you if you were able to but the the real point of failure is this one centralized Oracle in certain cases is written it with closed source code in other cases one of the counterparties might even be you know one of the people involved in the transaction might even be running the Oracle and in that sense you know the reliability of the systems completely compromised because one of the interested parties in the tamper-proof peer-to-peer transaction can now completely influence it so fundamentally having a single centralized Oracle creates a multitude of problems and and basically I think precludes people from putting highly rely having highly reliable smart contracts that do more more advanced advanced types of computations around derivatives or insurance or you know these these very valuable kind of smart contract types which as I said earlier is probably ninety percent plus of the decentralized finance stuff that we are even starting to see today so the fundamental solution that we recommend to this to this problem is the same solution that smart contracts themselves benefit from so smart contract state is considered secure primarily because it's run on a multitude of independent node operators that do the same computation and secure that smart contract state so that's called decentralization in some circles it's called other things in other circles but fundamentally it's a few independent node operators doing the same computation and securing an agreed-upon outcome to the computation and then the state of that computation so fundamentally if if that is is the new security model that our space has created then logically speaking if we can apply that security model to the Oracle mechanism to creating you know reliability at the smart contract state-level and then creating reliability at the oracle mechanism level that's what you know fundamentally makes sense to us and I think things like this will get proven out more and more as for example a centralized Oracle fails and somebody loses a lot of money or something else happens where a singl single Oracle doesn't doesn't properly fulfill its obligations and basically what you know I think the way it's gonna look is there's gonna be more and more complex more contracts some of them are gonna fail because they didn't they didn't have a reliable Oracle set up and it's gonna look something like the Dow right people are gonna be before the Dow happened there wasn't really an audit industry like before the before the Dow hack happened and people were really worried about smart contract security auditing you're smart contractor paying people a lot of money to do that wasn't like a huge huge it was an industry it wasn't a huge concern for a lot of people and so realistically the the real security risk and all these scenarios is the Oracle and the fundamental logic of our space is quite simply let's make a bunch of independent node operators verify the same computation so fundamentally this approach should if the if the logic of what secures the smart contract state is valid then that logic should apply to securing this this this part of the architecture of the contract as well and then once you've decentralized out the Oracle mechanism then you can begin decentralizing the you know the multiple data providers then at that point you can have multiple data providers you can come to averages or you can verify multiple temperature readings or you know any any collection of reliable inputs that you want to generate once you you kind of move outward from the contract in terms of the reliability you you need to guarantee now yeah so this is I mean this is what we've built a chain link we we have a booth right there we have integration engineers here you know we have a lot of folks that can answer all your questions so if you're interested in in applying this decentralized approach of I've made my smart contract able to access external inputs and I've made it more reliable through through the application of decentralization then we can we can definitely help you we we do that all day long I'm gonna walk through a few examples and then just dive into some other ideas about how how system like this could guarantee a greater degree of security so the first example is a very simple one it's for something called the futures contract so a futures contract is a very simple derivative it basically needs to be settled every day in fact a lot of the dphi stuff that's you know named very exciting things is fundamentally a lot of it is futures contracts and and various other derivatives just kind of renamed and fundamentally what what would you need to settle a derivative like a futures contract is you need a price you need a market price to settle it you know at the end of the day or at a certain time line or when a user wants to settle or or however you want want that to work in it's like settlement specifics and so in this example we fundamentally have three data providers feeding in relevant market price state into three Oracle's and those three Oracle's provide a more reliable source of market price data to the contract so now you have a large degree of decentralization at the contract level you have a certain amount of decentralization at the Oracle mechanism level and you have a certain amount of decentralization even at the data origin level right and this from from the perspective of getting a contract that is externally aware and reliably triggered end-to-end this seems you know relatively more secure than then some piece of closed source code and a centralized Oracle or some other things so this is this is this is the fundamental idea and all of this that you see here we actually have all these data providers already set up and we we we already have a system Oracle's that you could make exactly this work in a matter of minutes so the next question that people commonly run into when they make some kind of financial contract is okay I have my financial contract has learned about a contractual outcome its assess the contractual outcome that's triggered a state change now that state change results in payment so fundamentally the other piece of value that the chain links provide is they allow smart contracts to pay in various formats we actually don't we don't have huge preferences about what formats it's really not our place to to tell specific use cases what formats they want their users to Paden I think the thing that's important is that firstly contract smart contracts can be reliable in their assessment of outcomes and secondly that they can pay in the places that people that users want to receive payment right if if a user can't be paid or a settlement can't happen in a manner that a counterparty another participant in the contract once that's a big hurdle right like we we've had this problem for years when you know good luck four years ago or even today convincing somebody to pay an invoice automatically pay an invoice for the shipment the frozen goods in Bitcoin you know nobody wants to pay you know hope to have like the eight million dollar pizza think great where they paid a lot of money and the price went up and they got an exchange fees and everything else so it's one other way to look at it is how do we get reliable inputs and how do we provide the type of outputs that contracts want and need to become useful right so fundamentally what what what we seek to do is we seek to accelerate the usefulness of smart contracts by enabling them to know about more events that they can be written about we think the majority of smart contracts that I'll be written over the next couple of years will not be about tokens they will be about other events other than token movement and then it's you know how do you how do you pay the the appropriate part of the appropriate way another example that shows maybe not one data source being highly decentralized and made more reliable but a multitude of data sources in a more multi-step contract is something like frozen goods shipment insurance so let's say you're shipping frozen goods from somewhere and they need to remain frozen in order for them to be sellable and then you have an insurance policy ensuring that if they don't remain frozen you are made whole right this is a very real industry this is how a lot of frozen goods actually arrive where they get consumed basically so in this example you need GPS data of the ship you need the IOT temperature data of the container died ot security data the container hasn't been breached as a condition of the policy there's customs API data to show that okay it's it's left it's traveled frozen it's remained secure it's cleared the customs of the relevant country and then it's also been delivered to my warehouse so in this case to build to build such a contract the focus here really isn't on decentralization even each of even though each of these could have a degree of decentralization applied to them it's really more to illustrate that there are there's also a need for a multitude of inputs multitude of different inputs such as GPS data IOT data governmental data about the state of a contract other other data about receipt or you know sending of goods things like that and then likewise the same situation appears where okay we've we've had all this happened but now we need to pay the relevant people we need to pay the supplier maybe we need to pay the policyholder depending on if you know the goods were or didn't remain frozen if the containers you know refrigeration system failed so all of these contractual outcomes then need to be resolved in some form of payment so fundamentally this I mean this kind of just illustrates there's a multitude of different inputs and this is realistically a contract you could you could also build today with a chain link and without some kind of Oracle or blockchain middleware you wouldn't you simply wouldn't be able to build this contract which to me is relatively interesting because there's a you know something is assessing the state of the world there's a lot of data proving the state of the world and then somebody's getting paid and and everybody's looking at that and at a system and saying this system is reliably doing right by me as a counterparty right that's that's I think in in my opinion what was the the value that I was hoping to see from this space from from kind of the beginning yeah so fundamentally would we seek to do is to generate a large multitude of these inputs and outputs we we seek to provide basically a large marketplace a huge collection of these pre-made inputs so the examples I just showed and many others built as individual chain links we already have many of them built we're building more of them and fundamentally we prioritize the ones that people tell us that they need so if you have specific chain links or specific data sources that you want for you know I use case you're hacking on here or a use case you're you know building elsewhere you should let us know and we can literally in something like 24 hours probably turnaround something that works for you depending on the complexity of the API in the system we we need to integrate with yes yes apparently we do have a PayPal one we have a multitude of them and we have more and more appearing every day we're gonna systematize this and we're gonna have like a system to to to to encourage people to submit their requests and and get back a chain link in in in a relatively short time span even faster than they themselves could build it and so on so so fundamentally yeah so there's an example we actually do have that one the next goal that we have is that we wanted an extend all these inputs to various smart contract chains those could be shorter chains and aetherium those could be any any other collection of environments and you know fundamentally we think Oracle's extend in the value they provide to every environment we're writing a contract and then the the really the other important thing that we seek to do as a project is to make a very secure Oracle mechanism and for that we use a defense-in-depth approach the the use of a defense-in-depth approach means that even though we're fans of decentralization and we believe in it and we think it is the fundamental new security model being proven out by our space and practice which is very exciting because it has you know various changes to the security of systems it has changes to the economics of how society works in our contracts function there is still a lot of space to lay around other security approaches on top of decentralization and fundamentally yeah so we believe layer that that layering on multiple other security approaches allows us to build a more secure Oracle on an individual basis that can then be decentralized to reap the benefits of this decentralization security model how we do that in in you know in in the most immediate version of a defense-in-depth approach is we use something called trust execution environments trusted execution environments like Intel SGX are supposed to harden individual node operators and and run code in an environment that even the node operator themselves can't know what they're running all the node operator could for example do is stop acting as an oracle step stop returning results at which point it becomes immediately obvious that they are very bad Oracle and you know they won't get future usage and they'll be kind of you know not not used very often so fundamentally trusted execution environments provide smaller trusted computing base and what that basically means is that the attack factors are much smaller so it's not a perfect technology and it doesn't solve all the problems on earth but it certainly allows you to isolate yourself from the majority of existing exploits that rely on getting in through the hypervisor some kind of virtual machine technology or the operating system and and fundamentally it isolates those those exploits away from the code that you're running while providing confidentiality and other things I mean if you're if you're interested in learning about it you're welcome to read up on it it's something we're implementing on top of decentralization there's certain ideas that these things are mutually exclusive like you can't have the centralization trusted execution environments and we don't exactly that doesn't really add up for us we think that basically that's that's the core idea of this first approach you know in our defense-in-depth security strategy for the use of trusted execution environments we used something called town crier town crier has been on production for now I think approaching two years on the etherium network without any security issues and I think it was the first successful use of trusted execution environments on production maybe for anything but but definitely for Oracle's it's made by a great great group of people from Cornell and ic3 and we were lucky enough to join the two projects to kind of acquire the town crier and bring it in to chain-link as our approach to trusted execution environments now fundamentally what the the environments provide is protection of computation from node operators so this means the node operator himself doesn't even know what he's computing it provides confidentiality so that that's another version of them not knowing in that we can send them requests to get data and they might not know exactly what data they're getting or what it's being used for or how it's being used so you can have an Oracle mechanism that preserves certain levels of confidentiality and even probably greater levels of confidentiality in the contract itself and then if you're gonna manage credentials to pay people you know credentials like passwords that control money you would ideally want them in a more hard environment if you if you could have it and so in that sense intelligence is also useful now I'm just gonna walk through a simple example of how you know combining the centralization trust the execution environments can fundamentally benefit relatively simple use case so for example yeah so fundamentally what I think is is useful is that to look at is that lottery contracts that a lottery contract needs randomness it needs highly reliable randomness to be considered reliable right so the contract is just a resolution of who wins based on randomness so the contract fundamentally has two parts it has the contract itself that you know the state change on chain is guaranteed to be reliable because state change is Unchained are considered reliable basically and then you have the input which triggers the state change so literally you could say 50% or even more of the contract relies on the generation of a reliable input like randomness so in our case what you can do is you can actually run an existing library for randomness in a trusted execution environment that can return the necessary randomness and then that randomness can be returned back to the contract right so this is already an improvement in how another system that generates randomness might provide that randomness to a contract but realistically I think the the main idea is that even if you have a great system that generates randomness in a more secure hardened environment that's isolated from the majority of exploits then it is better within the security model of our space to have multiple such environments run by independent node operators providing that input so if you had a lottery contract that had increasingly large amounts of value and you wanted to have a guarantee that that value was secure it does make sense that even if you were using a hardened environment you then would benefit from the central as well and then likewise there's the multitude of inputs and outputs so now the smart contract in the in the case of a lottery probably needs to pay somebody something and expanding how it can pay and where it can pay is is is a great improvement so yeah once once again we're generating a multitude of these inputs and outputs we come to these hackathons to work with folks like you to see how we can help build more useful applications quicker together with you and so if there's some category of chain links or inputs or outputs that you would find useful here or you know in your daily work we definitely want to hear about it we're very open to feedback we have a booth booth right there at the entrance and we we we definitely would want to hear how you're hoping to what inputs you would find useful and outputs fundamentally we then you know hope to secure those inputs and outputs the right way and that's really so there's just two two sides of really what we provide it's securing the inputs high at a high level of reliability and then providing a multitude of inputs and outputs for for the security side we we welcome a lot of feedback from the security research community for the generation of inputs and outputs we really need your feedback for what inputs and outputs you find useful so great that's that's it for me yeah great yeah any tackle we have a booth right there we have integration engineer folks Thomas actually right here is one of our English engineers he can definitely answer any technical questions they're here you know unless unless you guys have any questions now anything I can we can answer no the whole point is they're not yeah the whole point is they're not the whole point is that eventually chain link the chain link the entity will not will ideally be not needing to run any service at all just like the etherium foundation doesn't need to run notes yeah yeah there is people people pay for requests and then the note operators provide deposits to guarantee outcomes it depends on the request there's really a lot of variation in terms of how requests actually end up working but that's the fundamental idea in many requests yeah okay cool great thank you very much everyone [Applause]
Automatic transcript — names and jargon may be misspelled.