Chainlink 🛠️ Build Secure Cross-Chain Applications
ETHGlobal·Wed, Oct 9, 2024, 12:00 AM
Join Chainlink for a workshop on building secure cross-chain applications with chainlink CCIP! From November 17-19 2023, ETHGlobal welcomed developers from around the globe to take part in shaping the future of Ethereum at ETHGlobal Istanbul. Over $600,000 USD in prizes were given away at the prestige Istanbul Congress Center... thanks for an amazing weekend hackers! ----------------- Follow us: https://x.com/ETHGlobal?s=20 Check us out: https://ethglobal.com/ Email us at: hello@ethglobal.com
Transcript
[Music] I just prepared a new workshop 1 hour ago so I'm so happy that we have a new workshop yes so uh I will start with the demonstration part and then Andrew uh explain a bit more but before that this is the most important slide for you so get this now to be sure that you will have all the content that we we are doing with you so both of us are developers Advocates at chaining clubs I am from s Paulo Brazil I'm from Bel Serbia yes different parts of the word and yes we already did this and this and here we are before talk about chaining let's see our bounties we have five prizes we have a two priz prices related to ccip and also two prices related to functions we are not showing functions here but we are around all time so cont to us to learn more about function as well and if you'd like to use any of the other chaining services like data feed with st uh State change or VF or automation we we'd love love to see all of your projects so you can use all of them as well and this is another you already have the First Care code so the other are you pass fast don't worry about it but how the documentation all the information that you need is here because we have videos tutorials documentation and this will be the best place to you to start and this this Andre you like to talk about the web three platform yeah sure so I'm doing this during whole this weekend at week actually at Istanbul and often time I ask people like what chain link is and sometimes they will say something like yeah it's an oracle Network you can get off chain data and computation with chain link some of them will say yeah you can use price feeds data feits Etc but chain link is much much more than that if you weren't following the chain link Labs progress in the past year and a half you will probably miss that chain link is essentially grw to become something like web 3 platform so you have all of these services like price feeds is just a subset of data feeds so besides price feeds there are like nftd floor price feeds rting all volatility feeds L2 sequencer sub type feeds and more VF you already know that automation uh all stuff but since three weeks ago there is a new trigger for automation called log trigger so you'll monitor specific events from a specific smart contract and when those events get emitted you can do some something with them then data streams our latest product is basically a way to get prices but much much faster with low low low latency in less than a second so you'll get the price off chain provid that that that price as a call data and then you're going to verify that on chain against our verifier smart contract and get the price uh then CCP that's going to what what's going to be talk about that today proof of Reserve uh and finally chaining functions there is a special Bounty for using chaining functions a way for um executing uh any JavaScript code in a vanilla JavaScript code environment of chain and get the Callback on that uh end result on train to do something something like that plus more to come like Deco Fair sequencing service and more so follow chainel clabs on Twitter and follow our updates at smartcon yep so let's see what you have more oh yes so let's do our demonstration so Andre talk about CP later I'd like to do the Hands-On part first uh is this uh I know that it's hard to you to do with me but anyway I create this collaborative pad that you can right to follow me I add the code here for you okay so how you are starting I copy the code for you as well so this is the requirements we are starting doing an nft my nft will be on sepolia and also I have a destination Min on seia this is the Contra that you interact with my nft but I you send the mint comment from Fuji in avalanche and uh here I sharing all of this with you as well in the collaborative pad you can see that I have the Android gitbook it's so amazing to you to start with different parts of ccip and the leaf is over there as well is our community manager uh wrote a amazing article so you have a lot of content uh to be with us so first of all I need to have an nft uh and I think my nft is here in some place I will not to do it again it was like a bit um can I say the the network is busy now so I did this 1 hour ago and I did this uh five minutes ago let's see what I have in on this nft so is this I have on NF and the blue background means that this was on seia okay and this this if I M this from Fuji it will be red not blue this is idea you can see that that I was doing s before that I already this different nfgs so I put here all the requirements that you need to have and all the links as well and let's remember that we are rest starting on sepolia so I add this for you if you'd like to do this later and let's copy the code for you this is the code it's a fresh code done some minutes ago if you'd like to do you must copy and paste it this code and then you are deploying this here because I already did this like five minutes ago this is my nfg that you just saw it next next step that I must have is the uh you can see uh onc and I can share mine with you but remember that I told you that you must have a destination Minter and what is this if I come back here in my presentation it's important to to understand a bit of this so uh we are here so this is my destination M that is interactive my M how the communication part is doing by the hotters the hter are smart contacts that we have both chains and when I start the other part like in the blockchain that be Fuji my smart cont you send some some message the mage com to the SE blockchain then the without the C part that Andre you explain this better for you in a few minutes you communicate with the hter in the other part and my me com you appear here to my destination contract and meet a new nft this is our goal okay and this is let's come back here so I must if you'd like to do with me I must send to you the destination Min and uh talk a bit about this because this has two important comments for you like you can see here that my destination Min it's uh must have the CCP receiver part and I must have the underscore ccip receive uh function and here I take care of the message that I received receiving from the other blockchain so this is the MTO data this will be my mint command so this is the most important part for you here and I have some tests here that I was doing before okay so after this and deploying this uh you must pass the address of your nftg remember that well and after this we are going to the cersi blockchain this will be the Fuji and also the same uh and remember that because I'm interacting with the contract in the other chain I the parameter that I must pass is the address of my contract in the other chain so you can see here let's uh share with you this cinter as well here and you can copy everything that is between the beginning and the end the comments okay and here is the other part that I'd like to really uh share with you first of all this is my in the Constructor I haded coded our values but you can get on the CCAP documentation all the chains that you can interact it all the supported networks and here you can see that I'm starting with the outter of Fuji and I may going to sepolia and this is my address my contract and when I may uh how can I pay fees I may paying fees only the cersi blockchain and I I can pay fees using the native token or using link or in the future using other tokens so I pay the fees using the link token and here we are I have the mint on seoa so this is the important part for you you must use the encode with signature uh uh function mint address and I spent two days discovering that because I have any space here it was not working and he he soled this a few minutes ago for me thank you andry yes and it's this remember this and this is the comment that I miss sending to the other chain okay H be careful about the gas limit as well sometimes you have problems that your transaction go to the other chain but is not executed because of the gas limit I already got this kind of problems today so is this this is the point that I told you that the howed on this chain you get the fee uh the amount of uh link for example that I need to have in uh here to pay the fees in the destination chain so this is is still so important for you and this this this is only to render the balance I'm not sure if this is uh working right now I just deployed a few minutes ago yes I'm not sure let's see I clicked a few minutes ago and it wasn't oh probably I must refresh My remix and I do this and uh Andre can talk a bit more about CCP before that so where I must put for you I think it's this for you start with okay cool so what you just saw in a previous slide was that in order for you to use CCP you only need to be aware of these router contracts and there is one CCP router contract per CCP supported blockchain and that's it you're going to interact with with that contract and you can you will be able to send and receive cross train messages sender can be whatever uh account can be externally own account any smart contract anything receiver also can be any account like any wallet or any smart contract when it comes to uh transferring tokens any any address works if you want to transfer arbitrary data like solid then your smart contract must uh Implement that ccore CCAP receive function in order to decode that message and that's why she had destination Minter but that's for arbitary data only for tokens everything works now you can uh you can um you know CCP here can be as a black box to you and you can just interact with the router but if you want to uh if you want to understand what is current Cy going on under the hood while we are waiting for Sol's message to arrive it's basically this thing so your sender will send either data or tokens to the router smart contract so you will interact with the router smart contract if you're sending tokens then router smart contract will call on RAM contract that unram contracts will either uh either uh burn or freeze tokens on the source blockchain right depends on a token sending mechanism there are currently three to there are three token sending mechanisms two of them are live live third is coming soon uh then we have three offchain components so three offchain components instead of instead of one Dawn we have committing Don emitting uh admitting Don and risk management Network so committing Don is crial listening for the source blockchain and wait and waiting for a finalized tag so whenever finalized tag is uh is there it will recreate a part of Merkel tree with your transaction in it and report that Merkel Tree on a on a smart contract on the on the destination blockchain risk management network will monitor both both source blockchain and the destination blockchain and will compare its own Merkel tree with the one uh reported by the committing Dawn on that smart contract and we'll just compare it depends if everything's go well you should see the blast tag in the CCP Explorer page so that status will be automatically change automatically so you don't need to refresh that page but whenever you see blast that's good your message will arrive then whenever if if the status is cursed then the message sending of cross chain message will be stopped there so whenever blast is then we have executing done here which is monitoring now the destination blockchain for that blast tag and will uh send the the message so again if we have if we have token transfer then it will communicate with the offr smart contract to either Mint or unlock some tokens if not it will just pass to the router and then the router will Del deliver data and tokens to your smart contract now do you need to know all of this no so if you think about as CCAP as an international flight and if you're traveling from for example from New York to Istanbul you will go to checkin to check in your luggage and then you're just going to leave it then you're going to fly to the next uh Next Step maybe grab some coffee go to terminal Etc have a flight go back to go arrive to istano go to the passport control and then you're going to collect your luggage behind the scen since a lot of stuff will be happen same thing with the cross chain message so maybe they will open your luggage and put that label like as a security tag say like your luggage being open Etc or not but the thing is that if you take a look at a CCAP as an international fly the only thing that you're doing is interacting with the router smart contract and that's it checking your luggage and then collecting it in Istanbul and now we're going to see I think the the CCP Explorer but let me see how we are doing on time we have two minutes left so maybe we can give them opportunity to ask us some so if you have any questions yes no so that's why it's advisable when you go to mainnet to production if you go to our Docs to measure approximately how much will will your receiver smart contract gas will consume and then you're going to set that value you can also that do do that as a parameter and you can pass it as a parameter depends on what you're sending but it won be refunded question y yeah yeah so this is this gas limit is in gas units so I assume that those gas humit will be approximate if not I will suggest you to just pass it as a function argument and then you can put it conditionally and you can adjust it if needed if that's the case with that particular blockchain yeah yeah yeah but you will measure your destination blockchain function CCP re gas consumption you can do that with Foundry with hardhead plugins you can go to Alchemy they have a dashboard and then put some approximate value for test Nets you can just max it up to see that everything's works and then you can maybe benchmarking like that if that's easier okay cool any more questions yeah I not an expert and layer Z so I don't know I don't know yeah and any any more questions yeah so what you're seeing now is the CCAP Explorer so if you go to cc. chain. link it's kind of like a blockchain Explorer but for cross chain messages so you can monitor your cross chain messages in real time and this status field is what I'm talking about it's going to change dynamically from Source finalized to blast to success all depends on those tags uh when it comes to uh CCP cross chain message execution depends on a source blockchain and destination blockchain sometimes for example for Fuji to sepo it will take like 2 to 3 minutes but SE polio to Fuji will take 18 minutes or something that really depends on Source blockchain final finalized time and we're waiting for finalize time and if you again take a look at that example as a cross chain as a international flight again depends like when you're flying to depends on the like flight long flight distance and also if you're flying to from New York to Istanbul and from Istanbul to New York actually time different time flight of time will be different depends if you're like flying to East or to West but yeah maybe like a mental model for you guys and yeah you will see this NFD go so is this you realize that I didn't this now I did a few minutes ago like now my new contract I need to do something extra so when I did this and you can like see this that it was from a few minutes you can see that uh I have nft and it was really created some minutes ago okay 2 hours ago okay and is this you can see that uh I had that coded like the the blue for sepolia and the red when I come from Fuji and I just can interact more creating more later and I can show you later if you'd like to see this with more details but I put our code here as well for you and I think is this uh only to finish let's put this again uh only the QR code again if you need our presentation is here thank you so [Applause] much
Automatic transcript — names and jargon may be misspelled.