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

Loading player…

Connecting smart contracts to the real world - Solange Gueiros, Andrej Rakic | Chainlink

ETH Belgrade CommunitySat, Oct 7, 2023, 12:00 AM

Transcript

[Applause] hello um good morning and this is how my serving until now but I'm trying to learn something and welcome everyone I'm so happy to be here with Andrei we are both developers advocated chain link club is We join almost together and this is a big pleasure to be with him here in this stage and like both of them talk it was so inspiring so it's interesting after talking more about this Evolution and like I came into blockchain exactly because I think the blockchain will change the world uh and In This Moment like to talk about how we connect the real world with the blockchain I think it's a perfect moment so this is me my name is and the people call me so it's easy for you and yeah my name is Andre I'm from Belgrade you can see my Twitter lens handles listed over there and said I'm also developer educator training class [Music] thank you and this is let's talk a bit about Oracle fundamentals uh first of all I have some care codes in the middle if you'd like to get one this is what the beginner is okay is the the fundamentals of blockchain and chaining okay and at the end I shared the presentation with you don't worry if you lost some care code and is this are there limitations in these math contents what do you think Andre yes yeah sure yeah so uh and what is the limitations like when we try to get some information from the external world like let's try to get an API and use this information inside your conflict when the node is going to validators try to get this information they can get they can receive different values exactly because this information is not on blockchain and can be changed even if it's one second in difference because the external world is not to deterministic so we cannot have the same information from external cells because of this we used to say that it's so hard to connect how the financial systems and how the like other information that we that are not in blockchain yet and use this in our smart contents but the solution of the blockchain articles and uh this is a blockchain Arc we can say that it's any extent now data Cersei or research like weather like sports data like the how many steps I'm doing every day and I can use this in a context to prove what they be doing for example and there are lots of financial information like oracles are so important for D5 for example about oracles we cannot talk about centralized oracles because all of this is related to decentralization this is part of our Evolution and if you have a centralized Oracle you are again interesting in a central part and maybe this information can be manipulated the solution at the decentralized Oracle and we used to say don't desynchronized Oracle networks because this is a network of nodes that's getting some information for you and have your consensus and validating this information to send to you and this is changing changing it's a blockchain not only one but some groups of blockchain Oracle networks for different purposes and it's interesting because we have chinique is not a blockchain chaining it's a a set of services that are deployed in different blockchains and for example when you talk a bit more of each of these later but we have marketing data fit so important for defy we have proof of reality exactly to prove some Reserve and for example this is the same and we have automation uh to automate smart contents and we arrive to Generate random numbers we are talking a bit more about each of these but first of all I'd like to Andrew you talk about one of the most important services that we launched existingly in February and it is changing functions yeah so said chain link is a decentralized Oracle protocol it's not a blockchain it's it's like a middleware layer which connects your smart contracts with external data and computation and you can imagine training as like AWS for web3 because it has multiple services and we're gonna briefly talk about all of those the latest one is actually training functions so we launched this at Denver during East Denver and the product is still in beta which means it's only available in test Nets and you will need to sign up but like the whitelist form is pretty simple but in a sense training functions will give us a way to execute any code we want and get decentralized and verifiable consensus on a result at the moment for beta only vanilla JavaScript code can be used but you get the point like We'll add more languages and then you will have the ability to uh to Outsource the some complex computation from solidity to chaining for a fixed price so how this thing works so imagine that you want to create some complex D5 protocol which involves some heavy mathematics like solidity maybe it's not the best language for that but what you can do is we can uh you can actually use chaining functions and then you can paste aselect functions as like a solidity function argument your JavaScript code which will be executed by the each single node in the Dawn and each so non stands for decentralized Oracle Network so each single node will execute your code perform some HTTP get or HD post request is totally up to you what your logic will be and then each node then the nodes will communicate between themselves using peer-to-peer Network and make a consensus on the final result and then provide that final result as a callback to your calling smart contract so what you need to do is actually to create a function subscription the price will be fixed and linked and you can add multiple smart contract consumers that can execute whatever you want basically so if you need inspiration about that JavaScript code and what this JavaScript code can be there's a fancy website called use trainingfunctional.com where you can see examples of connecting your smart contracts with Twitter apis Facebook Instagram uh connecting with AWS connect with it password protected iot devices connected with GPT etc etc so today later today at 6 PM we're going to have a Hands-On workshops of workshop on functions so we're going to literally connect chat TPT with smart contract using openai API key you can register over here it will be from six to nine at uh continent Center studygrad so please join us if you want to see this thing in action and also bring your laptops next up chaining datafits yes talking about other services as well so that data fits it's the way that we can get any especially quotes but any asset prices to use your easement content and this is a mix from a centralized and decentralized exchange and for example if you'd like to get the code from it in USD we have a 31 nodes that is getting this information different Services getting the consensus of this and save this information inside an aggregator that's a smart content and then you can use in your own smart contents stuff like this this is some notes aggregating the information and in the data.ching.link you can see how the aggregators that we have it and also I thank you before related to proof of reserving and we do you remember what's happened with htx unfortunately yes yes with this is terrible so exactly FTX didn't have a proof of your reservy we don't know what they have the problem is a bit bigger than this but this is one of the part of the problems and how this can work I will explain with an example from Bitcoin for a Bitcoin bitco has the WBC the rapid Bitcoin this is the representation of Bitcoin in the ethereum network must have more Bitcoins in the Bitcoin Network than they have in wbc's in the Chino Network how can I check this proof of reserving they have implemented the profile service so they have the amount of Bitcoins in the Bitcoin Network we can get this information inside the serial Network and then in your own application you can manage this hey if they have it now more wbcs than BCS I will stop in my application just now something like that you can take care of this in your conflicts and then you talk about training automation yeah so training automation is a way to automate the execution of your smart contract contract so why first we need chaining automation so smart contracts are Passive by Nature so to go from State a to State B there needs to happen a transaction which will actually actually write something on change write some data change State Etc so that that's this first sentence is all about smart contracts are not self-executing like they're Pace by Nature so imagine that you want to create a yield farming protocol you have like a bunch of pools you want to and then when you have a bunch of pools you need to call that Harvest function on multiple pools in multiple during multiple times of the day so it's really annoying maybe for a devs to like send to sit in front of your your laptop clicking mathemask all the time right so that's first reason second reason it's not self-sustainable yeah yeah like protocol will need to live by its own so that's why we have something called chaining automation next slides yeah so the solution is basically technical dimension like decentralized smart contract execution environment kind of like doing devops stuff on on blockchain itself so how this thing works there's something called upkeeps so you're gonna create a new automation subscription and you'll again fund it with link because everything that nodes in the dawn is are doing uh they need to have some incentive for doing that like similar in ethereum where you have a bunch of nodes and they have like some people from gas that's why the nodes in the dawn needs to have some kind of award in terms of Link tokens right and then there's there's like two options so the option number one is actually to create time-based automation that's literally like scheduling a chrome job and that's it so that means that on every let's say you created the crown job that will execute your function every first Monday in the month then you can you know like create a mechanism where you like pay salaries in crypto to your your employees and every first month in the in every first Monday in the month sorry uh the function will be triggered right and you can you know like you can tweak those time frames but you're literally gonna set Crown job at our UI really simple and then you will have the complete dashboard saying okay these upkeeps happen before this is the schedule time for next one Etc uh this this is how this thing works so you have like uh automation nodes on the left then there is some upkeep contract which communicates with your smart contract on blockchain and that's pretty much it so from your point of view you will just need to create a smart contract whatever the smart contract is create a subscription and that's it that's for time-based automation you can go beyond time-based automation and create custom based automation with custom based automation you're in control of what's happening so for to create the custom based automation really simple so you will need to create to implement something called automation compatible interface and solidity and that interface consists of two functions only so the first one is check up and in 99 it's going to be a view function meaning it's free for you to consume it on a blockchain the second one is perform upkeep so how this custom automation works on each block or on each number of blocks on fixed time interval depends on the Chain nodes in the chain link done will ping your smart contract calling check up keep function uh saying do you need something for me so checkup Kip should return true or false if checkup keep return false nothing happens there is no automation needed if checkup keep returns true then the perform upkeep function will be automatically called by Don so if you want to create on-chain trading trading bot for example in checkup keep you will have like calculation what's the current price of this pair I have some card limit and if it's above this this value sell it below byte Etc so it depends on that calculation checkup capable to return either true and false and then in prefer map keep you're gonna just execute everything so we'll now talk about randomness let's talk about Randomness I'd like to talk a bit about when we are using link and where not like when we are was talking about the data feeds and proof of reserving this is a kind of public resources that everyone needed this so it's not you that is paying to get this information like you are only paying the guests to carry this in an opposite way when we are using automation or vrf or functions this is like it's your interesting you would like to have this information it's important for you so because of this then you are paying only link to use this information and in all of these Services you are paying on link and for example in automation that you execute a smart content later the guess to execute the smart contents will be converted from link to it to pay the guests and how about vrf so vrf is the verifier sales of remembrance and this is interesting why is so hard to get to Randomness with his smart contents first like I talked in the beginning blockchain is deterministic so if you add on chain the rooms to create your random numbers any validator can see that rule and then can try to manipulate it because of this if you have like the your rule inside the smart contact inside the blockchain this is not so good and if you try to have this outside it depends how you can do you must be careful as well like I said before when you are doing this like young chain the participants especially the validators can control the increase the chain link vrf it's external network of nodes that is creating the numbers for you and then you will receive the number inside your content and using the way that you'd like to have it talking about this and I will do a workshop Sunday midday no and my workshop you'll be using vrf and automation are you creating raffle and in this raffle I will at the end give away a ticket to smartcom that it's a conference that will happen in Barcelona in October so be prepared and you can see how it is working in practical way and before that do you have a workshop today I don't have a workshop I have a talk at 2 30 p.m oh he has another talk today and about about generating the vanity addresses in on for smart contracts on ethereum so nice and talking more about the vrf so why we use the vrif for example to generate some different nfts would like to generate different color of eyes or different heads or different bodies or different weapons whatever you can use vrf to the generated this in your nft collection or in a battle who you want who you lost and what's happened with this which Apple are using with the the weight of this something like that you can get how this information exactly with real ref for example put together use vrf uh to uh to get the winner because put together they have a pool that you can put your money and they like do some investment with this and then the profit you'll be to the winner that is selected by vrf entities that is important is light for you because this is the presentation if you'd like to see exactly the other care codes that are around you can see it here I can give this one more minute here do you have something to comment and you can put here no I think we will have a couple of minutes for questions so if we have some questions please prepare them so we can ask answer quickly because of the next talk yeah and are you ask something to you and the people can read the care code how to be a developer and advocate developer Advocate is both the best and the worst job ever like the best Planet because you're gonna travel all around the world Beyond various different meetups uh we'll be able to try brand new toys for chain link and also meet uh meet people in person but that can be really exhausted because of the traveling soul is currently on her European tour she's from Brazil she she's in Europe for for weeks I think now so you know like traveling overseas can be exhausted but it's really worth it yeah it's like a dream job like Andre toad this is my European tour I started in Barcelona first week of May and this is five weeks and I went to 80 cities so this is crazy but I really enjoy Jesus and I think to teach people and to make a difference for you how you can learn how can you be better and be together in the blockchain world and in the web3 space it's so amazing so important to us and this is this I'll remember again about the the functions it at night exactly after the event you can go over there and do dessert shop and learn a bit more yeah so we're going to do Hands-On workshop with laptops and after that we'll have casual drinks and maybe some snacks so we can uh me and Saul with some other bunch of people from chain link you can meet us in person actually yes do you have any question okay now it's time for questions maybe we have another slide for smart con or we can do that yes yes this is the oh you know that we have a hackathon here it's a perfect tree stature project here in the hackathon you will start in two days but after this if you would like to continue your project building new functions new functionalities you can go to the chain link online hackathon that is finishing 90 uh June 9 yeah so we'll have like seven days I think to submit which is plenty plenty enough time to to submit something yeah and like you I told you before I you give away one ticket to Smart calling Barcelona that will happen in October if you'd like to buy your ticket if you didn't want in the in in the workshop you can buy with some discount and I need to tell you that prepare yourself to not arrive you only want you arrive in the weekend before because we are preparing some amazing surprises for you especially for developers to to be all the weekend together so book your flights week before the the main conference okay I think that's it we have some tiny amount of time so for questions if you have any questions feel free to raise your hand ask really quickly and then we are going to give the mic to the to the next speaker thank you [Applause] okay first second yep they can do a query like send a get request and they can get the different response so if it's not something like numbers where they can just do it on average and agree on the average how do they come to consensus on let's say Different Strings or something yeah so when it comes to Randomness there is a paper called verifiable random function vrf it's like a I think like 40 pages paper which explains all the tiny details about how vrf functions but the essence is that you'll have a smart contract your request a Randomness from the Dawn and then there is another smart contract called vrf.

