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

Loading player…

Understanding Decentralized Data and Computation | ETHDenver 2022

Ethereum DenverSun, Oct 9, 2022, 12:00 AM

In this video, we delve into the fascinating world of hybrid smart contracts, decentralized oracle networks, and decentralized data external computation. Join us as Patrick Collins, a developer advocate at Chainlink Labs, takes us on a journey to understand the story behind these innovative concepts and their significance in the realm of smart contracts. One of the key aspects we explore is the purpose of smart contracts and why they are crucial in today's digital landscape. As we unravel this topic further, you'll gain insights into trust minimized agreements and how they play a pivotal role in ensuring secure transactions. With Patrick's expertise guiding us through this complex terrain, you can expect to grasp the intricacies involved in building such groundbreaking technologies. Whether you're new to blockchain or well-versed in its workings, this video promises to provide valuable knowledge that will expand your understanding. Join us as we uncover the mysteries surrounding hybrid smart contracts, decentralized oracle networks, and decentralized data external computation. #SmartContracts #blockchainrevolution TLDR: The key idea of the video is that Chainlink's decentralized data and computation capabilities enable the creation of unbreakable agreements in decentralized finance protocols and offer economic opportunities by eliminating the need for trust assumptions. 00:00 📚 The speaker discusses hybrid smart contracts, decentralized oracle networks, and decentralized data external computation, emphasizing the importance of understanding the purpose of smart contracts and the story behind their development, while also urging the audience to reflect on their motivations for participating in the hackathon. 01:34 🔑 Decentralized data and computation offer economic opportunities and address the issue of trust by creating unbreakable promises and eliminating the need for centralized power in systems like banking. 06:01 🔒 Cryptographic agreements in the blockchain community eliminate the need for trust assumptions, ensuring guaranteed execution of contract terms and moving towards a world where truth is valued over trust. 09:21 🔗 Chainlink enables smart contracts to access decentralized data and computation, solving the oracle problem and allowing for the creation of unbreakable agreements in DeFi protocols. 15:44 📚 D5 protocols like synthetics, SushiSwap, Compound, and Aave enable the creation of decentralized finance applications, while chain link offers features like decimal handling and off-chain randomness for building decentralized protocols, NFTs, and gaming. 18:14 🔗 Chainlink VRF provides provably random numbers on-chain, used for randomized lotteries, gaming applications, and NFTs, while Chainlink Keepers offer decentralized event-driven execution through off-chain nodes. 21:04 📊 Chainlink's decentralized data and computation eliminates the need for intermediaries, allowing for programmable events and customizable nodes to execute transactions and call APIs, enabling feature-rich smart contracts. 23:40 📚 Chain.link is a valuable resource for learning about decentralized data and computation, with comprehensive documentation and step-by-step guides, and using Chainlink in smart contracts can qualify for prizes at ETHDenver hackathon.

Transcript

