ETHParis: Securely connecting smart contracts to off chain data and events
ETHGlobal·Wed, Oct 9, 2019, 12:00 AM
ETHParis workshop: Securely connecting smart contracts to off chain data and events. Sergey Nazarov explains and discusses how smart contracts interact with off chain data sources for developers and hackers attending ETHParis. ETHParis took place in Paris, France, as part of the ETHGlobal series of ethereum focused hackathons. For more information go to ethglobal.co March 9, 2019 at the coding school 42 in Paris, France
Transcript
okay hello yes okay I just stand yep hi everyone so today sorry about my voice has just been a lot going on I've been kind of talking to a lot of folks so my voice is kind of at its limit so I appreciate your patience that my voice has actually gotten worse rather than better yeah so today we're going to be talking about Oracle's and the solving of a very specific problem for smart contracts the problem is that smart contracts on networks like aetherium and all its different variants including you know various private variants public variants they cannot speak with data so if a smart contract can't talk to a data source then it can't know that something happened it out in the real world and if smart contracts can't know that a contractual event occurred and that smart contract can't be built so if if you want to make an insurance contract or some kind of financial product that relies on market data or you want to make something for trade finance where you recover land ship and shipment data or you want to make any of the other very interesting various smart contracts that require an external proof of performance that they need to know that something happened out in the real world in order to exist at all until you solve what's called the Oracle problem you can't get that data to the contract what this effectively does is it makes it so that the contracts that can be built on aetherium and a private variants all the public variants of aetherium the thing the thing that this means is that the contracts you can build on aetherium today are tokenization contracts you can build tokenization contracts because those are the functions you have out of the box you have the ability to make tokens moved around private keys and that's what you can do but you cannot until you solve this smart contract connectivity problem or Oracle problem connect to sources of information that proves something has happened and that that's greatly limiting for what what this technology can do in our opinion now just just to put in context what what could happen if this problem was properly solved we can look at how you know how this piece has evolved and how it might evolve if this problem gets solved so the way smart contracts have evolved is they've gone from they've gone through a few stages one of the first stages was going from you know multi signature signing in something like Bitcoin that was considered the smart contract in something like 2013 and then you went to protocol / opcode based smart contracts where you had to speak directly with a protocol developer in order to make any type of new contract so this means you couldn't write your own contract code you had to go to a developer that made the protocol you had to tell them I want a new smart contract in your protocol as part of your protocol and then I need to engage in a 3-month cycle and then another three months testing cycle another three month release cycle and maybe I'll have the smart contract I need you know anywhere from three to nine months now what what aetherium did that that was genuine that is genuinely very impressive and has moved the space forward to a very substantial degree is it took us from these protocols - up code-based smart contracts to these scriptable contracts now that was a huge leap forward and features was a huge leap forward in what people could do what developers could build essentially that the roadblock of I want my core smart contract code to do X went from I need to talk to a protocol developer to I need to sit down and either copy-paste somebody else's contract code or write my own in a week and that has created this like explosion of features and use cases and value mainly focused around tokens so that was a huge huge leap forward which aetherium has done done done a great job at moving forward and initiating moving forward and you know they serve a lot of a lot of credit for that the the next stage which logically makes make sense to us is a stage where you have these scriptable smart contracts where people can make whatever smart contract they want they can code whatever core operations they want to represent their application and now the scriptable smart contracts can also interface with relevant events essentially they can interface with relevant data input events that prove that something happened in the real world they can interface with relevant payment events such as payments to somebody's bank account or payments on another chain and this ability for this scriptable contract which anybody can write to do whatever they wanted to do and then the ability to get that scriptable contract beyond tokens and into the world of I'm reacting to market data I'm reacting to an IOT device that tells me something happened relative to insurance something happened relative to shipment and then being able to also affect things in the real world opens up once again an entire and an entire huge massive collection of capabilities for developers to build more and I we already know they're doing this and we're what are what our project focuses on is solving this problem so our the entire goal of chain-linked is to solve the problem of how does how do we get how do we how do we go from scriptable contracts focused on tokens descriptive of contracts that can do everything else that can you know that can do things in the securities industry and trade finance and insurance and whatever whatever whatever you want them to do they can now do and this is so this is what we're focused on essentially the solution to this is a blockchain middleware so it's something that sits between the off chain world and the unchain world for both transmission of data into the contract the transmission of commands from the contract to payment systems to various various other services that it wants to make an effect on and the ability for the contract to affect changes in other chains essentially all of this is enabled by what's called a block you know technically all the blockchain middleware also known as an Oracle and we call it a chain link and that's that's what we work on now I think the key point when considering you know at a very high level when considering yeah excuse me about my voice sorry I don't mean to make this this painful yep maybe that's better excuse me the the key point is reliability the reason that reliability is the key point when it comes to Oracle's and blockchain middleware reliability security is that this is the key feature of a smart contract so the key feature of a smart contract is is its ability to provide the guarantee that a state change will happen if a smart contract gets an input such as a signature let's say it's a Bitcoin multi-sig the Bitcoin will be transferred and in the UT X amount allowed to the relevant addresses right that's unique there's no other form of digital agreement that does that and then if you if you move that on down to to more complex contracts like the etherium smart contract they provide the city they supposedly provide the same guarantee of I have extremely reliable digital agreement now if we want extremely reliable digital agreement that has this expanded set of connectivity features in order for us to build more interesting more useful decentralized applications smart contract applications whatever you want to call them if if we want this and if we want this and we wanted to actually be something people put value into we also need to guarantee to provide the similar guarantee right so now the guarantee expands beyond the contract and it expands to the systems that are included in generating this externally connected externally triggered contract right so this is this is a fundamental core idea where it's it's based on the simple fact that you know that I've tested in practice a lot of other people that build these more connected contracts have tested in practice in that nobody cares and nobody wants to put value into a contract that's partially secure nobody really nobody will put value into a contract that's secured in like the middle stage but it isn't secure at some other stage if somebody's gonna put hundreds of millions actually billions of dollars into this deterministic highly very difficult to rollback form of digital agreement it needs to be secure and reliable and and that's just that's just the simple fact of what these contracts need to deliver in order to be useful in order for people put value so the the end-to-end reliability is very important and that's essentially the place where chain-link seeks to Excel chain-link is a collection of approaches that seeks to provide contracts with this reliability through you know through a community of workers that people can select multiple Oracle's or one Oracle however many they want to select but we'll get into that essentially this is a very important idea and if you're building your smart contract you should have you should ask yourself I know that my contract is reliable cuz I believe that the etherium know network is reliable how do I know that my contract is reliably triggered right how do I know this isn't a point of failure you as developers and the people that are building something that's gonna get value put into it should and in this space should should take that point of view because if you build something that's not secure you know it could create a problem so you should this is kind of you looking ahead to see that there won't be a problem one way not to do this in our opinion one of the I mean the most logical intuitive initial idea would be okay I'll just have an Oracle and there will be a single Oracle somewhere and it'll be run by somebody and it would be closed source and I'll just hope for the best and I'll just send it in to some some Oracle somewhere run by it and know five people right and then they'll trigger my contract and it'll all be great this this approach in and of itself is is very flawed because it goes against the security model and the logic of our space right the logic of our space is I trust the contract state change it is computed on multiple nodes computed on on a network of nodes in this decentralization or essentially high level of redundancy provides me this guarantee and then when I expand the features of the function of the contract out to how do we trigger it reliably I suddenly forget this idea forgetting this idea isn't a good idea you should really just stick with this decentralization high redundancy equal is the security model idea so that's that's why a central or centralized Oracle without any additional guarantees is highly problematic in our opinion we've run a centralized Oracle for years it's not something we think can provide the guarantees that people would look at an end-to-end smart contract set up and say yes you know that I'll put a hundred million dollars into that doesn't doesn't seem so likely the more the more likely the more useful security model that isn't in line with the model of our space is one where you have the centralized computation during the state change and then you have a decentralized oracle network which essentially means that you've applied decentralization to this Oracle mechanism you have the capacity as a developer to select a multitude of Oracle's and to pay for decentralization on the level of this mechanism so now you pay for the centralization for the state change because you believe in the security model of decentralization you pay for decentralization at the level of the Oracle because you believe in the security model of decentralization right that's that's the the basic foundation that chain link is is is more or less built on and then after you've decentralized the Oracle Network level or decentralize the Oracle level or the middleware level you can then move on to the centralizing subsequent layers so that means data feeds so once you have multiple Oracle's you can then talk to multiple discrete data feeds if you want to decentralize that that layer that's a separate question but you know that the first step is you essentially in in terms of security you continue to move out from from from the contract to determine what you can make secure as a quick example just to put this into into a clearer perspective let's say you had a contract where something was shipped and you wanted to make sure it arrived because your car tract this highly deterministic and highly efficient and it's very hard to roll it back and it doesn't have a roll back and you know nobody is gonna want to roll it back it's gonna be very difficult you don't have like a three day period waiting to do something it's this super efficient super deterministic super great contract right so if it's so super great and efficient and deterministic and immutable you you might want to make sure that what what-what it relies on actually happened in this example that's you know there's two sources of data about a shipment and now your contract knows you know as an initial key source then maybe as a backup piece of proof about something happening in terms of a delivery and then let's say your contract wants to pay you know let's say your contract wants to pay $100 for this delivery or a million dollars or a billion dollars and now it needs to know market data so now the payment is determined by this market data that's delivered to the contract in our case through multiple sources and multiple individual nodes this is this costs more but this creates more reliability and it's an important point around if I want my contract to then pay out in you know Bitcoin or Z cash or something else how do I know how much Bitcoin it sends how much is $100 of Bitcoin a thousand dollars a Bitcoin and a billion dollars of Bitcoin I need to know this and I need to know it reliably so at the at the core this is this is the the approach that she link seeks to provide to the to the you know the public shame kind of open source community the the second piece of chain link well not the second piece like an another very important thing that chain link does and that we're always eager to hear feedback on and and and think about how how we can be more helpful is the ability to have excuse me is the ability to have pre-made pre-made inputs so what a premade or pre-made oracles pre-made pre-made inputs and outputs what a premade input an output is is the ability it is essentially an API that's had a specific chain link wrapped around it and now has a specific contract on chain that represents that resource right so what we have is we have these collections of you know now we have tens working on hundreds and you know eventually probably thousands will have of these of these discrete contracts on chain and each discrete contract represents a specific off chain resource so each this each discrete contract can represent you know market data that you can have a discrete contract for weather data and now what you can have is you can have contracts that you can have a collection of building blocks you can essentially have a collection of inputs and outputs that that are pre-made inputs and outputs so now now a smart contract developer can build at the velocity of a web developer right the velocity at which the web developer builds is you know I write my core code let's say I'm making the the the you bruh application I write my core uber code in a week or two for the MVP and then I go out and I get a GPS API I get an SMS API and I get a payments API I'd have my uber MVP I have it working right and I have it doing what it needs to do in smart contract world right now the velocity of a developer to build such an externally connected application something like that would is is extremely low it's it's probably orders of magnitudes lower than that and the way to get to the same velocity the way to get to the same speed of creating interesting useful things and then even more importantly probably iterating on you know adding more inputs removing inputs changing inputs is is if there's pre-made on chain contracts that represent specific resources so now you can have a requesting contract it you take code snippets from that represent four or five other contracts those contracts code snippets go into the requesting contract and that's it just like API is now literally in a matter of minutes a smart contract developer has connectivity to all the inputs that he needs and he's able he's able to get his application working he doesn't need to figure out the API he he and in chain links case he has a substantial amount of information about why a specific Oracle is good Oracle so the question of why am i relying on this Oracle is answered and the question of what input I'm using is is answered and so now the velocity of development has rapidly rapidly increased from four months to two days or weeks so yeah that's another another big piece chain link also has has other other other pieces to it but I think the most useful piece for for the hackathon is is probably this these questions of you know how do I use a decentralized oracle to make a highly reliable input how do I make a highly reliable and to in contract and then the second question is what specific inputs or outputs do I really want as a developer what specific inputs and outputs should there be a premade chain link for so that I can you know I can reliably use that input and output and I can even show other people very clearly here's my core code here's the contract responsible for delivering this data here's another contract responsible for doing payments somewhere and here's my here's my application yeah so I think those are the core two two key core ideas I think we'll just stop with for for the hackathon I'm yeah so that's that's Shane link we make it for developers our entire company exists to help developers build more interesting contracts more valuable more useful contracts we do that you know my voice is this way because I want that to happen because like yeah that's why we fly around the world and we talk to all these people and we are like our company exists to do that that that's like that's the goal of our company if we if we wake up one day and you guys have build really cool stuff because we enabled you to connect to the right right inputs and outputs we're very happy people so or as happy as you could be in modern modern life probably yeah okay so that's generally speaking the the gist of it I'm glad to answer any questions that is if I have time and if there's questions sorry I've been told I really should do this your question is what is an Oracle kind of what is the components any anybody can be an Oracle so we we focused I'm sorry well justjust to be clear an Oracle is is a smart contract is always a smart contract and a piece of off chain software that does fulfills requests which were sent to that contract so every every in in our in our network every Oracle is a contract and an off chain piece of software now the question I think your question is who can become an operator a node operator within the chain link network yet no you seem to have a multi-layered question so one or one of your questions so there's a piece of your question that asks if an Oracle can be a smart contract the answer to that is an Oracle is always a smart contract there's another part of your question that seems to be who can be part you can be a node Oracle as an entity or as a person which in our in the language of our network is a node operator what can be a data probe anybody can be a data provider so there's two ways people can be data providers one way is a node operator that's not the data provider can connect to the data provider and sell their data to contracts another way is that the data provider can run their own chain link and provide data directly does that answer your question yes it can it can be both so this is this is what chain-link is just like a flex it's a flexible piece of software that can include multiple data providers and it has multiple ways that contracts can interact with that data so what that means is you as a contract can say unchain you can say I want this schedule of data and I want a wallet somewhere to send me the data to my contract another ways you could do you know some other function on chain to get the data that way so there there's a lot of flexibility and how contracts can consume data through chain link there isn't one way it usually depends on the use case how people want to consume the data yeah I'm glad to get I'm glad to get into the details offline if that's helpful I don't know if I have to yeah there's one more question looks like no I think we have some more yeah we have some some that we've written we have a number that community members have written oh yeah absolutely our entire model is that we have a set of core features that's worked on by an open source community and like secure their security research community in the academic community and we do multiple audits on that and then the adapter adapter level code is the integration code with specific data sources and those we can now turn around though turn those around and like a number of hours so yeah we've made it very very easy for somebody to choose I want that API and I want a chain link and then either I can run it or somebody else in the community I know a node operator with a good history of running Oracle's can run it or multiple node operators with good history can run it yeah but the goal for us is not that we make the adapters the goal is that people people we will initially make a lot of the adapters but if we have to but essentially the the framework is one that allows data providers allows third parties that want to monetize certain api's to in a matter of hours generate generate exactly what they need in a very clean limited more secure way okay I'm I think I've hit my time anyway it sounds like so it sounds like we're it looks like we're good and great thank you all for coming and you know we have a table and and we have a booth we have engineers there we're glad to help help get you guys where you need to be with Oracle's here and and and after the hackathon if we can help make you make something cool together where we're totally into it thank you [Applause]
Automatic transcript — names and jargon may be misspelled.