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

Loading player…

Build Cross Chain Applications With Chainlink CCIP - ETHGlobal Brussels 2024

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join Solange Gueiros and Andrej Rakic from Chainlink, for a workshop titled, “Build Cross Chain Applications With Chainlink CCIP.” Why develop a project for a single blockchain when you can easily create a powerful cross-chain dApp? In this workshop, learn how to write secure cross-chain smart contracts and build advanced applications for the increasingly multi-chain Web3 ecosystem. This workshop took place during ETHGlobal Brussels, a 3-day hackathon held in Brussels, Belgium from July 12 to 14, 2024. ETHGlobal Brussels brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ---------------- Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com

Transcript

[Music] okay welcome everyone so we are here to talk you about chaining and how to build cross chain applications with chaining CCAP I am so and these are my networks and feel you to follow me and discover what we are doing what you do in the future and I came from Brazil and and yeah my name is is Andre this is my Twitter right tweet around about chain link solidity rust sometimes and this is my newsletter I started writing it pretty soon it's called smart contract design patterns it's about smart contract design patterns so if that's interesting to you you can you can set up yes so let's go we are starting talking about our boues probably you saw it before but uh you can choose two different tracks one is to use CCAP and the three best projects is can win uh 2,000 each or you can use the other chaining services and uh win uh 2,000 each we have it to two boun of this and maybe you can you are using more than one chaining service and you can win both of this it's possible and this is the most care this is the most important care code for you so uh if You' like to read this then I know that I have more care codes in the middle but it's everything that you need to to this h yes almost [Music] done okay so let's go and uh uh and I would like to talk about orac what that yeah sure uh so essentially Oracle is by Design any offchain component that can provide uh offchain data and computation so oracles essentially connect real world with your smart contracts and chain link is a platform uh for Oracle Services we have a bunch of Oracle services but essentially you have some kind of data sources and external resources and you can easily connect those with your smart contract whatever that is and then perform some computation on J perfect and the best related to oracles it's so important that Oracle have a decentralized Oracle Network because the way that you are bringing the information inside the blockchain is the key so even if the information came from only one se you can have a consensus to save this information inside uh your smart contract and uh let's talk about uh a bit about the chaining service itself so uh we have some servic related to data would like to talk about that and yeah sure so if you have been following training for a while or been in this space you'll probably say that training is an oracle service that provide Pride data price data but in the same way Internet is just for email or Amazon is just for books chaining is just for Price feeds so we have like much much more services than just price feeds like price feeds are just subset of data feeds which uh which can be like rate and volatility fits nft for Price fits all that other stuff uh so yeah all of these Services you can get using chaining and you will be eligible for hecton bound this if you use any of these and obviously we're here to here to help you so the other services that are not related to data for example VF can be used to generate you numbers also you can use automation to call any function inside your smart content with the rules that you can Define like you can Define the conditions or can be colored by uh one day or 1 hour or one minute or even related to some log if that log appear you meit that event then you can have some function be executed and also talking about functions itself we have the chain link functions that you can call any external API even if you have a secrets you are writing a JavaScript code inside the orat content and then calling that information and having this information inside your much content as well and uh remember that we are not a blockchain we are agnos and we are deployed our services are deployed in many many blockchains and what's CCP yeah sure so we have a specific Bounty for CCP and we want to spend some time talking about the CCAP so this is the high level architecture of CCAP and that's pretty much it what you need to know about CCAP at least for this kathon so there is a router contract so CCP router contract one router contract per CCP power blockchain and that router contract actually handles incoming messages so if you want to send a message crouching message that can be tokens data or both like programmable token transfers where you can transfer both tokens alongside some data then you can just call the CCP send fun function of the router contract and that's it pay for fees and similarly how you can send a package using UPS or FedEx whatever you just pay give them the package and they will handle the rest even if it's like a overseas flight or whatever that's why if you go back to the previous slide please uh you can see that in the middle we have a CCP which is kind of like a black box and in the documentation there's like a broader uh architecture of it if you want to take a look at it but essentially you just Outsource your your transfer of messages to the CCP and then the router contract on the other side will deliver the message eventually and we have explored to track this message transfer in real time and that's pretty much it what you need to know for CCP so this is probably the most important slide for you just understand it like this and that's it so and I doing a demonstration for you now so I transfer usdc from aalan Fuji to I use aalan Fuji because between the test Nets this will be the fastest to do here the other one maybe I cannot do like in five minutes and these are all the requirements to do that you have the slides the presentation so you have all of these you can do this done after also I'm using SDC from Circle so here is the circle fet and the way that you must get the address and add it to your wallet as well and this is the content that I'm using now you have this and it's time to go to do it so I deployed the content like one minute ago but maybe I can deploy again again and show both to you so this I made 1 minute ago and I'm doing another one just now so I'm here and I like to deploy and probably my metam mask is locked or no let's see it's everything right here should the play it's interesting when you are live and uh the things didn't work oh yes it's a bit slow only this okay so we are ready great so I'm deploying a new version of this if I scroll down let's see what's happen with my content uh meanwhile I'm importing the hter so my content is communicating with the hter that we showed a a few minutes ago and also I have the client to have the structures that I need to send the message I did one so I reject that um uh I have all related to UHC token also to interactive this and then here I may uh handle the errors here and I'm initializing this and in the comments you can use another thing as well because I put the way I got the chain so this is the hter that I'm interacting with this is the link because I decided to pay the fees using link and Andre where I paying the fees I paying the C destination happen yeah sure so you'll just need to pay for fees on the source chain whenever you send the message can be paid in link can be also paid in Native coins so just going to use message. value if you need or you can use the wrapped uh wrapped implementation of that native coin so that for example on on ethereum sepolio you can use wrapped eat as well to pay for fees and essentially you're just paying the offchain Dons to transfer the the message on the other side and that's it you just paay for once no spinning off any offchain components or nothing simple as that really perfect and I doing this using usdc so here I have the usdc address the token that I'm sending and I going to seoa this is the h destination chain selector this is for seoa and you can find all of this here uh that I have over there on my content as well so we are going from Fuji this is the hter this is the link token I going to seia so this is the destination chain selected everything is in our document a and okay this is the the event when I do that I'm initializing everything and this is the most important function that is the transfer I me doing this first and then I can explain this part for you so uh okay I Deo the content where is my content I think it's here this was just now I must do two things now first I like to have some link inside my cont to pay the fees let's do that so I'm here I'm going to tokens link send for my smart contact address I'm me sending like two or three yes it's a bit slow here it was better when I was not on the normal yeah what what she's doing now like her contract assumes that uh links are part of the contract itself so she's funding basically her contract but you can also just save transfer from uh inside a s function if you don't want to to have it like this so you're completely flexible uh when paying for fees just fi exactly you can see over there like if I go to my uh transfer function now you can see that first I'm creating I struct in fact is an array that I could even transfer more than one token for each token I must say the address of the token and the amount that I sending then that array of tokens you be here in the message this is the stroke of a message that we have in the client of CCP so the receiver can be any account because it's only tokens if it is like in messages as well a external account cannot receive a message so uh for this must be tokens and any data I could for example send the token and send a message what i' like to do with the token the other side I'd like to stake I like to do a swap I could do everything or anything here uh defining the apart and this is the token amounts that we said before and I don't need to have any extra argument here but for example if I'm minting an nft I mean calling the mint function in the other blockchain I must increase the gas limit and here I me telling that I me paying the fees using the link token okay and let's see what's happened here it is still waiting yeah I'm so glad that I did this before before because at least I have one done to show you and come back here you can see that the how is calculating the Fe to us so I am in the Cersei blockchain and the outter is going to the destination blockchain and getting the right fee related to the size of my message and here I can know how much I must spend in the C blockchain and I also checking if I have enough link on my content to pay that another part Point that's important I'm sending WDC so I'd like to be sure that I have enough WDC on my account so the usdc is not on Smart cont it's on my personal account my external account and this is the second part that I must do like I I must uh approve this contract to use my usdc so I came into to the Explorer in the address of the usdc here and this is the address of my contact now the new one that I just deployed and I'd like to approve to use one usdc is rning six zeros because we have six decimal places in some place here let's do it so I'm approving the content now after that the content will be able to get the usdc in my external account and send to the other blockchain yes it's really really sow now okay next approve okay this is what you are saying here I me checking the amount and transferring the amount from my external account to the content then approving the content to send it to the other blockchain using the hter and after everything is checked and everything is good then we have the CCAP hter sending the message to the destination chain selector okay we are almost that in that point let's see if it's confirmed yes so if I go here now I can uh use this is the last one I can transfer so I'd like to transfer to my same account or no I'd like to send another account and come back to the other because I only got the address so I sending to another account and it's the same one and 6 zos the decimal places I me sending from aalan Fuji to I click in on transa after I approved that uh we are explain more uh with a kind of overview of the other parts as well so I think we are only waiting now okay we are waiting so let's go to the presentation a bit more and understand this part so Andre what about to you to uh tell them what is happening now yeah sure so I'll try to do it quickly because we we're ring on all the time so this is the broader architecture from that previous slide so we can see here that she is interacting with the router contract on the left calling the CCP send function and now uh we are basically have three op components committing Don is listening for the events from onramp contract which which will interact with the token pools if you're sending tokens which is happening under the hood uh then uh it will uh post a report of that batch of messages on the other side to the commit store contract which you can Cann all see on this this screen unfortunately and then risk management network will do the same thing and also wot uh on that uh on that batch of messages so it can be either uh cursed or blessed if blessed that that's good that's what we want when we see a blast signal the executing Dawn will interact with the offr contract to Mint or unlock the appropriate uh the same amount of tokens on the other side and then the router will just deliver the message so that means for you if you want to limit who can call your CCP receive function you can put a modifier to say that only router can call it and that's pretty much it yes amazing let's see what's happened on partic because I already sended the transaction if I got the idea of my transaction and came to the CCP Explorer probably hope the search is finalized and we are in the moment that we are blessed maybe let's see I don't know maybe it was fast it's looking for my transaction now okay so uh it's being like um uh we have uh oh yes now yes okay we have the search finalized and we have two minutes here to wait me why we are waiting so let's come back here and uh talk about okay I'm waiting but uh we are in a hakon we must be do everything so fast and you don't have time to wait so use the local simulator yeah sure so if you go to our GitHub train link Das local is the CCP local simulator so instead of building directly testnets we can see now that we're waiting waiting for transaction to complete on a test net but imagine that you have a bug or a flow or something in your smart contract then you will need to redeploy deal with gas with faucets with tokens with all that stuff with chain link local you can literally build locally in hardhead Foundry or remix whatever your development Choice uh is and once you're ready to move to testnets then you can easily move to testnets and we have a brand new facet for that where you can get multiple different tokens multiple from multiple different blockchains to multiple different receivers on the same request which which is pretty cool pretty powerful yes and this is the m chain M fet yeah looks like this so just select I want this amount of token from this chain this chain that chain this receivers hit request and that's pretty much it you're ready to move to so why ccip is your interoperability protocol uh so we have this local simulator this new faet moain you don't need to run any kind of of chain infrastructure and you can send the message uh and the tokens in the same time so we can have this kind of programable token transfers and uh remember about our Bou again the two wrap up uh we are uh you can use this with AUM Arbitron bases Sal and polygon they are here as well they are sponsoring and maybe you can win both bounties because using then and using us and only to finish let's go to the oh the here the presentation if you didn't get the presentation yet you can get it now and yeah if you have any questions or anything will'll be around here or at the boot because we're on of time sorry okay and this is probably this is done let's see finish that's it thank you guys [Music]

Automatic transcript — names and jargon may be misspelled.