so today we're going to be talking about hybrid smart contracts and decentralized oracle networks uh and decentralized data external computation and all that but additionally for those of you who know all this stuff and who are familiar with this you might go oh this is a little bit of a refresher here i'm also going to give you a gift and the gift that i'm going to give you is the story that to tell your friends and family when you get home why you came here why you came to eat denver why we're building all this weird stuff because a lot of people they go home and they say hey like i went to denver i did all this building and they go yeah what is that cryptocurrency stuff that sounds weird and they have no idea why we're here so i'm going to give you the gift of the story of why we're all here nice and for my introduction my name is patrick collins i'm a developer advocate on chain link labs you can find some of my contact information here and i absolutely love this space i live breathe eat sleep smart contracts love builders and i love the philosophy of what we're doing here and the reason that i'm going to give you this gift the story of what we're doing here is because in order to understand chain link in order to understand these decentralized oracle networks you need to understand the purpose of smart contracts why are we building on this stuff and again this might be a refresher to a lot of you but i'm going to give you the story that makes it easy for anybody to digest here so why are we here and maybe even look at yourself why are you here why are you coding right now why are you part of this hackathon why are we as a community so excited about all this stuff is it the economic opportunity is it the random nfts is it the dogecoins is it the d5 why are we here and that's the question that our friends and family ask why did you bother going to eat denver to hang out with buffalo unicorns why did you go there and the answer is trust minimized agreements remember this this is why we're here this is the simplest reason that you can explain why we're here now if your friends and family are anything like mine normally they'll go well what what does that mean that's really confusing and i'll usually simplify by saying we're here because we have technology that guarantees we can create unbreakable promises and this is due to decentralization and this is due to the future that we're building not to be confused with javascript's unbreakable promises a little bit of a coding humor here love me some engineers and in all of our agreements today we have this issue of trust in promises from things like services like an oil change you're trusting that they're going to change your oil and they're not going to stiff you and they're not going to do anything about your trust there's a trust assumption here if you go to a bank you say hey i'm going to put my money in you i'm going to put my money and you're going to keep it safe and we're trusting that they're going to do this or with the lottery if we play a lottery we're trusting that if we buy a lottery ticket we're going to have a fair chance of actually winning that golden pot at the end of the rainbow but there's a trust assumption there we're trusting that their promise that we have a fair chance is going to come true and to really nail it in looking at real use cases where this trust has been broken and has ruined people is essential so a lot of people go oh you know i trust these big corporations i trust these big groups and we look at something like mcdonald's mcdonald's had this promise a few years back maybe uh several years back where they had this monopoly game that they were doing some of you might remember this where they basically said we promise if you buy our mcnuggets we'll give you a fair shot at winning 1 million dollars and in fact between 13 and 24 million dollars was stolen and when you bought the mcnuggets when you bought all these things when you entered your chance to win you had a zero percent chance to win because all the money went to a centralized group that flipped the switch and had the power to say nope sorry this is ours and whether or not it was mcdonald's fault doesn't matter the thing is there was a centralized power that had the ability to break their promise we look at other examples like banking people say hey i trust my bank my bank's great back in the day there was there's things called the run of the banks right when you put your money in the bank bank goes hey we got it we're going to put your money in the vault no one's going to touch it but there's profit incentives there and the banks say oh well if we spend all this money we can go make a whole bunch more money and then so when a ton of people say hey we want our money back the bank goes whoopsies we spent it all [Music] and some people might say okay that was years ago right that hasn't happened in a long time okay let's look at a more recent example with robin hood robin had painted this picture they made this promise they said hey come use our platform and we will give you access to financial markets we will give you the ability to buy trade stocks do all these things and when puss came to shove what happened there was a centralized force that they said ah but if we let all these people trade and buy these stocks and chairs we're going to lose a lot of money so maybe we flip the switch that only we have control over and disallow people to do this have this trust assumption and what did they do they went back and they broke our promise and this is why we're here because in traditional agreements you always have this trust assumption where we have to trust that these institutions these groups are going to do what they say that they're going to do but there's a conflict of interest right does the lottery want to give out a million dollars no because that goes against their poor uh their for-profit motives if they can find a loophole to say uh well sorry you know you didn't meet the criteria you didn't check a box what's the dates we're not going to give it to you they own the contracts and they also execute the contracts but they often have this conflict of interest of actually doing what they said that they're going to do and this is why we're here we have a technology called cryptographic agreements where the contract terms are baked into code and have guaranteed execution and if a contract says we promise to do xyz it is guaranteed to occur and we no longer have to worry about having these trust assumptions and having people breaking our promise this brings us from this world where we currently live in where previously we had these paper guarantees these brand-based guarantees where if we didn't like a service somebody made a promise to us they said hey come use us we'll do all these amazing things and they break those promise all we can do right now is walk down the street to some other group who's gonna do what make the exact same set of promises and this time we gotta hope that they actually fulfill it and they actually fulfill their promises we move away from that world to a world where we have cryptographic math based agreements where one plus one always equals two and we don't have to have those trust assumptions versus in the web two space where maybe if a for-profit entity says hey well if one plus one equals three we'd make more money so let's fudge some numbers and now one plus one equals three that is impossible in the world that we're building at eat denver at the blockchain community and with smart contracts now i like to boil it down to that one piece because usually it gets a little bit overwhelming if we say oh it's also got great security guaranteed execution transparency trust minimization efficiency can be a little bit overwhelming when you get so excited you go oh here's why i'm here so i like to boil it down to that one thing but these smart contracts these blockchains they have all these additional features and it just brings it back to we're building a world where truth over trust where truth is what we want we don't want to have to trust that someone's going to do the right thing and we can do that and the reason i think this is so important too is given two agreements one with guaranteed execution one where it's an unbreakable promise versus one where you have to trust a human being to do the correct thing which one are you gonna choose in my mind it's gonna be overwhelmingly the guaranteed execution and to me that's why we're working so hard and we're here is to re-landscape all these agreements with these trust assumptions to the ones that are guaranteed to be executed so that's the story that you can all take back you bring to your friends and family and say this is why we're so excited sure maybe you like nfts maybe you like dogecoins maybe like kind of all the memes in the space you can absolutely love that part too but the real fundamental values come from these trust minimize agreements these unbreakable promises now this leads us into chain link you might be thinking oh my goodness patrick this sounds amazing i want to be a part of this world where people can't break our promises this sounds great smart contracts seem really amazing right well they have a fundamental issue this is what's known as the oracle problem smart contracts are unable by themselves to connect with external systems data feeds apis existing payment structures or any other off-chain resource on their own and this is a big issue right because if i want to make one of these agreements they can't talk to the real world if i want to make an insurance agreement right an insurance unbreakable promise where hey if a tornado hits my house you're going to pay me out blockchain has no idea if a tornado hit your house if you want to make a lottery with a random number blockchains are deterministic systems they don't know how to get random numbers if i want to make a bet to say hey i bet you it rains tomorrow blockchain by themselves have no way of knowing if it rained tomorrow or not and i can't make these incredibly simple agreements so now you're saying okay patrick these smart contracts don't sound that cool it sounds like they can't really do a whole lot of anything because all the agreements that i care about are going to use something off chain and the reason that they can't do it off chain is because they're deterministic and they can't go into variable data so i'm going to skip a little bit of the technicals but if you want to have we have time at the end for q a so if you want to go into why the layer ones can't do this we can go into that we have a solution though a blockchain oracle is any device that interacts with the off-chain world to provide external data and computation to these smart contracts so that they can make these unlimited these feature-rich agreements but the story doesn't end there because if you as the builders do all this work to build this decentralized logic layer on chain this decentralized model and then introduce a centralized oracle or a centralized data structure or a centralized execution layer what have you just done you just ruined all the work you've done to make this trustless this trust minimized agreement and reintroduced the centralized vector reintroduce the trust assumption so having a centralized blockchain oracle or having a centralized data provider nullifies and ruins any chance of you having this unbreakable promise this unbreakable agreement so we can't have this and this is where chain link comes into play and chain link really shines chain link is a decentralized oracle network which allows for decentralized data decentralized external computation so these smart contracts can have all the feature richness of the web 2 space so we can have end-to-end decentralized trust minimized agreements so that both our on-chain logic layer is decentralized and our off-chain data external computation layer is decentralized end-to-end trust minimized agreements and this gives rise to something called hybrid smart contracts which are smart contracts that have both an on-chain component and an off-chain component and most of the time when people are talking about smart contracts they actually are talking about hybrid smart contracts but the term is used a little interchangeably if you look at the top 10 d5 protocols at least 50 of them have oracles as core infrastructure and then up to 80 percent of them interact with decentralized oracles in some facet because the agreements that we care about probably need data or need to interact with the real world in some regard now for the engineers here this leads lives rise to okay this sounds amazing this is what i need for my feature-rich agreements this is what i need to take these smart contracts to the next level what can i do with chain link out of the box what features come out of the box what are the solutions i can do with chain link and the first one that is the easiest plug and play and one of the most powerful features is chain link data feeds or chain link price feeds and they're currently powering over 65 billion right now in the d5 space these are battle tested hardened price feeds data feeds securing d5 now what are these if we want data about pricing information for example the price of ethereum that is a value that we human beings have assigned to ethereum hey ethereum is worth three thousand dollars that's something that blockchain natively has no idea about so we need to get that information from off chain on chain in a decentralized way somehow so there's a network of decentralized chain link node operators that source data from many of the top apis exchanges and data sources data providers route it through a decentralized oracle network that aggregates the information and delivers it on chain in a reference smart contract so that any developer can now use this to build the future of finance can build these smart contracts and we can even take a quick look depending on if the wi-fi actually works uh at data.chain.link and we can see an example of one of these data feeds we see etherusd on the right side we can see all of these independent node operators that are sourcing data that are delivering data on chain we can see the current trusted answer or the current decentralized answer from all these data providers we can see parameters we can see price history we can see everything about all these node operators and at the bottom we can see a slew of d5 protocols that are relying on these data these data feeds to be decentralized to be secure to be up to date for any of their protocols to work some of them include synthetics for valuing underlying collateral sushi swap for doing margin trading compound for doing lending and borrowing in ave again for pricing underlying collateral and these are d5 primitives these are d5 protocols that allow us to rebuild these trust models in traditional finance and give us this world of decentralized finance and we can go to the chain link docs and deploy one of these smart contracts in less than 60 seconds well depending on how the wi-fi is come to the chain link docs go down to data feeds hopefully you all can see this okay we'll go to using data feeds and all the code you need is right in the documentation you can scroll down to this button open in remix and i'm i'm not going to click it because the wi-fi has been a little bit a little bit spotty so i already have it up but you have all the code that you need to deploy one of these smart contracts with one of these data feeds and pull this information to build these incredibly powerful billion dollar applications in one click so we come over i'm going to be on the coven test net i'm going to go ahead and hit deploy metamask is going to pop up i'm going to hit confirm i've got some coven testnet in my metamask here and we're going to hope that the wi-fi is uh is benevolent here oh great and it already showed up and now i have a contract that reads the information from one of these data feeds and i have a simple view function i hit get latest price and you can see the latest price right there and now i can build these insane billion dollar d5 protocols or nft protocols or gaming protocols or whatever you want to do with it and for those of you who might be asking who might be a little bit newer the reason the number looks so astronomical is because decimals don't really work so great in solidity so it has eight decimal places that you you append on afterwards what else what's another out of the box feature that chain link has chain link vrf which is a way to secure randomness in your decentralized applications maybe you want to build the lottery maybe you want to do random sampling maybe there's some other insane gaming application you want to build with random numbers the reason that this is necessary to be off chain is because on-chain rng operators are risk what a lot of naive developers do is they say hey you know what i'm just going to use a block hash i'm going to do time stamp you know block.timestamp i'm going to hash it with message.sender or all these parameters that are deterministic and predictable and if you use a predictable value in a lottery or another application that is dependent on randomness you've kind of ruined the randomness aspect so we need to look off chain to get a random numbers miners can influence the block hash the block time can be predicted they can throw out a transaction that they don't want so chain-link vrf provides verifiable randomness it's a way of any application getting a provably random number on chain and that's incredibly powerful that way now when we build these lotteries if you know mcdonald's has this their monopoly application they can you everyone can transparently see on chain okay this was guaranteed to actually pick a random winner which is incredibly powerful and this is used today by uh tons and tons of different applications pool together for doing their the randomized lottery pokemons uh avagochi actually infinity ethercards for building gaming applications in and nfts that have uh random trait which makes them truly rare right if you have the sole power to mint a million rare nfts at any time how rare really are they so chain link vrf is incredibly powerful and uh at the end if we still have time i can do a demo there but again it's the same as prices you can go to the documentation you can scroll down to using vrf one click get it on remix deploy get your random number and vrf v2 was released two days ago which is incredibly exciting and it adds a whole bunch of optimizations what else can you do out of the box chain link keepers decentralized event driven execution anytime someone makes some type of execution on the blockchain somebody hit that play button somebody had to spend the gas somebody had to send that transaction and if a single entity is sent in the transaction what's happening there you've reintroduced the trust assumption a single person has to press play so is there a decentralized solution for this well yes there absolutely is uh and then earlier this week another chain link developer advocate seoul did a fantastic presentation on chainlink keepers so i highly recommend you all uh check that out and watch it but basically you have a network of chain-link notes off-chain that read a decentralized registry contract on chain where all these different applications have registered some functionality they want to check for maybe it's at 7 00 p.