sol in the middle so when the Callback comes back from the dawn that smart contract has like all the cryptographic of cryptographic functions implemented in it in solidity which will literally verify that the random is indeed random by all of these parameters from the paper so the is that if you request a Randomness which is like a transaction number one if there is the Callback afterwards that means that that number number is truly indeed random so there is no consensus mechanism for randomness maybe sorry if I was unclear I was not asking about a verifiable random function I was asking like the custom functions where I input my own code and I defined the get function for functions yes okay so so at the moment like imagine that they are like four nodes okay in the Dom so you're gonna uh send a request so each of those node nodes will execute your code in its own serverless environment and then report the final result and then imagine that you have like a HTTP get request three of those requests were successful one was not so that means that we have three exactly the same responses and one failed so if you're using like median function that's three to one that's still a consensus it will return the Callback back if you have two responses one is different and one failed that's due to no response because there is no consensus yeah I get that but the question was like when I Define the custom function in the custom function function I say that the nodes will have to query let's say some database okay and their response is not a number it's let's say a string and when it will compare strings yeah okay okay but when that code executes on every node in the network when it's their time to run the query they may get different responses from the database that they query let's say I got a response on like on the first note like hello ethereum that everyone said hello polygon how did they come to consensus when the response they got was different yeah the majority of the response needs to be the same like three to one that's a consensus two two that's not okay okay that's everything so you need to handle that in your code base thank you any further questions we still have we have one question over there yeah can we just wait for the mic hey can you hear me yep yes cool our functions replacing external adapters or are you going to continue to have external adapters for now yes uh functions are like next step for external adapters because they can do everything that external adapters can plus more so they're still present now but you know if you need to have like some HTTP gets requests just use functions because that's more decentralized way yes one point related to this when we like the extent now adapted is to get information but you needed like to run a node or to have someone running the node creating the side FC and the this is like it's so many dependence of chain link itself when we throw if we start to use the functions you are depending of different nodes getting the same result but you are more flexible and get any information that's outside so this is the next step it's evolution any more questions going once going twice oh I think is this thank you so much everyone thank you very much [Applause] hello everyone it was really amazing talk and we're gonna kick off with Andrea novakovic which is from geometry and he'll be talking about zero knowledge in 2023 so without further Ado let's welcome Andrea to the stage

Automatic transcript — names and jargon may be misspelled.