#DappCon22 : Day 3 - Welcome To the Connected Cross-Chain Future, Kevin Neilson
DappCon 2022 · September 2022 · 20:45
Kevin Neilson discusses building toward a connected cross-chain future at DappCon 2022. The talk covers the infrastructure needed for assets and data to move between Ethereum and other chains as the ecosystem grows increasingly multi-chain, and what interoperability means for Layer 2 rollups specifically.
Speakers
Topics
From DappCon 2022, hosted by Dappcon Berlin.
Transcript
please welcome on stage Kevin from Moonbeam where he holds a role of a developer relations engineer Round of Applause please Kevin stage is yours thank you so much Max can everyone hear me okay awesome awesome well thank you so much to Marine and thank you so much for everybody who's made this conference possible it's one of the best I've ever been to so very very appreciative to be here and thank you Maureen for the invite so today I want to talk to you about connected contracts uh and I'm very excited to share with you this architecture for a new type of smart contract and I want to start with a quick introduction to a couple different
uh topics so the first one is uh polka dot and um you may already be familiar with polkadot polkadot is a layer zero it's a it's a blockchain of blockchains so you're not going to deploy your smart contract directly to polka dot itself instead you would Deploy on a layer 1 like Moonbeam which is running on top of polka dot so you probably know uh Gavin wood who's one of the co-founders of ethereum he back in 2016 with two other co-founders started with a vision for polka dot now uh it's a common belief you know that the future is multi-chain but back in 2016 it was very controversial to say
something like um you know the future is going to be multi-chain so they had this Vision early on and that has uh allowed polkadot to have many years of development uh based on this multi-chain vision and so what they thought was how can we build uh the architecture of polkadot to enable this uh multi-chain future and uh what they came up with was the relay chain and the relay chain is uh the layer zero which connects the blockchains that are running on top of it and then the pair of chains that run on top of the layer 0 are the layer one blockchains that provide specific functionality so it could be privacy could be decentralized storage could be
decentralized identity um or it could be connected contracts in the case of Moonbeam but these specialized chains are not Islands they're meant to be connected they're meant to talk to one another that's enabled by xcm and we'll talk more about XDM in just a second so for a quick introduction to Moonbeam Moonbeam is an ethereum compatible parachain on polka dot it's built with substrate which means that it's underlying architecture is different from that of ethereums but its developer experience and its end user experience are quite familiar more than just an evm we provide a huge
stack including a fully compatible web3 RPC so you don't have to change the type of request that you'd make you can send the exact same request to a Moonbeam node that you would send to an ethereum node such as eth get balance or eth get logs without changing any of the units or changing anything at all another thing polka dot provides a huge amount of functionality and features that you can inherit from as a parachain this includes things like on-chain governance forkless upgrades and much more however polka dot has a different type of account structure it's a completely different private key it's a completely different length of public
key and in order to access both these features of polka dot as well as the EDM you'd have to maintain two different types of accounts and so we made the engineering decision early on uh that this was not the ideal user experience and so instead we built a unified account structure so you can use a single ethereum account a single ethereum private key the same one that you have in metamask right now without any changes and you can interact with both polka dot and ethereum functionality and we also have a huge number of developer tools and Integrations so everything that you're familiar to working with that could be hard hat that could be truffle remix or scaffold eth it all works without any compromises and
they're not Forks either because of our commitment to maintaining ethereum compatibility none of these Integrations for require extensive you know changes or configuration they all work Straight Out of the Box so before I go any further I just wanted to mention uh that polka dot is a layer zero kusama is also a layer zero and kusama is a more experimental Network it's not a test net it has real economic value but it's a place where exploration and experimentation is encouraged and so uh there's a huge community of early adopters on the kusama network and so we've adopted a similar
brother-sister strategy for Moonbeam and Moon River where Moon River is the more experimental mainnet so let's talk a little bit about interoperability in polka dot and how xcm enables that xcm stands for cross-consensus messaging and it's just a language for a blockchains to communicate just as humans use a language to talk to one another and to be understood xcm is the same for blockchains so when you send an xcm message you specify a specific set of instructions these instructions include a couple different steps so if you wanted to transfer funds from one chain to another
you would include a series of perhaps five or six steps and some of the steps include paying the relevant transaction fees refunding any excess fees and things like that these instructions are executed in an xcm virtual machine which is a limited purpose virtual machine and it's also very lightweight and efficient so for xcm these instructions they they have to be able to be executed in an on-chain manner and so they have to be resource efficient and the other thing that's really neat about xcm is that it's forwards and backwards compatible so there are dozens and dozens of different pair chains that are on polka dot and kusama and if polkadot upgraded
a version of xcm and said to all the parachain teams you need to upgrade at the same time on Sunday at 2 A.M you know you can't coordinate all these teams to to upgrade at a specific time instead the teams can upgrade at their convenience and so the very first part of every xcm message the very first line is a version tag so v0 V1 V2 and that tells the destination chain how to interpret the rest of the message and so this means if there's a new feature or something like that um the chain what's left upgrade however what this means is that there it's never going to introduce a breaking change the
the chain will always be able to interpret the message correctly regardless of which version of xcm is running but before you can send an xcm message you do have to have a channel set up and a channel is a pipeline for communication between two pair chains or between a relay chain and a parachain and these channels they're one way means of communication so if you want to have back and forth communication you do need to have two channels and these are opt-in so the origin chain will send a request to the destination chain asking for this channel to be opened and then the destination chain will need to accept that and when I say accept that I
mean the token holders will need to Via a vote except the opening of this channel and you can see here that vertical message passing refers to communication between the pair chants such as Moonbeam and a relay chain and that's vertical message passing and then cross-chain message passing refers to parachain to parachain communication you can see right now all those messages are routed through the relay chain but in the future polkadot will introduce direct parachain to parachain communication um so that there isn't this extra strain on the relay chain there is a map here where you can see
all the live XM channels and these are changing you know on a weekly or perhaps even daily basis kusama has been around for longer and Moon River was launched in August of 2021 polka dot itself has had parachains live since about January of this year so that's why the polka dot section has fewer channels set up but it will be growing let's talk about connected contracts um and first I I want to recap so we mentioned that the future is multi-chain but why is the future multi-chain for one chains are becoming increasingly specialized so you might have a game or a death you might have
um any type of application that becomes large enough that it might require its own chain or you might have a layer two which is deployed you know to a brand new layer one perhaps so there are increasing numbers of chains out there there's also an increasing number of users coming into the space with that comes a demand for Block space um and uh another uh another idea is that Frameworks like substrate make it easier for you to launch a new chain they take away a lot of the complexity you don't even need to provide your own security especially within polka dot you can rely on the relay chain to provide the proof of
stake security for your application and so with this we know that as Time Marches On they're going to be more and more blockchains so if you were to ask a team you know yesterday or last month or at any time if you were to ask them you know what's your multi-chain strategy right the one of of the past has kind of been this centralized deployment model which is you pick a chain you deploy to it you announce to your users here we are come find us and users would have to get the native token of that chain perhaps through an exchange perhaps they would use a bridge maybe get a a faucet drip while using a
bridge and this is great for developers you have one place you have one chain and deployment to to maintain but pretty soon you want to grow you want to expand and you want to gain access to new users and so you might say we're going to move to a multi-instance deployment and a multi-instance deployment is exemplified well by Sushi swap Sushi swap has uh deployments across many different chains and um it's great to allow them to to access users on all these chains um but one problem might pop up and that's that they're fragmenting
liquidity across these different chains and what's more the developers have to maintain 16 or 15 or 20 whatever the number is uh different deployments across chains that's a very very difficult uh task for any team and although you can access these different uh chains from the same home page Sushi swap website you can access them from the same front end These Chains they know nothing about each other they don't mutually benefit each other in some way um and so there is a third option and the third option is a connected
contracts approach and so uh with Moonbeam via xcm we mentioned that you can access other parachains or other layer one blockchains uh within the polkadot ecosystem that includes not just bridging around tokens from chain to chain but that includes accessing functionality on other chains so that could be remote execution that could be making a contract call to another chain it could be using an identity that's stored on another pair chain xcm enables this type of interoperability within polka dot however we're not focused just on polkadot we want to allow our users to access functionality across many
different chains and that could be ethereum Cosmos Avalanche these are just a couple of examples but there are many many more and so the idea is that contracts that are on Moonbeam as a home base can access features that are deployed across many different chains and so another mental model to to think about this is that you're acting not just on local assets but on assets that could be on other chains you could be enacting swaps remotely to another chain as a as one example so the key the key Innovation that enables this is General message passing and general message passing is available
on polkadot in the form of xcm but there's also a couple different ways it's not just within polkadot we're working with axillar and layer zero and they're enabling connections between a number of different chains um so I like their definition uh axelar's definition of being a universal overlay Network they're across many different blockchains and uh you know new ones are being added uh on a very regular basis and so uh by sending a message to another chain you can do things like uh make a contract call and it's not that difficult from uh it's not that different from making a
function call on a normal chain uh the one that you're currently on the only thing that's different is you're going to be specifying uh the chain that you want to call the contract on and you're going to be specifying that contract address and you're going to be supplying a payload of parameters that you'd like to provide to that contract there might also be another parameter such as a gas refund address or you know another optional parameter that you'd like to provide I want to share with you an example of something that's already live and in production today and this is Lido's liquid dot contracts so you may already be familiar with staked ethereum and Lido was looking at the polka dot ecosystem and they wanted
to provide this similar type of product but for polka dot and polka dot does not provide a smart contract functionality on the layer 0 itself so that's where Moonbeam comes in and so what Moonbeam enabled Lido to do is to have a series of smart contracts on Moonbeam users can deposit dot on Moonbeam and then Lido can via xcm move that to the polka dot relay chain and then stake that in a native way there's no off chain uh anything going on all this is happening on chain in a trustless manner
and so keep in mind that polka dot and Moonbeam are separate chains so being able to call uh uh and make a transaction on another chain uh is a big deal and it really you know embodies uh the future of of connected contracts another example that I want to share with you is uh regarding Prime protocol and Prime protocol is building a D5 Prime broker so a prime broker you may already be familiar with but in the traditional sense a prime broker works with VIP clients at a bank and typically the VIP VIP clients will have all different sorts of assets
they'll have stocks bonds maybe a house maybe their cars or something with the bank and uh they might come to the bank and say I'd like to take a loan out against my collateral and the bank will say sure you've got all these stocks and all these bonds we'd be happy to give you a very reasonable rate because we have all these assets here when you're borrowing from a lending protocol on a blockchain typically you have a very limited subset of assets which you can provide as collateral and your collateral also has to be co-located on the same chain on which you'd like to borrow so typically if you have a lending and borrowing protocol on Moonbeam you would need to deposit your collateral into
that lending and borrowing protocol and as an example let's say you have eth you have Ethan ethereum you'd first have to bridge it to Moonbeam to posit it into the lending and borrowing protocol and then you'd be allowed to to borrow but what prime protocol is working on is they have this Hub and spoke model so they have the Hub which is on Moonbeam that's the brains of the smart contract so that decides how much you can borrow it decides all sorts of uh decisions such as any sort of liquidation decisions that need to be made but it also has satellite deployments on other chains so you can deposit your eth into a satellite contract on ethereum
and Prime protocol can recognize that deposit and then say okay great I'll allow you to borrow this amount on Moonbeam if there were any decisions that needed to be made such as liquidation or anything like that a message could be dispatched from Moonbeam to ethereum in order to liquidate some collateral why is this such a big deal because without having to bridge you can keep your funds on the native chain and you can also use a variety of different assets as well so you're not limited to one wrapped flavor of an asset and it's a better user experience you know for the borrower for the borrower and the lender
so overall right why are we so excited about disconnected contracts approach we're fundamentally interested in providing better user experiences we want users to be able to access features across a variety of different chains so this connected contracts approach is opening up features that might not be accessible to users before it also solves fragmentation issues where you can treat liquidity as more of a whole instead of segmented pieces across many different chains and it also allows for efficiency imagine instead of having to maintain deployments across 16 different chains instead you can have a deployment on one
chain where you can maintain and upgrade and iterate uh in one place and another benefit is to hide the infrastructural complexity and make it a much more seamless user experience so that's why we're so excited about connected contracts and to encourage this we have a hackathon called the Moonbeam connected contracts hackathon that's running until September 26th and we'll be doing another hackathon of course before the end of the year but you can access that website at moonbeam.devpost.com so if anybody has any questions I'd be more than happy to take them and you can
also access our our link tree right here [Applause] well apparently there are no questions awesome thank you very much yes thank you so much another round of applause and uh [Applause]