chainlink usa listings[Workshop] Introduction to Chainlink: Connecting external data to your smart contracts

Three Tokens Fighting The Bear Market: Ripple XRP, Filecoin FIL The total supply of Ripple XRP is fixed at approximately 100 billion coins, and the vast majority of these are owned and held by Ripple HomeHot Halo Yoga Wellness Hot Halo is an innovative new fitness studio where users can take Yoga, Pilates, and resistant band training classes in an infrared sauna designed for 1 person. max 2 if members are in the same household. Hot Halo is different from other yoga studios in that it allows class goers the freedom to take classes based on their schedule, an option chainlink usa listings [Workshop] Introduction to Chainlink: Connecting external data to your smart contracts
chainlink usa listings Terra Luna Price Prediction ,... [Workshop] Introduction to Chainlink: Connecting external data to your smart contracts
okay and we are up and we are live on youtube oh nope not quite all right great now were live on youtube so um awesome so hows it going everybody um thank you for joining uh really excited to be giving this workshop this ones me giving a workshop instead of one of our sponsors um and this is gonna be pretty much um the the general uh well not even the general this is going to be all the basics of chain link um theres going to be a lot of information in this workshop about blockchains in general um how smart contracts work how theyve evolved if you watch the opening ceremony its going to be a little bit more in-depth than what we talked about there but yeah thats basically what were going to be talking about and uh really excited to have everybody here so uh yeah you know like i said in the opening ceremony same thing here the world of smart contracts and the world of decentrality and the world of blockchain is is literally knocking on our doorstep right here history is going to show who will be the pioneers to push into this fourth industrial revolution and thats not going to happen though unless we can interact with the outside world on our blockchains um and and connect these smart contracts off-chain data apis and traditional payments so lets get through it uh will you do an example of how to use chain link i absolutely will so if youre brand new uh and you havent seen chain link work were gonna do that as well so good question uh ill be kind of taking questions sporadically uh feel free to drop a question in the chat happy to answer so uh in this were gonna go to uh through the smart contract connectivity problem how chain link already supports the growth of defy some untapped potential the tools you have to build chain link smart contracts and then were going to briefly look at uh actually were going to do an example were not going to do the price reference tutorial that will happen tomorrow but we are going to do getting any api uh into your smart contracts well do an example of that with remix so um and node.js will probably also wait for the truffle team um but we will be going into some technical examples here so um the smart contract cannot be problem in order to really understand chain link we first need to understand that smart contracts are not able to connect to external data or any off chain resource on their own this is a huge limiting factor for smart contract adoption because it means the only thing that we can currently do in a smart contract is token transfers right and a lot of you are engineers and youve come from engineering background and even those who arent um a big question will say well why cant we just get data the regular way engineers know um a lot of applications just use api calls so why cant i just make a regular api call and this is actually a really important question and the simple answer is that the blockchain is deterministic and it needs to be able to be validated by all blockchain nodes on the chain if making api calls is part of that validation process then each node would get wildly different results in the case you know the api is updated depreciated or even hacked so so they cant make api calls natively and if you want to see an example of that happening and a little bit more in depth as well i also video on youtube in that engineering series that says what is an oracle and that goes into it as well but um that leads right into this next piece uh so a blockchain oracle or an oracle is any device that interacts with the off chain world to provide data to smart contracts they report the result of that data on chain so the blockchain can stay deterministic and and this is really important so because this is where chain link actually comes in there are thousands of apis out there that are already providing data that people need in their applications chain link makes it easy to enable connectivity between those apis and smart contracts even if they require authentication so that now you have a decentralized applications powered by the same reliable apis that the rest of the world and current web technologies and applications use today and a quick note a single chain link oracle is also called a chain link node and ill probably be using them a little uh interoperably uh is that the right word ill probably be using them back and forth um and just so that you have that knowledge there now a lot of a lot of users today still dont quite understand blockchain and sending payments in cryptocurrencies isnt universally accepted yet so when a smart contract has executed people need the ability to get paid in a currency that they want so not just ethereum not just bitcoin and chain link makes it really easy for these off-chain payments to occur based on on-chain interactions this also works for cross-chain communication and sending payments to other chains as well chain link uses something called external adapters and again i just put out a video on external adapters if youre looking to to build one we also have a fantastic blog and the docs go over it as well well talk more about that later in a in in a future workshop so stay tuned check the calendar for that um and uh yeah and these uh enable connectivity to any resource be it an open api an api with authentication payments or another blockchain it works essentially as a wrapper around an api so you can take these upgrades to provide authentication processing or reduce on-chain costs and privacy external adapters are really really nice if you want to do something computationally complex but not on chain right we know that gas fees especially right now are really high so if you want to take that computation do it off chain thats where external adapters come in and theyre kind of this this key functionality that allows you to do pretty much anything external adapters are kind of that next level hey i want to do something really crazy on chain im going to use an external adapter to allow that to happen in a decentralized secure fashion so those are really important um stay tuned for the workshop on that also go watch the video on that if you want but yeah its really easy to introduce new functionality to chain link without needing to know anything about solidity or even ethereum because you can write these external adapters in any language so uh theyre really really powerful so now something this is kind of one of the key pieces thats really important to know uh and learn about uh when were talking about oracles a centralized oracle becomes a single point of failure for the entire smart contract this is why we create decentralized oracles and decentralized networks so this is something thats going to be really important uh when it comes to blockchain and when it comes to oracles having a centralized node is basically defeating the entire purpose of building a smart contract on these decentralized platforms now thats not always true you know if you if you want your centralized application to be centralized you can absolutely do that but dont make the mistake of thinking just because its built on blockchain just because its built on ethereum on a polka dot on tezos that its automatically decentralized right if you have any single failure points you now have a centralized application and whatever that node is whatever that data source is now has control over when your contract executes so this is really really important to know and the other thing that goes along with it is you know if you say oh im using a chain like oracle im now decentralized that also doesnt quite make sense saying a chain-link node by itself is decentralized its kind of like calling a tree a forest one chain-like node one oracle doesnt make up an entire decentralized network right so to make applications that truly never need to rely on a single entity you know be a company landlord government or anything of this sort you need a network of chain-link nodes and this is this is really important so and the reason that im im really stressing this is because weve are weve already seen attacks um on centralized oracles weve seen attacks and that have lost projects you know literally millions of dollars since their centralized oracle was hijacked and they were even using oracles that um had good intentions right they were using oracles that were not malicious but they got hacked and that single point of failure um cost them cost them greatly so when it comes to you know smart contracts the the whole purpose is to have this this trustless application and any time you rely on a single entity youre now trusting so chain link is designed to be a modular infrastructure and can build a decentralized network used to connect smart contracts to any any api you can select as many oracles nodes or chain link nodes as you like and use as many data sources as you like in order to trigger the execution of your smart contract and along with the decentralized oracles you should also have a decentralized set of data providers because if you have 15 nodes and theyre all calling from a single api again now you introduce that centralized point of failure again so i definitely need to keep that in mind as well quick question here do you not come across the same issue as ethereum with several nodes coming with different values per api call now were coming across different do you not come across the same issue as ethereum with several nodes not coming with different several nodes coming with different values per api call im not sure i understand the question here uh maybe you could rephrase but anyways im going to keep going um then again chain link also enables off chain payments to occur based on the execution of a smart contract so if the result of a smart contract said someone needs to be paid in you know 100 usd you can utilize chain link to send that transaction so um again you know this is that piece of connecting you know the the mainstream the people who dont necessarily understand blockchain or or have a crypto wallet you know you can do like that and someone mentioned that im breaking up a little bit um lets try to adjust my mic maybe thank you for that hopefully its good now so to get you started with d5 the chainlink project has actually gone ahead and found many of the best blockchain node operators on the planet and combine their prowess to build whats called price feeds or reference contracts or price reference contracts youll hear kind of those terms thrown around these are decentralized on-chain reference points that can be considered source of truth for various currency pairs like for example the price of ethereum in terms of usd each node in the network and you can see a visualization of that right here independently gets data from some of the highest quality apis and reports those answers on chain you can see the answers that each provider reports so everything is transparent many of the most popular cryptocurrencies or fiat currencies are currently supported so you can see in this visualization here all those dark circles those are examples of nodes uh that are returning data right and you can see uh this is a an older picture because the price is two hundred um but you can see each one of them uh returning a price and that the median price being taken to say okay the the price is now 196 dollars and we have this uh much decentrality uh this much confidence that this is the correct number uh so this is a really powerful uh a really powerful application and its also one of the easiest to use um and its basically like a pre-boxed decentralized network for you to use so its its really fantastic and its really really powerful so um currently these price feeds are already being used by some of the top projects in d5 uh around the world the proven safety reliability and power of these applications is a testament to the power of of chain link and reference contracts so you can see here theres theres a couple of of them listed like synthetic assets some lending and borrowing trading asset management theres 30 plus of these price fee contracts live 14 users securing critical infrastructures through this price data and again its its highly reliable decentralized transparent pricing contracts for the defy ecosystem this is just a quick snapshot of i think this was a couple weeks or maybe a week or two ago some of the top five projects in the d5 space so this is d5 pulse if you havent heard of it go check it out we can see ave synthetics and yearn are all using chain-link price feeds so three of the top five d5 projects are using chinle price feeds and theres a whole lot more and the reason is because its such a robust and reliable solution for getting decentralized data on chain so chain link price fees are securing you know literally billions of dollars and the proof is in the pudding right here so really powerful and heres a couple more stats synthetics 900 million dollars loop ring whos a sponsor definitely check them out as well uh theyre doing really cool things 20 million last time that i checked set protocol same thing and then ave you know passing that one billion market at 1.5 billion so um really really powerful stuff here ill take a quick question is there a list of chain link price feed providers um thats a great question lets lets even do that right now whoops can i go to this um there is so if you go to the docs and you go to using price feeds you go to price feed contracts this is a list of all the price feeds and their addresses and their proxy addresses right here so um the documentation and were actually going to go over this in tomorrows workshop you know how to work with these and some interesting things that you can do but if you want to play with them right now documentation is super straightforward and if you can get any any price feed for any test net well roxton rink being coven um and play with those here so uh good question um back to back to our main schedule here um chain-link vrfs uh for truly random numbers so this is another uh another really really cool feature um that that chain link offers and its getting reliably uh provably random numbers uh into your smart contracts because until now getting random numbers on chain has always been a huge issue since the current conventional way is to get a random number um based off of a block hash and youve probably seen like i im going to pronounce wrong cacao cacao 256 or basically the the solidity shea algorithm on chain and thats how people have been doing it and theyve just been hashing the current block um and doing it this way youre relying on the ethe miners for this random hash uh youre relying on this almost a centralized source because youre now letting this um youre letting the miners have this sense of control on whether or not they want to publish a block right if theyre in a lottery for example and the prize is a million dollars and they mine the block that could potentially you know win and it the the random number isnt theirs they can choose to not not post it right and youre now uh you now have this uh this great incentive for the miners to you know keep trying until they get you know an answer that they like uh and this is obviously not what we want we want to have uh provably random numbers uh without having to rely on on the minors or rely on anybody uh and so the chain link vrf is this fantastic tool for getting truly random numbers and you can prove that theyre random too um theres a little bit of cryptocurrency magic that goes in there im not going to go into that here but you can prove that theyre random numbers which is something that like it doesnt even make sense in your head um but thats basically the chain like vrf and were seeing more and more projects um starting to adopt these and were and a lot of hackathon projects in the past have actually used them and built something really cool with them uh and um were really barely scratching the surface here um you know getting random numbers is such a huge piece for uh for gaming and for um for literally anything that rng so uh really excited to see what you guys built or build with these chain-link vrfs um pool together um is is one of the uh one of the main products thats using chain link vrf there are no lost audited savings game where they give out money to two random winners based off you know say basically as a thank you for saving so really cool and were seeing more and more adoption and i should have put wild cards on here theyre uh this awesome uh contribution project but yeah a lot of really cool stuff happening with vrf um so this brings me to our next point uh we have a blog that gives a list of ideas to power your smart contracts if youre kind of uh humming and hawing over how to get started id highly recommend you go read that the blockchain space is literally thirsting for these new chain linked applications and you know let me just fire off a couple of my favorite uh from this blog you know the first one is literally anything in decentralized finance or defy weve seen a huge surge in d5 recently and weve weve barely scratched the surface right so it looks like the hedge fund um total assets under management is like 3.2 trillion and d5 has what like seven or eight billion right now so were not even close to scratching where the where the market is um so thats literally unlimited list fantasy sports and any type of sports games in general uh is really really interesting a lot of fantasy sports players pay on average 100 per league you can cut that price down by a fraction of a fraction even with these crazy gas costs uh and you dont even have to trust that the scores are are being updated fairly in odds being skewed and thats like the real bonus here is having provably secure odds and provably fair uh games is something weve never seen before a lot of simple games like texas hold holdem using chain-link vrf allows provably secure games and again you can cut the price massively down and and have these buy-ins be you know way cheaper than a major tournament you can split up your car plots of land shares of stock making it easy to track who owns what with having having to deal with any of the paperwork and since your data is going to be coming from a decentralized oracle no one can mess it up nobody has that that single centralized point of failure you dont have to worry about like oh somebody lost a um somebody lost the paperwork and now im doomed or something like that so im going to take a quick question from mr shane uh so those contracts are the aggregated price data from multiple sources is that right yes um thats right yeah thats spot on uh insurance is really cool and were starting to see more and more products use insurance this one really kind of hits home for me lets say that your crops are all messed up due to the weather and your insurance doesnt want to pay out because of some pre-existing condition or something right but the decentralized smart contract you dont have to trust that the insurance company is going to do the right thing since the right thing is infrastructural with chain links so its built into the core of the smart contract that they have to do the right thing so thats something really powerful and having this trustless insurance um so now were going to jump into the uh the chain link excuse me the chain link um the chain link example here that somebody was asking for and im even going to do it you know right from the documentation because the documentation is fantastic right were constantly updating it making it really good um if youre brand new you want to check out this example walkthrough this if you have no idea anything about smart contracts you can follow along here and and get something done um but were going to look at this introduce introduction to making any api so we can literally use remix to deploy this and we even have like a super easy deploy this contract with remix button uh itll bring you to remix for those of you who are unfamiliar this is a a web ide im going to make a little bit bigger here um so hopefully that didnt affect uh the quality um uh it looks like i i updated a whole bunch but so yeah so um you hit just and you can come to the gist that we just created i have two others in here because ive been playing around a lot but then you you have your smart contract built right in here and as you can see a really simple um use case for chain link is is a pretty small contract we have a ton of notes here if you ever get kind of confused or lost you can always come back to the notes but what this smart contract is going to do is its going to make an api call and its going to report the data on chain right and and again this is an example of using a centralized oracle so what were doing uh and and so so this is great for development this is great for practicing building something but when you actually go to production when you actually go live you know please dont use a centralized oracle please dont use a centralized um single centralized api because again you know thats again that defeats the purpose of smart contracts that defeats the purpose of decentrality in the first place so um what were doing just to kind of walk through the contract here um we choose our solidity version were importing the chain link client this is basically what allows us to to make these uh these api calls uh its the open source package there uh were inheriting in it to our contract and uh when we deploy this were going to set public chain link token which is going to give us the the chain link contract and were going to choose our oracle and were going to choose our job id so this is something thats that it takes a second if youre brand new so since uh chain link is this modular infrastructure of independent operators um oh sorry um since its this uh independent uh infrastructure you actually get to pick which oracles youre going to work with right so its its kind of like going to the marketplace and choosing oranges but instead of oranges youre choosing an oracle service provider which is a little bit weird but you literally specify im going to use this oracle and this job and you can learn more about where what oracle to pick what job to pick from whats called a node listing service so if we go to we can find a lot of different nodes im going to go into that in a little bit let me get through the contract but thats something that to think about so then were going to the main function that were going to do is this request ethereum price uh and this is where im going to walk through what this code does in a minute but this is where we actually you know make the api call we add these pieces to it um and then we send the the request once we send the request were not actually done so this this send request basically outputs um an event uh for the uh for the chain link node to read off of so it says you know the smart contract will post some data saying im data x y z and theres a chain link node looking for that specific x y z once it finds it it then makes the api call it does all the processing off chain and then once its done it actually calls this fulfill function so it actually makes a transaction by calling this fill function to post it back on chain in an external transaction so its almost like an async function if you guys are familiar with that so um your smart contract continues it its it it posts some data on chain off chain the chain link node picks it up does the off chain stuff and it posts it back on chain so we can say exactly what that looks like here im going to take a quick question if you were using multiple oracles would you specify that in the constructor part that you just mentioned um you could yeah you absolutely could you could put like oracle one oracle two something thats probably better that you would do and the reason that i didnt do it here is just because its faster is what you do is you do like address um address a address uh or you excuse me dude like address a um bytes bytes32 actually ill do address oracle bytes32 job you would build your function like this and then when you call this request ethereum price function um you would input your oracle and your button your job id and then you could just keep calling this function with the different uh with the different oracles and that would be the easiest way now youd probably also want to change the api to make it decentralized so you do like the oracle job id and then like string and it would be string memory because solidity um you know url so thats how you can make it decentralize then you can just keep calling this with different um with different apis with different oracles uh you could also theres also this thing called service agreements that were not going to go into here which also make this easy but um you know with this alone you have all the functionality that you need to make it decentralized so uh good question answer live whos paying the gas um whos paying the gas that the oracle needs to call to fill the function that is a fantastic question um im glad you asked that so the oracle is actually paying the gas because the oracle the chain link node is paying the gas the chain since the chain link node is the one thats making the external transaction back on chain its actually paying the gas and youll see the chain link nodes they actually have um like like max gas um limits so that if if youre going to do some crazy transaction back on chain theyll actually block you so um so thats a really good question chain link nodes are making the transactions so the chain link nodes are paying the gas who provides the api link if i need different data how do i get the link url to the data um that is a good question so theres tons of apis out there theres tons of urls out there this for example is an api im going to answer this live this for example is an api that gets us that gets us uh the price of ethereum in usd um and you can literally just look up crypto api or crypto crypto price api and youre going to get you know coin market cap crypto compare thats thats what were using right now uh nomics coin gecko these are our coin api these are all apis that are really really powerful that you can use and you can do this for any data literally like stock if you look up stock api youre going to get out vantage finha rapid api um uh iex ex ignite you know whatever data that youre looking for youre going to get an api so you can just google you know whatever you want api and you know hopefully you get some results if you dont you know feel free to ping us if youre looking for some really custom data um that maybe you have a really interesting use case but you know feel free to reach out as well um im going to continue with the demo and well get to those questions in a second so what we want to do and then hopefully i didnt mess up the contract at all by my my edits were going to compile it so this is going to compile it down to uh readable um and were going to deploy it so again im going to kind of pretend that you guys are all a little bit new here uh were instead of javascript vm were going to go to injected web 3. um javascript vm is is like a local way to test we want to test this we want to deploy this on a real test network because thats where the oracles are watching and my metamask account is connected if you dont know how to do that we have video on connecting uh to metamask and our documentation also goes over it we have ethereum we have some test that link so we can deploy this fine were going to deploy it confirm and we can see we get a transaction here on the coventestnet thats the the network that were using now and it should deploy pretty quick um for those who are new um when you deploy on uh on ethereum you have to wait a little bit for the um for the transaction to clear so were just gonna wait for it and it looks like its done great and in remix we see we get our our contract down here and this is these are all the functions that we can do to interact with the contract the orange ones are ones that we can call and these are the ones that are going to cost gas and the blue ones are going to be whats called view functions they dont cost any guess because we just say you know were not actually changing the state of the blockchain at all were just looking at what the value is so for here for example we have this ethereum price and right now its going to be zero because thats what it gets initialized as we havent requested the ethereum price yet um so thats when it gets started as now im gonna hit request ethereum price and were gonna run into an issue and i want to do this intentionally because its something that youre gonna run into the first couple times to try this before you figure out whats going on so were going to press this and were going to get this gas estimation failed error this is a this is a really generic error that you may run into a lot and it means a couple it could mean a couple of things it basically means you dont have enough um gas you dont have enough tokens to run this so most of the time when were talking about gas were talking about transaction gas and this is going to be the gaps required for ethereum to run your contract in this case were actually talking about oracle gas were talking about chain link so we actually need to um and again like it means it could mean that youre doing your your function is way too long you know you wont have enough heat to pay it or whatever but in our case we know that this contract needs link token because its interacting with a chain-link oracle so you can think of ethereum gas as transaction gas and then link token as oracle gas and thats kind of how it works so we want to copy the the address by clicking this button here and were going to send it some link token and i actually like auto piloted sending a link token sorry if i wasnt explaining what i was doing there 10 is definitely overkill but maybe were going to practice this a number of times um next and were going to confirm and were going to send it metamask will also give us this link to the transaction that we can check out and cool looks like its confirmed so now if we hit this request ethereum we should not get that gas estimation error because weve now funded it with enough oracle gas or chain link gas to run so were going to hit it and perfect we have enough chain link gas were going to confirm and great we get another transaction at the bottom so what its doing right now is its making is its posting in a transaction this or chain link request right and so on chain theres going to be this event that this specific chain link oracle this specific chain link oracle that we defined right here is going to be looking for its going to be looking for it to be called out and with its job id so now off chain theres a theres a chain link oracle that is processing it and its performing these functions which ill talk about in a second its making this api call and when its done in a transaction itself its going to call this fulfill function and that fulfill function will set the ethereum price to be the price uh which is going to be the answer to that api call so we can check to see if its done and it is which is fantastic um that we can see the price has been updated here from 0 to 338 you may be wondering why is it you know why does it look like ethereum is 33 000 um and thats because uh blockchain doesnt work with with decimals youve probably heard of whey and gray theres no theres no decimals on the ethereum chain everything is in whole numbers and this is intentional this is on purpose but in our build chain link request we actually multiply it by 100 to remove the decimal so the answer is actually um 338 and dollar sign and 61 cents so and then we know that again because we did we have this times adapter to change it and these are adapters im going to go into this in one second im going to grab a couple of these questions and then well go into what these adapters are and a little bit more about whats actually going on how come i cant see this chat the chat is disabled there is a q a feature is there any way answer live is there any way to access apis which require an api key without publicly revealing your api keys yes there is thats a great question um those are done with external adapters i literally just put out a video on it there is a workshop i dont remember what day but theres a workshop on it as well its a phenomenal feature definitely check it out external adapters is your answer is there a way to schedule requests so fulfill can be called once per day for example yes there is actually um it depends on how you want to do it so if you wanted to do that off chain um actually i think record chain like fulfillment means that you have to call the request though uh i would have to double check but um so phil can call once per day for example but yeah so you could have an off chain like cron job basically you know posting the data on chain i think you do have to make the request to allow this record chain link fulfillment um but you might actually be able to uh you could do something interesting where you could get rid of record chain like fulfillment you could have this fulfill function and then you could have your chain link oracle um just constantly having this update and you just do like a require um i forget the syntax like require um whatever your wallet address is equals uh you know chain link wallet or chain link oracle you could do something like that um yeah good question for example health data api yes you could use a help data api use whatever api you want i see eventually there will be something similar to stock markets on defy uh would the continuous api calls congest network and cost a lot of gas or is this something that the service agreements addresses um this is an interesting question so um im not sure exactly where youre going with here um yeah so so the more transactions that you make the more the more gas its going to cost so if were talk i im going to im going to assume your question a little bit here um im assuming youre talking about like maybe updating the price of stock um of a stock asset and what we would do there and what youd want to do there is something similar basically to the price feed so youd have a network of oracles um getting the price feeds getting these updates relaying it on chain um and that way youre youre really only having a small a network getting the price and you know unlimited people can then access it right so not you know if if theres hundreds of thousands of traders out there looking to get an updated price um theyre not all each individually the price its almost like a community like a shared resource i think thats a really good question um thats actually a phenomenal question and yeah the same thing applies for the the crypto prices and and in the price feed so so thats a phenomenal question thank you for asking is there a link faucet for the coven network there is absolutely and if you go to example walkthrough if my computer decides to load uh add your address in here we can even just do it real quickly because thats how we roll thats a motorcycle i think cool send me a hundred tests that link and um whenever this transaction completes uh well have it good question how much does it cost per link per request great question im actually going to jump into the the next piece that i wanted to go into with that question so in our contract here we defined our fee instance variable you went private fee and this funny math stuff basically just means its point one link right and this is gonna be in um i guess whatever the link equivalent of way is i dont think theres a name a name for it yet but the link equivalent away its gonna be point one link right and we can find out um how much to pay in in oracle gas based off of uh the nodes themselves so the the nodes um the nodes define how much their jobs cost and we can see how much their jobs cost by going into whats called node listing services market dial link is is an example of probably you know one of the best at the moment and we can go uh we can view a whole lot of stuff in here uh lets go view jobs and look for like this type of job which is going to be a get you in 256 because thats what were getting were getting you and 256 and we see a whole bunch of a whole bunch of jobs here and if we click on a job we can see the cost of that job right here so this job would cost point one link on the coven network uh we can compare it to other nodes it looks like actually most of them are 0.1 link but the node operator gets to pick um how much they cost oh this ones even less bhuta one point eight lake um point zero eight link so point zero forty nine one inch um so you can see oh even less so you can see kind of the different uh the different prices here oh excuse me this is actually maintenance um we actually would want to do coven for this um but yeah in any case um this is where you would get all the information on how to build your decentralized network so remember when we said were going to you know build this api call were going to send to this oracle this is a place where we can figure out which node we want to send it to so a really easy way to do it is you know i want to i want a job that gets me you went 256. um i find the job i check out the the job spec uh check out or the the task lists or the adapters these are the adapters that im gonna want um and ill explain what that is in a second but then we grab the the job id uh excuse me we grab the job id we grab the oracle address and thats where we would we would put it into here so so thats how we would do that what i was talking about right there is the adapters so each one of these jobs is going to define a specific set of adapters and this is defining what to do once you get the data so were saying once we get the data we want to do this http get request and the reason that im here is this this isnt um this isnt this oracle but the job is the same we want to get an http get and were going to add the parameters of that be this url were going to add the path which is this json part parse adapter to be usd and the reason we do that is because we only want to get the price we dont want to get this whole json we only want to get the price we only want to get this you went 256. so we say okay the path of this json is going to be usd so thats how we get that and then were going to multiply it by 100 so were going to move the decimal place over twice and then in here we have send the chain link request but we know then we actually do these two other adapters but we dont need to define it because it doesnt take any any parameters this one turns it into a uint256 to be readable by solidity and this ftx is the adapter that actually makes the transaction and posts it back on chain so really good questions im glad we talked about that and we can even test it out if this is correct we can even swap out this this job id and this oracle id and because it looks like theyre the same job and this is coven right and this is coven it even looks like theyre the same job so if we compile we should still um oh and then i have to redeploy we should still be able to pull the price with this new oracle and this will be example of pulling the price from a different oracle right so we deployed a new one now the price is zero uh we again have to fund this im gonna send it uh two link just gonna send it to link just in case we want to play around with it and whenever that deploys well get there can you show the chain link oracle code uh kind of um and by kind of i mean yes its open source i dont know if we want to so now im going to request um and then hopefully the same thing and this will be example of making an api call through a different chain link oracle and this is how youre going to you know youre going to make it decentralize youre going to choose your network here and again for those common things like you know any pretty much anything on the price feeds um youre going to want to use the prices thats thats a its a much easier much simpler way to build these networks of the common data but again you are absolutely welcome to do however you want chain link is an infrastructure to allow you to be as modular as possible so it looks like thats confirmed um were still waiting on the oracle to post back it looks like so whenever thats done uh this will be updated and ill answer a question while we wait for it to uh for it to do that so chainlink github if you want to see all the chain link code its all open sourced um thats why i kind of always said like yeah we we can because theres a lot here um theres a lot but yeah like i highly recommend you guys check it out if youre interested in the infrastructure side um its open source you can make issues you can make a pr you contribute you can do whatever you want its fantastic so im not actually getting the price updated here so maybe um maybe this this was a bad oh uh maybe this wasnt uh wasnt the same job um be curious to check that out um in a minute yeah it looks like that probably wasnt the job so so my mistake guys uh id have to recheck i didnt i kind of just glanced through it i didnt quite check to verify that it was the same job it might have been different but in any case uh on that contract address im not sure what that question means why do you need link to pay for chain-link gas and why cant eve use to pay instead so this is actually a really good question and a really interesting question and something thats really important to keep in mind is that chain link is blockchain agnostic right so its not just um its not just on ethereum right so the way that the chain link um technology works is its looking for uh for link token and this makes it so that uh we you dont have to rely on on a specific blockchain and and the link token is actually um required at the protocol call level and theres theres a technical reason behind it as well typical erc token 20s dont allow for transfer and execution of a smart contract in a single transaction while an erc 677 does with transfer and call so you know when a request is made the payload of um of that request is actually sent along with the token transfer im probably getting too much in the weeds here um but this is so that the node operators know exactly how much theyre going to be paid for that request and can respond immediately knowing that theyre going to be paid for their work it also separates the security of the chain-link network from marketing market volatility of some other asset you know unrelated to the network if it were ethereum for example then the security of the network could be reduced if eths market volatility um stopped working in our favor basically um and that also wouldnt work very well you know like i said because this is a blockchain agnostic environment where node operators need to know the prices of the same amount of work that they do on every supported chain so so you want a single easily reliable currency that theyre all going to use so it really secures it separates the security of the network um and and so that thats a really good question um but theres also that technical reason we would you know without it you lose that transfer and call functionality um so so thats thats a good question can a bad actor call fulfill to change the contract value outside the article uh no this record chain link fulfillment uh basically says only the responding oracle can call fulfill um good question thats a really good question wouldnt an oracle that charges less link than the gas cost to send a transaction to call for phil lose money yes yes they would lose money um so theyre highly incentivized not to do that um how long to get added to a node listing service do you need reputation or to stick around what does it take to set up a node i have some videos on that as well um the documentation on that is great too uh you can actually i dont think im signed in here you can actually create account on something like and post all your information about your nodes um it doesnt require anything so this again is just a testament to the robustness of the chain link system its not um anybody can join anybody can spin up a node you can spin up a node anybody can start providing data um something important to note um about this is that its not the same as just mining chain link right youre not mining chain link youre providing an oracle service to port off-chain data onto the blockchain so its not the same as just spinning up a node and start mining so it is it is really a digital business um so yeah so you can you can get listed on a node listing service right now um and is a great place you can also do uh is another um really fantastic uh node listing service that you can you know you can verifiably post information about your node including and this is for mainnet you know how much link its earned you can check out other other blockchains as well as loading theres a lot of data to load from the blockchain how much link youve earned the response ratio of those nodes and and this is actually really important because you can see the reputation of uh of other oracles of other nodes and this is going to become more and more important especially when youre talking about bad actors because you can see on on these reputation services and im excited for when you know comes out with this you can see when oracles posted bad data or or posted malicious data and you can quickly decide okay im never going to use that oracle um and so this again is just going more into the the security of the network these oracles not only you know are they you know secure because your networks are decentralized but these oracles are highly incentivized to give the correct data because if they dont that is that is posted on chain they are now uh permanently and immutably on chain for being a malicious actor um so almost think of it as like a credit score but for chain link oracles we should come up with a cool name like maybe data reliability score or something like that so really good question um what does it take to set up a node go check the chain link docs um i have a couple videos out as well you can get one spun up in in literally 10 minutes so its really easy getting getting a full production one is a couple more steps you gotta know a little bit about devops and you know its its its running a docker image so uh you wanna make sure you you keep it healthy at all times um like i said i have a couple videos out on this as well where do you find the arguments required in the request i see times get where do those come from so those are the adapters um and thats a really good question so when you go to so in the chain link docs the adapters tells you explains how to how to work with all the the different requests here so we saw like times the times right here is the the multiply adapter and we saw where do we see that and again this isnt the right job because i was wrong but we can see the different adapters here we see that this job takes an http get uh and then we know http get boom oh uh where is that parameters oh its down here sorry http get um it looks like this right so the parameters are going to be this get right here you can also do query params to add the query params after you can also just add it right in the url thats what we did so this is where you find the parameters whatever adapter the node is using you can look into the docs here to see what it looks like good question is there a contract that determines the cheapest provider so we dont have to hard code the provider slash job ids um no that might be an interesting um that might be an interesting project right there cheapest again cheapest isnt going to be the best indicator though because you could have a really cheap provider thats going to you know uh send malicious data so you definitely you definitely definitely definitely dont want to just look for the cheapest provider yet now that the wheels are turning um thats thats not a contract that i i would really want to use um maybe you could do some cool like machine learning to find the cheapest providers that are also the most reliable now that would be something thats really interesting but just the cheapest provider is a recipe for disaster um i dont know of a contract like that but that sounds really cool um so you dont have to hard code the providers of job ids you could also um you could also just have a costly updating list or smart contract that updates a list um uh that would be a really cool project actually um for for you know something like a hackathon i wish there was one happening uh oh wait that sounds like a really cool project i would love to see something like that i dont know of one there might be something out like there already when you fund the deployed contract does that mean anyone using that contract can make calls without funding it again great question um in this contract i dont have the modifier here but um actually do i already do i even have it here i probably have it here this is kind of a more thorough example um you can find this this excuse me this is a more thorough contract with a lot more functions and a lot more interesting tidbits uh you can find this in the example walkthrough which again is going to be right here um deploy your first contract if you hit this remix button this will deploy this this more involved smart contract and you can see here it has this only owner function and so this is kind of like a solidity function in general excuse me a solidity practice in general this is the its whats known as a modifier and were actually importing it through our ownable.soul here it modifies the function so that only the owner of this smart contract only the person who deployed it can request this update and again you know this record fulfillment wherever that is um record chain link fulfillment means only the chain link node can fulfill it so if you add these parameters you can make it so that only you and only the chain link oracle youre working with uh can modify your smart contract great question a couple minutes here um this works out really well you just showed how to get the eth price from one oracle how would you get the median price as agreed on my n oracles like the screenshot you showed at the beginning you get the price of from one oracle end times you know thats really it so um its a really good question so what you would do is you would find you know your your oracles that you want uh oh it looks like oh this is cool oh you guys are getting to see it at a really cool time so it actually just heartbeat just hit so all these oracles are going and get pulling apis and we can see them having dotted lines right here because its waiting on a response from each oracle so as each oracle responds we can actually see them real time respond with their answers and have their answers update and once we get 21 were gonna see this this update here so um so this is actually really really cool and again it takes a minute for the um the transaction to request them to to finish deploying and then once its finished deploying then they got to pick it up then they got to go make the api call and then they got to post it back in the transaction back on chain so this is actually really cool uh im kind of curious to see it finish uh deploying here but the answer to your question is yeah you would you would find the oracle providers that you want in a node listing service like you would have and you would pull the api for each one of those so a really good question um what are your thoughts slash opinions on more oracle providers like i dont i dont deal with that um what if and we have our first ones showing up here uh what if the oracle calls an api but the api returns a 500 and the film method never gets called does the user get their link back or does and we can see even more showing up which is really cool we can kind of see um im going to stop commenting on it its just its really its really interesting to me uh the oracle returns call but returns a 500 and the fill method never gets called does the user get their link back does the node operator get penalized uh oh oh this is even more interesting it looks like there was a price deviation and they had to call it again does usually get their link back does the node operator get penalized its same thing with transactions um you uh once you once you once its out there its out there so this is where this is another reason where external adapters are going to be really really important so youre going to want to build an external adapter um that handles these 500 handles these 400 handles these errors so that you dont have to deal with it so that you can um so you can build have all that custom functionality be in um be in the external adapter and handle handle do the error handling off chain because if you have to do the arrow handling on chain youre going to have uh to spend a lot of gas does the note operator get penalized i mean absolutely right we just saw that um interesting so ethans heath is taking off right now it just triggered another price update um thats really cool um yeah so so whenever your node doesnt post we can see on reputation we see response ratio here um if youre a node and youre we can even go to i dont want to call any oracles out though um if youre going to be you know not responding if youre gonna if youre gonna be not showing up for work you know youre youre sending you know when you when you fulfill these jobs you can think of them as the same thing as a job if youre going to not show up for work guess what youre going to get fired um so you dont want to not respond you dont want to do 500 errors because its going to look really bad the node operator obviously has some control here they can refuse jobs if they know someones just trying to um get their reputation lower but uh but yeah absolutely so your rep your reputation is everything so really good question here smiley face smiley face back to you tom um how would you deal with error handling in case a chain link node fails to execute a request thats kind of the same question thats a really good question when you make a robust system i would pretty much recommend you always wrap your um your calls in an external adapter because thats where you can do all this error handling thats where you can make a robust you can you can add retries you can add any customizable functionality you want and its all off chain you you can try to do some of that on chain um but its going to cost a lot of gas right because everything you do on chain is gas so you really want to offload that into an external adapter into an off chain functionality again literally today put out a video on on how to do that so uh if you want to if you want to literally a step by step on me taking you through an external adapter with api key authentication uh definitely check out that video we just put a blog out on it too the documentations are there as well um but yeah building external adapters is really going to be how its going to be super robust because yeah otherwise youre youre never going to be fully sure um if it if you know if there was an issue or not because the chain link node wouldnt respond and wouldnt put the data back on chain so really good questions uh it looks like were at five oclock right now um im happy to stay on for another couple minutes if anybody has any questions but it looks like there are uh there are no open questions uh im actually going to grab a quick drink uh and then go back to um go back on discord if you guys want to chat a little bit i got a couple minutes uh here today but uh thank you so much for joining um it sounds like you guys are really getting it like honestly those questions were really really good um i hope this was really helpful um and i hope you know you learned a lot here so really excited to see what you build for the chain like hackathon it sounds like you have a much better understanding of oracles and and how chain link works so uh so thank you guys so much for attending and ill talk to you soon ChainlinkDeveloperWorkshops,