New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

How to Securely Connect Your Smart Contracts to Off-chain Data Sources – Johann Eid

Ethereum DenverFri, Oct 9, 2020, 12:00 AM

This talk is from ETHDenver, the world’s largest Web3 BUIDLathon and Community Gathering. ETHDenver’s content is crypto and blockchain focused. Subscribe to our channel to learn more + connect on Twitter: https://twitter.com/EthereumDenver. Speaker: Johann Eid of Chainlink Abstract: The vast majority of useful smart contracts extend beyond the blockchain to connect with external sources including data feeds, web APIs, and traditional bank payments. However, to maintain a connected smart contract’s overall reliability, the inputs and outputs to the contract also need to be secure. In this workshop, you will learn how to connect and trigger smart contracts securely using external data sources such as cryptoprice feeds, freight information and flight data. In the workshop, you’ll build and deploy a smart contract that connects with multiple oracles powered by the Chainlink network. We’ll walk through an example that uses Metamask and Remix to develop Chainlink contracts to obtain the current price of ETH from an API endpoint. We also go over best practices and common issues to avoid. This talk was recorded Friday, February 14, 2020. ETHDenver 2020’s content themes included DeFi; DAOs and Token Engineering (TE); Gaming and Usability; Protocols and Interoperability; and Public Good and Social Impact. Industry experts also weighed in on topics like decentralization, privacy, identity, non-fungible tokens, scaling, governance, diversity, and arts and culture in blockchain technology. The 2020 event was February 14-16 in Denver, Colorado and hosted 2000+ blockchain enthusiasts, developers and community members from 50 countries and 50 U.S. states. 🔴 SUBSCRIBE ETHDenver’s YouTube https://www.youtube.com/channel/UCgz9NU06t_FkT0Py1Vadczw 💡 LEARN ETHDenver’s Official Website https://www.ethdenver.com/ 👋 CONNECT ETHDenver Twitter https://twitter.com/EthereumDenver 📖 READ ETHDenver News on Medium https://medium.com/ethdenver 🛍️ SHOP ETHDenver Official Merchandise bufficorn.com 💬 CHAT Telegram https://t.me/Ethdenver Discord https://discord.gg/jteMn5c 📱 FOLLOW LinkedIn https://www.linkedin.com/company/ethdenver Instagram https://www.instagram.com/ethdenver/ Facebook https://www.facebook.com/ETHDenver/

Transcript

