Composing USDC into Crypto’s Universal Liquidity Layer with Chase McDermott
Ethereum Denver·Mon, Oct 9, 2023, 12:00 AM
Join our workshop led by Circle Engineering demonstrating how to build on top of Cross-Chain Transfer Protocol (CCTP). CCTP is a permissionless on-chain utility that enables USDC to move natively across ecosystems via a programmatic burn-and-mint process. Designed for composability, CCTP will empower developers to create mainstream user experiences that stack together the various functionalities of trading, lending, payments, NFTs, gaming and more. In this session, you’ll learn how to seamlessly integrate CCTP into your app and provide access to native cross-chain USDC liquidity for every user. 02/03/23 at the ETH Denver Buidl Palace Chase McDermott Follow them at: https://twitter.com/circle
Transcript
how you guys can kind of build on top of it um so what is cctp um today usdc is like a really cool utility that's spread out across a bunch of different blockchains but it's not super easy if you have you know a bunch of usdc on ethereum and you want to do something cool on Avalanche not super easy to do you have to go through either centralized exchange or some third-party bridge that may or may not be secure may or may not be fast so there's a lot of reasons why Circle wanted to build a utility like this um so when we started thinking about it the first thing that we knew we wanted to do is make this 100 native usdc so um a lot of third-party Bridges use like a wrapped version of a token on the destination chain um so there's a lot of wrapped versions of ustc floating around which isn't great that leads to user confusion liquidity fragmentation things like that so it's 100 native usdc meaning we actually burn the usdc on the source chain and mint the new usdc on the destination chain um the next thing is is Unified liquidity so we knew um UCC sort of has a liquidity fragmentation problem on some blockchains where there's maybe three or four different versions of usdc uh so we think cctp can really be that uh Universal liquidity layer in the middle uh so using usdc to kind of bridge across chains and then maybe swap that into a different chain uh or a different token there's a lot of different things you can do with it um we also wanted this to be fast so some uh Bridges today can take a couple hours maybe even a couple days to get your funds due to different like security models or different design decisions we knew we wanted ccgp to be on the scale of minutes rather than hours or days we also wanted this obviously to be very interoperable so we want this to be the same similar interface for developers to work with whether you're on an evm chain like Avalanche or eventually a non-evm chain something like Solana um we also wanted this to be mini to mini so if you have usdc on ethereum and you want to move it to Solana you don't have to go through some other chain uh any chain that cctp is supported on can move to any other chain that it's supported on that means like in the future once we support These Chains you could move usdc on Solana over to like usdc on arbitrum without having to go through ethereum or anything like that uh lastly we wanted this to be extensible uh so we want you know developers like you guys to be able to build on top of it uh extending the kind of composability that I'm going to talk about later uh to build this into your own apps um cool so diving into kind of how it actually works so at the highest level uh some event happens on a source chain in this example ethereum uh circles attestation service is listening for these events and signing a message basically saying yes Circle says this event happened uh the destination chain can eventually uh basically verify that that message is valid so once we have that attestation from the attestation service we provide it to the destination chain it ensures the validity of the message and knows that this event did actually happen on a different chain you can see in this model Circle just like it is with usdc is kind of like a trusted third party in the middle um meaning that the destination smart contracts just have to trust Circle to say this event happened um so diving in a little bit more into how the usdc transfer actually works and what the transactions look like so the first thing that happens as I'm sure a lot of you guys are familiar with is we have to call approve on the usdc contract um this basically is just approving uh that the token messenger contract can pull out some amount of usdc from the user's address into the contract wallet the next thing is on the token messenger contract on the source chain we call deposit for burn what this does is pulls that usdc out of the user's address and then burns the usdc after it does that it constructs a message that basically says we've earned x amount of usdc on xchain we now want to Mint x amount of usdc on some other chain passes that message over the message transmitter which will construct an overall message and emit an event once that event is emitted you'll take the message hash from that event to our attestation service so like I mentioned before this attestation service is listening for these message sent events and signing messages uh basically attesting that the event did happen so once you have the attestation from step three and the message from step two you can go to the destination chain you'll call receive message on the destination train message transmitter contract what this will do is basically decode the message then call the token messenger contract which will mint the new usdc it'll then lastly transfer the address specified in the original deposit for burn function call um should also mention that this received message validates that attestation that we get in step three just to ensure that circle's the one that signed it and basically proving that event did happen cool so looking at all those steps in sort of a diagram that shows how the contracts what the interfaces kind of look like so if we start there on the left on the source chain we have the user interacting with the token messenger contract calling deposit for burn if we go downwards that's where the usdc gets burned in the Fiat token contract which is usdc then we move upwards where we get the message sent event that gets submitted then we move to the Middle where we have our attestation service signs a message and returns it to the user lastly on the destination chain the user brings this message and the signature to receive message and it goes flows downwards until we met the new usdc to the user cool so now that we know a little bit about how it works with usdc um I'm going to talk a little bit about the kind of composability of cctp and how you guys can build them on top of it and how some of our partners are building on top of it all top of it already so at its core cctp is um kind of a low level interface and utility for developers to extend and build on top of so that means we expect cross-chain that's a new platform Bridges aggregation Services all of these kinds of apps to kind of build on top of and extend cctp to integrate it with their own existing or new apps so the first kind of contrived example that I'll show that's kind of more than just transferring usdc from one chain to another is a simple example where we have a user holding usdc on ethereum and he finds some cool new uh D5 protocol on Avalanche he says he wants to interact with it problem is he doesn't have any usdc on Avalanche so what he'll do uh this we can basically facilitate this in on cctp using just two on-chain transactions um you can also show it basically as just one transaction to the end user which is the transaction on the source chain uh if your kind of app acts as a relayer on the back end uh calling the receive message for the user so what this example would look like is this is a similar diagram to what we saw before except we've got two new boxes in the top right so the source chain and the off chain service in the middle those look exactly the same as they did before but now instead of interacting with the message transmitter contract we'll actually interact with the new contract that we're calling bridge to D5 for this example so this would be something that you would write that would basically call receive message on message transmitter receive this newly minted usdc and then immediately do something with it in this example like depositing it is depositing it to some D5 protocol or something like that um so basically it's just an easy way to show like we have one transaction on the source chain and then one transaction on the destination chain that's doing all of the minting for you and depositing it to some protocol um so what this would look like is just this is like again a super simple and basic contract not what something would actually look like but as an example we first call that receive message function on the message transmitter and then we deposit to some protocol Um this can also be extended to really anything you want to do on the destination chain so we've got some really cool Partners like Wormhole layer 0 XLR that are building some really cool stuff uh that it's more advanced than this doing really cool things like starting with like native eth on ethereum and then bridging over to Native avax on Avalanche using usdc as like the liquidity layer in the middle that goes across cctp another example uh that actually doesn't use usdc that kind of Builds on top of the generic message passing layer of cctp so basically at its like core level before you even bring usdc into it ccdp is a generic message passing layer what that means is you can build contracts on top of it just like we have with usdc that handle the minting and the burning and the bridging of your asset so this example again a made-up example of something where we've got like a play to earn game where you can plant some tree nft on ethereum but to actually harvest the tree you have to do something on Avalanche so you can kind of facilitate this cross chain process with cctp so what this would look like again similar to the first diagram I showed we've got a the message transmitter contracts stay the same that's kind of the generic message passing layer but now instead of like a token messenger and the usdc contract we've got some custom tree messenger and tree nft so what this means is the tree messenger would would receive the deposit for burn function burn the tree it would then go up get bridged across and when we call receive message on the destination chain we would mint the new tree nft again it's a made-up example like I know nfts a big kind of uh reason for nfts you can see the history and the owners and things like that so this obviously burning and minting new nfts doesn't make sense in that example but um just to show we can actually do this with more assets than just usdc cool so now I'm going to show a little bit uh of the developer docs just to walk you guys through what we have so far so if I open that up see so on our developer docs if you guys just go to developer.circle.com stablecoin docs you can also just Google literally like cctp docs and I think it's the first uh first exam or First Response there on Google so basically we have some background on cctp how it works how you can integrate with it we've got information on the contracts like our testnet addresses internet's being super slow so it's not loading um it's not going to load but internet's being slow but basically we've got contract addresses information about the contracts themselves how they work the interfaces that you'll interact with and then we've also got a quick start which is basically we've got some scripts in the GitHub repo that walk you through exactly how to do a basic usdc transfer so it has a script that will walk you through all the approve uh deposit for burn and receive message calls that I talked about before doing all this on testnet bridging some usdc over from ethereum to Avalanche we've also got some FAQs that help as well um so let me see real quick if I can connect to my phone to show a quick demo of what this looks like on testnet see if it's being so slow I'll just skip this and we can hop over to questions but let's see if this will load but basically we built a demo app that integrates with cctp on testnet that shows an example of how you could bridge usdc over from ethereum to Avalanche um it's behind our VPN it's not loading cool okay so like I mentioned this is a demo app we're not going to be releasing anything like this we're actually going to be relying on partners and developers like you guys to build this uh build cctp Integrations into your own apps um but this demo can kind of show what it would look like so for example we have we want to go from Avalanche over to ethereum we've already got our metamask wallet connected we can see on Avalanche we've got seven usdc and if we jump over to Gurley we've got uh nine usdc so at the end of this uh we'll now have we'll have 10 uscc on Gurley so if we start off we just copy our wallet address we've got the same wallet on both chains so this is the in destination address that we want to transfer to let's say we want to send one usdc first thing we'll do we've already called approve with like a high amount earlier so we'll skip that transaction so this is actually the deposit for burn transaction happening so to open up metamask and we'll see we're calling deposit for burn on our contract we'll confirm it so what's happening now is that transaction is getting broadcasted to the network and then circles attestation service will see the message that get event see the event that gets emitted from that message and signing the attestation and then on the back end we're actually calling the circle attestation service to get that at a station so at this point that's already happened it's done so now we have to switch our network over to Gurley and then call receive message cool so we're calling receive message here we'll confirm it and then pretty soon uh it'll be done we'll have our new usdc on Gurley like I mentioned before you can kind of skip this third step of the calling receive message for the user by if your app acts as like a relayer on the back end basically call and receive message for the user because their address doesn't actually have to be the one to call it so if we look at metamask on Gurley we've now got 10 usdc so it's super quick uh super easy to use we could transfer it back just as fast if we wanted to um but yeah so hopping back to the slides uh basically to wrap up like I said we're live today on testnet um on ethereum and Avalanche uh we hope to launch on mainnet in the first half of this year and then throughout the year uh hopefully add additional chains I think we've announced Solana hopefully will be coming eventually some other chains as well um so yeah that's about it are there any questions technical or non-technical anything really I was just going to ask you if you could go back to the previous slide cool thank you yeah and like like I said too uh like literally just Google cctp uh docs and it's the first result so yeah oh one more yep yeah so there are no like native uh fees built into ccdp so you're not going to pay Circle or anybody else any fees um there will just be the ethereum gas fee or whatever chain you're interacting with so one one fee on the source chain and one fee on the destination chain just yeah just typical uh transaction piece yep yeah this is a really cool presentation thank you I had a question so let's say that I have a chain that doesn't support um this the swap right can I consume the messages like can I like make my own receiver contract on that chain even though you can't like re-burn it you can just like consume usdc so you mean like for usdc itself or for cctp uh yeah yeah so like you know how you did like the um burn then the receive message so like this Con this chain doesn't have burn or doesn't have USBC at all but like can I just receive by like verifying the signature coming from Circle so basically our contracts on each chain have supported domains so for example like right now it would only have ethereum and Avalanche so if you deployed ccdp yourself and did something like that um it would it wouldn't really do anything because we wouldn't have the attestation service in the middle and you wouldn't be able to receive that on any chain um but yeah hopefully we'll be adding a bunch of chains uh relatively quickly so foreign all right thanks everybody I guess we've also got a really cool Circle Booth up there so if there are any questions later feel free to come check it out foreign
Automatic transcript — names and jargon may be misspelled.