# TOKEN2049 - Connecting Smart Contracts to Off-chain Data - Sergey Nazarov (Chainlink)

- Speakers: Sergey Nazarov
- Channel: [TOKEN2049](https://streameth.org/token2049)
- Date: 2019-10-09
- Watch: https://streameth.org/watch/yt-BvySkHcq1ac
- YouTube: https://www.youtube.com/watch?v=BvySkHcq1ac

## Transcript

so hi everyone uh we're going to be discussing a very specific problem that's uh limiting what our space is capable of doing so that problem is how do contracts go beyond tokens right contracts right now are used for tokenization the smart contract uh you know scripting languages and networks like ethereum are mainly used to generate and move around tokens but the reality is that there's a lot more functionality in terms of what smart contracts could be doing and that functionality essentially depends on those contracts having access to data but the the fundamental problem is that uh smart contracts right now on basically all the public and and private chains they cannot access data feeds so this effectively means that smart contracts can't know about Market events for financial products they can't know about Insurance iot data for insurance products they can't know about shipment delivery or a bunch of other really important points for trade Finance products so essentially until smart contracts can effectively talk to Market data events data and different types of payments they're going to be relegated to tokenization and the point at which smart contracts can use data feeds to know what's going on in the real world and to affect real world events of value is the point when we go beyond tokens and into a whole new world of you know decentralized Finance decentralized Insurance decentralized trade Finance um and in reality this is the this fundamental problem called The Oracle problem or the smart contract connectivity problem is at the core of of of why uh decentralized Finance centralized Insurance decentralized trade Finance aren't nearly as far ahead as they could be so just just to put this in a historical context uh where we all started out back in like you know 2009 and then into 11 we had multi- signature functionality in Bitcoin so this was the feature set that you had to work with then in around 12 and 13 you had protocol op code based smart contracts appear so this means if you wanted a smart contract that did something other than multi signature you had to go to a the developer of the protocol and you had to get them to manually update their protocol then you had a shift from this tedious process of adding another piece to the to the protocol that that you you know the one that you wanted to use to scriptable Smart contracts so scriptable smart contracts are a very big step forward in our space and a lot of the credit for that goes to ethereum and you know they've done a great job of moving the space from it takes literally months uh to maybe even a year to get a smart contract into a protocol and get it working to down to days or now even hours to script up a a piece of smart contract code that runs on decentralized infrastructure so the next significant shift in our opinion is the shift from these scriptable smart contracts that focus on tokens to scriptable Smart contracts that are connected to all the market data events data payments capabilities and and and essentially scriptable contracts that can be written about events and scriptable contracts that can make events happen because once again until until we get to the point where that's possible we're going to be stuck in a world where smart contracts today they cannot talk to data feeds right they they cannot know that a market price changed uh they canot know what the Bitcoin price is for a Bitcoin derivative they cannot know that an insurance event happened from an iot data feed all of all of these inputs about something actually happening in the real world are inaccessible to them so then the question becomes how do we solve this this significant problem that's holding back what our space can the value the large amount of value that our space can provide essentially the the answer is blockchain middleware so what you need is you need middleware that connects external data feeds external payment services and also various blockchains uh to core uh smart contract code so essentially you need to generate the connectivity that would allow smart contracts to do more than tokenization right that would allow the smart contract to know about Market events iot events trade Finance events and that's uh that's how you get get past this problem now once you're getting past this problem you you want to be sure of of a few key points one key point is that you you value the smart contract because it's reliable right the the value of a smart contract is it's the most reliable well that's a big difference sorry okay maybe I should have been doing that from the beginning um you you value the smart contract because it's the most reliable form of digital agreement right there's no other form of digital agreement that provides the same guarantee that something will happen in the contract right so if I own a private key and I have a Bitcoin attached to that private key that's it I own that Bitcoin and it's extremely reliable extremely deterministic that same value is the value of smart contracts for more complex use cases and if we want that value to to to actually exist for these more complex contracts we need to make sure that that value extends to how they're triggered and how they settle right so like lead Architects cios people that actually deal with billions of dollars in contract value on a on a digital agreement kind of level um they care if the whole system is secure it's not it's not as important that a part of it is is secure and then another critical part is insecure so if if we want to expand the functionality of smart contracts outwards to to more external events more spheres of spheres of value we need to also make sure that as we we add the add that capability that the overall reliability of the smart contract remains high if the reliability plummets nobody's going to put real value into these complex contracts so this presents a fundamental challenge of how do we expand all the inputs and all the outputs that smart contracts can be connected to and how do we maintain their reliability at the same time now the fundamental way to look at this is to just examine how we wouldn't want to do it and then the approach is to to solve this problem so the way we wouldn't want to approach this problem is we we wouldn't want to have a single centralized Oracle because that Oracle is very easy to take out right the value of a smart contract is based on the fact that it has high redundancy and that's why we trust the state change and that's why we trust that that contract is highly reliable now doesn't make sense that you value that piece of the contract and then you have it triggered by a single centralized node your reliability just went through the floor right so this this model doesn't in the logic of our space this model fundamentally doesn't doesn't seem to work the the very simple logical solution to that is just just the way you have decentralization and you gain reliability from decentralization um by having multiple nodes processing contract code you can have that same level of decentralization at at the Oracle level so at this Oracle mechanism level of I need to reliably verify an input in order to make sure my contract is reliably triggered and then then you can also decentralize the various inputs into the contract a simple example uh you know just to put this in more context would be let's say I have a payment for delivery of some goods and my contract is really reliable and really efficient and it's going to automatically execute and generate and and and have payment happen so I probably want multiple data sources multiple pieces of information proving that delivery happened if I can have that happen and then once I want to pay I need market price data and I probably want to make sure that that market price data is highly reliable because the the reliability of that data will determine if I'm accurately paying for the goods I received and then I want to make sure that I'm able to pay in the relevant formats so all of this input of critical data about contractual events input of data about making sure the contract pays properly and output of relevant uh payment methods is is all something that a good piece of blockchain metalware middleware would do so the the fundamental goal of our of our body of work at chain link is the the generation of this middleware in a way that is secure and reliable and also provides a multitude of inputs right so a large multitude of inputs being available to developers will increase the velocity at which they can build right the speed at which developers can build today is very low because if they want to connect to a data feed like if they want to if they want to build something something like an Uber and they want GPS data and they want to send an SMS message and they want to do payments if they try to build that in today's environment they can write the core code but then getting connected to all the relevant services to actually have an application that provides value can take you know weeks months probably longer and so the the other big value of of having a good I mean the first gating issue is secure middleware and then the second issue is how do you create an abundance of building blocks of inputs and outputs that people can combine with their core code and in combining that with their core code they're now able to build a a greater amount of applications it essentially massively expands what is what what developers can build right like what what happened in our face space so far we we went from Bitcoin multi- signature to like some early version of color coins to to a scriptable token based system and the second the scriptable token based system became good enough the second that feature set was actually usable people generated a bunch of tokens right so all the the the capabilities became available and people generated billions of dollars in value on these systems and and and that's what happened right so logically speaking the next the next step in the evolution is if you look at the features that blockchainbased contracts smart contracts would benefit from the next set of features will also create a another generation of contracts right as you as you do give developers capabilities to build more things if they can actually build them they then build them and some of them live and succeed right so in in our opinion the next big stage in in the development of our space is one where developers go from I've just built a token and I've moved it around to maybe I've built a Smart Security right that reacts to Market data maybe I've built a derivative maybe I've built a decentralized insurance product or a trade Finance product and because I've been able to build it in days instead of months I'm I'm able to iterate and I'm able to actually get a product out that people use and and once our space gets there that's when the the amount of value that that our space generates goes from just tokens to all the for forms of digital agreement right because right right now the fundamental issue is that if if you go to a bank or an insurance company as we very often do and you talk to them about smart contracts your competing against centralized digital agreements and centralized digital agreements they can talk to data and they can send payments however the user wants and and they have this you know they don't have the reliability feature set that we value but they have this other feature set of of being able to react to events and generate valuable events right so that that means that in reality we we we as a space as a technology went on one dimension to a very large degree but then there's another dimension that's a gating issue for for for usage for these more complex use cases and we we have to win on both so we're already winning on on the reliability as as a digital agreement and I think I think once we start also winning or at least having parody with h affecting relevant value and reacting to value out in the real world then the the amount of contracts that are generated uh about topics other than token Will Will just that'll just go vertical because now finally just the way tokenization went vertical when the features arrived it'll this will also go vertical now there's there's a few other points about you know how you use trusted execution environments and and uh how that overlaps with decentralization but I'm not I'm not sure we have exactly enough enough time for those so I think the core uh the core idea to keep in mind is that there is a very important issue here of how do we get the space from tokenization to all the other digital agreement types that house you know trillions of dollars in value uh in our opinion the answer is you need developers to be able to build those agreements and then those agreements will exist on our space's infrastructure uh and that depends essentially on on those agreements having the relevant inputs and outputs so I think that's maybe that's the core idea where we'll we'll we'll stop at this point um I don't know is there time for questions no time time just just one question if there is a question uh yep just what do you do to ensure the reliability of the or right so the the question is what do we do to yeah I repeat the question now I finally learned that lesson um uh what do we do to ensure the reliability of the oracles um so there two there's two sides to it one is decentralization and then another one is um trusted execution environments so we use something called town crier so town crier um uses Intel sgx and then these trusted execution environments have a whole bunch of positive properties around confidentiality and reliability and essentially what they can do is they can even do things like generate highly reliable Randomness and so there's there's really two trust models the First Trust model is decentralization and then the second trust model is trusted execution environments like Intel sgx um I think one of the unique properties of our approach is that we don't myopically focus on on on one or the other at the core we have decentralization but then on top of that we layer on things like trusted execution environments and what that leads you to is it leads you to a system where if you want to consume highly reliable data using multiple approaches you can do that you can consume those those approaches like trusted execution environments but then the real benefit is you can consume it in a decentralized way so uh those are the two main approaches and then on top of those approaches there's things like zero knowledge and then beyond that in a in a very early stage of research is like homomorphic encryption so the the right answer is is if you're making a secure middleware you want a defense in depth approach where you apply multiple multiple layers of security for us those layers are decentralization then trusted execution environments and then we're we're we're looking at two or three other layers that can be applied as the research you know gets there uh does that great okay wonderful so I guess uh thank you thank you very much