m every day send money to my cousin kind of like a cron type thing that could be an event that you do maybe it's when the price of eth hits a million dollars buy a ton more that's another event you could do maybe it's when a liquidity pool hits a certain level you rebalance your portfolio any event you can think of you can program into the chainlink keepers jailing nodes are constantly checking this registry listening looking for these events and checking the contracts checking for your specific requirements on when the event fires once an event does fire in your smart contract you define a function called perform upkeep which says okay now the event has triggered this is what i want you to do maybe the price of a certain asset hits a certain level and i want to rebalance my portfolio you send that information to the chain link network the decentralized chain link network and the decentralized network will execute that transaction for you so you no longer have to rely on any centralized individuals any centralized intermediaries for doing this and is incredibly powerful now end and reliability is the promise of smart contracts and we want these smart contracts to be as feature rich as the web 2 world so additionally chain link nodes are completely customizable they have a functionality called any api where any api any http get any http post anything can be called from a chain link node into your smart contract so you can customize these notes do literally anything now i say that with caution because a lot of people go into this and they go okay cool i'm just going to spin up a node i'm going to use a single api and boom i got a crazy smart contract that brings in crazy data but this goes back to having a centralized intermediary so if you're going to do something where you do get your own data providers get your own get a group of node operators together it's incredibly important to think about the architecture and get this decentralized network now with that being said for this hackathon uh a single node in a single api for an mvp it's going to me a minimum viable product is great and then we can worry about uh decentralizing it afterwards trust minimize agreements that's why we're here and trust minimize agreements that can do all the functionality that we care about is what chain link provides for them so where can i learn more docs.chain.link like i was saying before has literally everything that you need to know i absolutely absolutely recommend if you're looking to learn any of these things there are tons of tons of documentation there step-by-step guides which will let you know exactly how to make these smart contracts as powerful as you need them to be 77 smart contract use cases enabled by chain link if you're at this hackathon you're like ah i want to think of something really cool to do just google this article and there is 77 use cases there of fantastic ideas that you can make where else can i learn docs docs.chain.link as i said blog.