so hello everyone first can everyone hear me is a sound right or okay perfect alright so thank you all for coming so today I'm going to run a small presentation about chaining so the flight times i'll be covering will be smart contract connectivity so basically what is the main problem chaining focuses on solving in the blockchain ecosystem then I'll be making a small Jimo about on how you can use standing in your smart contract how changing supports the current GPA ecosystem and the currents can defy revolution which has been happening lately and lastly I'll be going over one new feature which we've been working on very hard in the last few weeks about trust minimize computation using chain link nodes and Arbitron computation Arbitron rollers all right so first off to kind of put things into perspective and so that we are all on the same context currently the main issue we see in the blockchain industry is that it's a siloed industry right block chains have no access to the real world they can't read real word data as I can't read real world events they're basically siloed from this whole ecosystem of data that you have out there in the real world and this data can be key on multiple levels right so this data can be financial data it can be IOT data it can be stuff that you can use for derivatives for future contracts for insurance for supply chain all of these great shoe scales are allowed by data basically we need data in order for these use cases to evolve on blockchain on the on in theory on so basically what is our mission we want to connect smart contracts to the real world data we want price data for instance for defy protocols to be able to read the current price of if USD of BTC USD or any other asset like FX and commodity right in the case of synthetic assets for instance if you want to synthesize gold on etherium you need to price of God's the current price of God right so we need this bridge we need smart contracts to be able to read these values we also want smart contracts to be able to access real word payment methods so that means being able to plug into PayPal being able to plug into Swift all of these payment methods which are necessary because not everyone is ready yet to adopt cryptocurrencies and to have payments made in crypto so having access to the real words and of widely accepted payment methods is extremely important and lastly we want to be able to connect block chains together so it means basically having your Bitcoin transaction which is going to trigger a smart contract on a theorem for instance or a smart contract on a theory on which is going to treat your Bitcoin payments or a tezo's transaction right so that's our goal is basically taking the current ecosystem we have an ecosystem which is extremely siloed which can resemble the days of the intranet and making sure everything gets connected so it's basically bridging bridges I think the way you add value to an ecosystem like ours is by building bridges to other sources other sources of data like real world data real world events or other productions for the deductions to communicate between one and another so how do we do this now I think it's very important to take into consideration the security aspects whenever you are going to bridge your real world data and events to a theorem right so for instance whenever you are going to start creating smart contracts on a theorem it means you have some some values that you want to 12 write short decentralization transparency security all of these great aspects which are necessary for a smart contract up right that's what GFI has been built on transparency centralization and basically having protocols which can run in the long term without having any central party which could take them down right maybe it's not the reality today but that's what we're aiming for all of us by building these movements the way you do this is by not having any central point of failure right so we don't want this critical piece of infrastructure the Oracle to be centralized we don't want it to be a run on closed source cards with only one single node because it means that your Sparkle tracks would basically rely on 4G infrastructure and we'd have a centralized point of failure so that's not something we want to have right so basically the way we want to do things that chaining is by having decentralization multiple nodes fitting data to an ethereal smart contract it basically is the same way we can to consensus with multiple nodes around the words which agree on the state of the blockchain we want to come to consensus on the data by having multiple nodes around the word which come to consensus around the state of the data right so the price of ease the price of Bitcoin the price of gold and silver so now I'm going to run a small kind of Jimo and how you can set up a training contract but that's it's a bit more expressive right so if you go to this link basically you'll go to our documentation in our documentation we explain how to use a trifle box so very simply let's see I'm just going to I'm a bit paranoid when I share my screen I forgot to delete a bunch of stuff so all right now I already set up a contract because the network I think is going to be a bit slow here and Rob stone is also going to be slow so basically what we're going to do is I have a travel box which has already been unboxed the instructions are in the documentation on how to do it and that's what I get so out of the box I get a channeling contract basically which has multiple components so I'll go over a few right now the main one is really the create request - it's basically the request which is going to send demand to a chain link nodes for data so basically here we are putting some arguments which are saying I'm going to want to talk to this channeling node so this Oracle nodes basically I'm going to send him his this job ID the job ID is basically what's going to allow me to get a certain data points I'm going to send him a payment he'd have to access the URL and he'll have to parse the data using this pass and then we have a multiplication because we don't have any decimal number on a theorem so basically we have to multiply using the times arguments so once we have the answer from the chaining nodes chaining node will basically call this fulfilled function which will request well which will return the data points they just went to fetch right now what I'm going to show and I want to go over this presentation a bit quick because that's very basic right and we've already put some script to automate everything so if you go to the R in me whenever we will start hacking using chaining today or or tomorrow you're going to avoid three instructions there on how to get started right and you're going to be able to first run these two scripts which I won't be running here for you know simplicity takes too much time right now with the network and we are going to just run these simple scripts so what this script does which I just ran is going to basically fund our contract with summoning tokens so the way the whole network works is you have node operators which gets paid using which get paid in link token which is basically the kind of lifeblood of the entire network right and if you want to see how to choose a node operator we actually have a marketplace for people to easily choose which not operators will be choosing right which node operator is going to fetch data for my critical smart contracts so if you have a smart contract which has many millions of dollars relying on it then you need to make sure that you have the best operators out there to fetch you the data you need right so you can go on the marketplace oceanic marketplace you already have 109 not operators which have been basically listed there and you can choose which and operator will fit your use case right so massively if you go to the nodes page you can see multiple node operators some of them have been security reviewed which means the channeling team has checked basically they're set up as sex if they have enough redundancy if they have monitoring systems around their whole system and basically these people are currently running on onto chaining networks they're currently fetching data for live users of the network right now that's that's basically how you choose a node operator so if I go to one of these pages I have all the information I need so I can see for instance that the road has been verified which means they've been security reviewed by the team we can see basically that you know they're listed on the Explorers who have multiple information points we can see which editors are running which means which data points they can fetch for your dub so you have multiple informations you can have Francis actually that's the link for the market dot link if you want to access it after I recommend you guys to go and check it out if you have any questions we'll build our booth so now coming back to the demo once we found out the contract we are able to send a request for data so here in this requests what the script does is extremely simple we are just fetching the price of each USD basically live from channel note right so if I go to read request data I can see what this data point is so we are fetching the price of each qsz we are multiplying this price and we were turning it on chain basically very simple so once it's done we can go to the channel Explorer actually and check what the states of the of the load fetching the data right so here we go basically and sometimes it takes a bit of time I think Robson is a bit flawed so alright there we go so yeah that the states of the road operator who is patching the data life right so you can see the multiple operations he's doing he's doing an HTTP GET he's parsing the data that he fetched his then multiplying it because as I said Experian doesn't support decimal numbers he's returning it to the blockchain after and whenever you're going to reduce data points you're just going to be able to send to to use the last script which is basically a read contract which is going to read the value that's an old operator return so yeah here you have the price of each USD congratulations seems like it's improving so it's basically how you can easily set up a trifle box how to fetch the price of each USD using our script now is actually basic right now what can we do with this kind of stuff which is really interesting and which can really help to defy ecosystem growing kind of ecosystem Pro in general well let's see what a contracts you know water chaining contracts can can basically give you so that's a reference contract which is patching the die each pair using multiple node operators so in this contract we have seven operators which are fetching the price of die the trading bird is using seven different data aggregators so these aggregators can be keiko being sick on market cap crypto compare etc etcetera right and basically the way it goes is we have all of this decentralized networks that we have one for die each here we have multiple ones which are being set up and which are currently being used in production by defy dubs so as this divide up choose them use them are extremely versatile so basically this twenty-nine reference contracts are being used to mean synthetic assets are being used by text protocol such as loop ring to secure staking are being used for upward force for the commodity money they have so basically upward force from stones has has an elastic supply of money ins I need to check the price of the ample token in order to decide to supply of their token right and Ave which is a lunging and boring protocol which has been using 15 of our fields to basically secure their collateral so yeah basically we've been seeing much cheaper use cases pop up into space every defied up right now as of today needs price fields right and the way success price fits is extremely important now if you build up on aetherium you are not recreating the whole underlying infrastructure on which your dad resides right you're not recreating the whole blockchain you're basically building something I hear young well we believe that if you want to access data you shouldn't build the whole underlying Oracle infrastructure you should be able to use the network which can provide you this data and this network right now is channeling which can provide you more than 29 reference contracts prices for any data you guys would need and basically if you go to this page we have all of these contracts currently instance so if USD which is USD we have networks for each of them we have the users who are service the network is a bit slow okay we have the users who are using them also live for the top right so here you can see the price of each USD being aggregated and yeah who is using the network right now so if you have any interest in a reference contract like this one for your dub if you if you need for instance the price of guard the price of silver or anything else we'd be more than happy to talk to you and to support you in setting up a network like this we've been doing this with this for applications with Ave we went live with more than 15 contracts which I needed all of these are here in less than two weeks and it was actually does actually during Christmas which means we had a very fun Christmas you know but yeah if if you need something we'll be able to support you in setting up these networks that's what we we do you know that's basically how we want to support the defias system we believe that Oracle's are extremely important because I can trigger liquidations they can trigger margin calls if your Oracle's are not secure and are not decentralized or transparent then your whole system is at risk basically all right so now we're going on to the next topic which I'm extremely excited about currently we've been working for for some time on option computation with our good collaborators from Arbitron basically we believe option computation is key for the etherium ecosystem to scale right if you take the case of defy dubs for instance in order to embed complexity into a divide up like complex financial instruments right now cannot be coded on a to divide up without having extremely high gas costs right it's not an easy matter to cut up extremely complicated systems on Twitter I'm right now and that applies for defy that applies for gaming that applies for enterprises use case in its scalability we need privacy you need all of these key components right and a chain link what we've been working on is actually being able to have these node operators which I showed you earlier on this marketplace be able to compute these extremely important pieces of computation of chain and return unchain probably secure result now how is this result probably secure well basically the way Arbitron computations work is they're being run by chaining node operators these chain include operators will basically offer the reputation right behind them like they're basically not operators who are running operation like blockchain infrastructure operations of multiple million millions of dollars of value around the world right and basically the way our btrim works is actually game theory and crypto economic guarantees behind it crypto economic guarantees comes from thus taking that node operators put up which means I'm annoyed operator I put up a certain amount of collateral security deposits whenever I'm going to process a computation right it's basically I'm putting something at stake to say hey guys here I have maybe $500,000 of stake on the blockchain if my computation is proven to be wrong or is proven to be malicious or my node went down well I'm going to be losing some money and the game theory incentive is basically the way Arbitron works and and the protocol we set up works is you have a user contract which is going to send a solidity function to be computed by chaining nodes this function will be picked up by the chaining nodes will basically compute it on/off chain they will then return a result unchain this result will be attached with a cryptographic proof right and whenever the returns is result unchanged there is an arbitration period where other chaining nodes can basically confront the result which was put up because they also have a cryptographic proof and they can basically confront the proof which was put by the other load operators right so there is an arbitration periods which which will basically determine the real result of this computation right now as I basically how it works right now what we've been doing with arbitrary still quite as an early stage right so we've been working on it for a few months now but we really hope that in the coming weeks to months we'll be able to show something that can be used by defied ups in production to basically scale up their application and to dramatically to dramatically lower the gas because they have to pay on chain right now so for the for the demo that I have I'll be sharing my screen actually with one of our dev spook who is going to be able to show you from his screen so how it works basically furthermore all right so we're just communicating like this for all rights and I think we should start any moment now to share screen all right perfect so yeah basically here as you can see spooky showing use the UI for a job IG so that's for another operator basically was his job ID here now if he goes to the Jason page you can see the Jason spec that the operator will be running right so basically the operator is making an HTTP GET request to the crypto compare API he's then going to parse the data he gets he'll be taking a subset of this data and he's going to execute an API code of a solidity function here in these parts that book is showing and then basically so that's an arbiter on computation as you can see the type is arbitral and the result he is going to the result returned the result of this computation unchanged basically so what the computation does very simply is that it compares the number of transactions which happened on Bitcoin between two blocks it's a very simple computation just below as the Gmail skills set the solidity codes which we are processing here and which was translated into API so now I think we can get started with the demo so we are going to find the contract as we showed a bit earlier and that that part is a bit slow that's why I avoided having too many kind of transactions on test nets during the demo right so here we're funding the contracts then we are going to request so data so request data is going to basically execute the job spec I was showing you guys earlier and this one is going to be taking a bit of time because the way it goes actually is that there will be a computation which is going to be done on the arbitral node and which would take a few seconds basically and knowing that the destination is a bit slow right now because everyone is hiking might bacha we'll get through it so the good thing is that you can see the job being processed live using the UI so here's a job which is being processed by the nodes you can see the states live like where is it right now so HTTP GET the parsing and basically there I be from computation so probably if we refresh your page we should be able to see oh here's our bit from picked up the computation so yeah we are basically computing right now all right and you can see on the screen that our btrim is basically doing the computation for the job spec we sent it all right message delivered okay so it's in the process of getting done I say just by curiosity could anyone who who knew Channing before this presentation raise their hands just for a small opinion poll all right so one person okay so not too many people new challenge all right and then I think we should be done so could we check against the UI just to see where we are I think we're at the computation where just in case all right audience ooh computation insulin going all right so as you can see it takes again a bit of time it's it's always the issue in this hackathons I'm I'm done with demos yes all right okay the computation is done so now it's going to return the result on share so this should be pretty quick and then we can read the data and see how many transactions were processed between the two Bitcoin blocks that we sent basically all right so it's sunshine now and if we arrange the script to read the data let's see that's it all right so there you have the number of transaction Bitcoin transactions run so it's basically 31,000 so yeah this use case was really to demonstrate how we can use Afghan computation in an application or in theory on right now as of today right so we are seeing the process of gender you know like we're still in the early stages of this however we we're extremely extremely excited because right now as I discussed before like we have so many great use cases that we could build into the into aetherium right like expand the use cases so areas covered by TFI expand what you can do with games on a theory on expand the enterprise use cases and all of these needs option computation to scale right now so genic will be working on it in the coming months with our bit from Jim and basically hopefully in the next few months we can provide the current defy ecosystem and the current gaming ecosystem and any other dipandi theorem a reliable way for people to compute suley difficult of chain and return the results on chain in a seamless process manner so thank you very much for hearing me out argh orogenic is ready to scale up the ecosystem 12 the growth of the ecosystem providing data providing option computation and many more tools to come to basically become the abstraction layer which will really allow the dub the dub sunny theorem to scale up to their real potential and 12 world-changing impact so thank you very much we have cool bounties for this weekend so if you want to help using our tools please come to the booth and we'll be able to help you in any way we can thank you very much [Music] you [Music]

Automatic transcript — names and jargon may be misspelled.