chain.link has a ton of tutorials step-by-step guides everything and just basic smart contract and chain link information as well chain link developer youtube has a ton of technical tutorials for you to just get started get going if you're a more visual learner absolutely in smart contract starter kits uh for those of you who are like hey i like brownie great we have a repo for you and it's got like a little cute logo over here the little little brownie thing i like python i like doing my execution in python great we have a reaper for you hey i like hard hat awesome we got a boilerplate repo with you hey i like typescript great we got a boilerplate reperfuh i like dap tools i like foundry i like truffle we have boilerplate code for all of this you can take it fork it send it you're good to go it's got testing it's got mocking it's got all these auto verification on etherscan it's all these great tools that you can just take build and use and build one of these amazing applications so definitely check that out additionally a hundred percent one of the best ways to learn is joining the community the discord chat is incredibly active stack overflow has a chain link tag stack exchange ethereum has a chain link tag the documentation making issues on any of these github repos connecting with people on twitter connecting with people on reddit join the community ask questions we're all learning on this journey together and then additionally for this hackathon at east denver we have 25 000 in link total we're giving out in prizes we're giving two grand prizes of 4 500 for virtual and in person and then 16 prizes of one thousand dollars for virtual in-person and all you need to do to qualify is use chain link in your smart contracts that's it it could be chaining price fees could be chain-link keepers could be chain-link vrf it could be chain-link any api it could be you run your own node infrastructure it could be you you help somebody out with the node infrastructure it could be you improve other node um operators lives using chain link somewhere in your smart contracts that's it and that's the end of my presentation so happy to take questions now

Automatic transcript — names and jargon may be misspelled.