Exploring L2/L3 Orbit Chains - Why & How

ETHCC 7 · 10 Jul 2024 · 23:53

Mahsa Moosavi, an integration engineer at Offchain Labs, explains what Arbitrum Orbit chains are and why a team might launch one as an L2 or L3. She says Orbit lets builders customize the state transition, get dedicated block space and steadier gas prices, and change core parts such as data availability, the challenge period, governance and cross-chain messaging. She cites chains with onchain KYC and onchain fully homomorphic encryption as examples, then walks through adding a custom precompile to the Nitro node and registering the new WASM module root. In Q&A she discusses L3 finality and its security trade-off.

Speakers

Topics

From ETHCC 7, hosted by Ethereum France.

Transcript

And we're gonna explore how L2 and L3 works and how you can launch your Orbit chain with some customizations. So a little bit about myself. My name is Masa. I'm an integration engineer at the off-chain labs, which is the service provider to the Arbitrum DAO. And I'm also completing my PhD at Concordia University in Montreal, which focuses on DeFi. And this is my Twitter, this is my website. Please feel free to reach out if you have any questions about a talk or about Arbitrum protocol in general. I'll be happy to chat.

Alright, so let's dive in. What is Orbit? So at a very high level, I'm pretty sure you guys have heard or even used Arbitrum Nova or Arbitrum 1. So there's this very specific technology that is behind these chains that enable them to be very successful. Two of the most leading chains on the L2 ecosystem. And they have been live for quite a while. They have been getting a lot of users and TVLs. And what Orbit allows you to do, this is a very exciting program that it allows you to grab this technology that is behind this chain, and then you can go ahead and launch your orbit chain, either L2 or L3.

We will talk about it more later. And you can customize it in any any way you want depending on your needs. But if I want to be more specific, Orbit is really a permissionless way for you to launch your Orbitrum chain. It can either be an L2 chain that set us directly to the Ethereum blockchain, or it can be an L3 that settles to any Ethereum L2 like Arbitrum 1 or Arbitrum Nova. The other thing is Orbit gives you this extended ecosystem that is that includes like several chains that are interoperable with each other, and they abstract away the block space from their users when using the applications on different chains.

And abstracting away the block space from the applications is a very important thing, especially when it comes to usability from the product perspective. And as I said, these chains are fully interoperable with EVM. So if you have a decentralized application on Arbitrum Chain or Ethereum, you can basically go ahead and deploy it on any of these orbit chains, and it would be seamless. So it be basically the experience would be the same as you're doing it on Ethereum. And the last one is orbits are orbit chains are production grade solutions, meaning that you can either do your roll-up chain, launch a roll-up with a live working fraud proofs, and that would only cost for you like five to ten cents for uh transaction per hour for average.

And uh you can also do any trust, uh, which of course it's a lot cheaper, but you have to know that uh there's the uh overhead of uh launching your infrastructure uh for data availability, which would be called data availability committee. And there's also all sorts of customizations that you can do for your chain. Um you can, for example, have a custom fee token for your orbit chain, and um off-chain lab, like we're constantly providing, we're incorporating new customization into the core protocol, into the core repo that you can uh launch your orbit chain with. So you're constantly benefiting from all those customizations that we are incorporating into the technology.

All right, so it's good and all, but why would you want your own arbitrum chain? So we think there are uh like a number of pretty cool advantages for you to uh launch your orb orbit chain that they're worth uh exploring. But of course, they're not limited to what I'm going to explain. But I'm hoping that I'll be able to inspire you to do that. So the first one is uh with the orbit, you can uh customize the state transition. So in a previous talk, you've heard about the sequencer and how it works. But sequencer, as you uh as you learned, it it only responds, it's it is responsible for sequencing the transaction.

But the core component of a roll-up would be the state transition, which basically decides about how blocks are executed based on those incoming transactions. So, what you can do with orbit is you can go ahead and you can customize the state transition, whatever you want. You can do so orbitrum chains one and Nova, they both optimize for uh EVM compatibility, so they try to be EVM compatible, but orbit chains do not have to, so you can just go ahead and randomly do whatever you want. Let's say uh there's an EIP that you don't think the Ethereum would adopt, so you want to incorporate it into your chain, you can do that. Or let's say you want to have a native account abstraction, you can do that.

And uh let's say you have you want to have a permission chain with uh access control in place. Feel free to do that with uh customizing the state transition. So the possibilities are endless, as I said. The second benefit of having an orbit chain is uh orbit technology gives you an increased gas price reliability. So when you have an application on on uh Ethereum or like these main chains or Arbitrum, the cost of using these applications for your user, it really depends on what other applications exist on that chain and what they're doing. So right now, block space is relatively available for users on Arbitrum One, but this is not guaranteed, especially as we're growing.

So if you really want to hedge against uh limited block space for your user, what you can do is you can go ahead and launch your orbit chain, and that using that you can have a dedicated block space only for your application and for your user. Then you don't have to be worried about uh like I I don't know, like drop NFT dropping on the day that monopolizes the whole block space and increases the gas price. And the last one is we we did talk about customizing the state transition, but the other thing you can do is you can play around uh with the core protocol. Um so what you can do, let's say uh you want to have a different data availability system.

Uh you can add you can do that right now. We use the AnyTrust technology for Arbitrum Nova, and it's been live for uh two years, I think, and it's been really powerful, but this is not set in stone. You can do whatever you want. Let's say you want to use Celestia, uh, for example, or uh you want to change the challenge period, the challenge, how challenge protocol works. Maybe you want to like shorten the challenge period window, you can go ahead and do that. Or uh maybe you can you want to you want to change the governance system because Arbitrum 1 right now it uses specific governance system, but uh you can launch your own chain with a different governance model. The other thing is uh again, we heard about uh sequencing, decentralized sequencing.

So there's a lot of innovation going around in the ecosystem on short sequencing, decentralized sequencing. So what you can do is uh you can just uh shop around and uh find the best technology that you think works best for your chain and plug it into your orbit chain. And um the last one is uh I'm not sure if you you're familiar, but we have a specific cross-chain messaging system for arbitrum, which is called retrieval tickets. Uh, they're pretty powerful and complicated, but you can go ahead and come up with a different kind of cross-chain messaging protocol for your orbit chain. So, yeah, possibilities are really endless.

All right, so now that we talked about uh the benefits of orbit chain, uh I thought it'd be beneficial for you to uh hear about uh some cool customizations of uh some orbit chains that uh I think they've gone beyond uh the the like the simple customizations, and I thought it'd be uh interesting to talk about them here. The first one is the Rodri chain. Uh there are the L3 uh uh L3 orbit chains that are powered by uh by Arbitrum. They changed the protocol, I think they changed the sequencer code, and uh with that they were able to achieve on-chain NFT royalties. The the second one uh is the Kinto chain, which is an L2 again powered by Arbitrum, and uh what they did is they they changed the state transition function, so how blocks are produced.

So they come came up with custom pre-compiled smart contract to be able to build on-chain KYC uh uh yeah, as I said, at a at a chain level. And the last one is Phoenix, uh, which is an L2, again powered by Arbitrum, and uh what they did is that they changed again the protocol to be able to implement on-chain fully homomorphic encryption. So they try to bring privacy on-chain using the orbit technology. All right, so this is really cool. Next, I want to show you how you can customize your orbit chains pre-compile.

So we learn about all these cool uh things that orbit teams have been doing. And I thought it'd be interesting for us to walk through this quickly within the time of the work uh of the talk, of course, to see how you can do that. Hopefully it'll be easy and straightforward. So before we jump in, there are some preliminary preliminary knowledge that you need to uh learn. The first ones are uh what are pre-compiles. Uh you might be familiar with them, but very briefly, they are special smart contracts with predefined uh addresses on Arbitrum chain, and that they basically uh execute heavy functions and they try to optimize for performance. And um Arbitrum supports all those uh pre-compiles that Ethereum does, and it like and on top of that, it introduces some additional pre-compiles itself uh to handle the L2 specific uh interactions and functions.

So, what we want to do here, we want to create a custom pre-compile and add it to the core technology. And the other thing we have to again, I tried to uh explain that uh during the previous slides, but it's worth explaining again is the state transition function. So uh unlike the common misunderstanding about the roll-up, uh it's not the sequencer that decides how transactions are uh executed. And I'm I'm really happy that uh you were able to uh learn that during the previous talk. Sequencer is only responsible for ordering the transactions. So when that is done, there's this very important and core component of the rollup protocol, which is called the state transition function.

So what it does is it gets all these incoming sorted transactions and it executes them. It uh it's basically updates the state of the chain, it creates the blocks, uh which we call L2 blocks, and then that's it. This is really important. And there are some changes that you do on the orbit chain that doesn't touch the state transition function at all. But there are some, on the other hand, that they do change the set the state transition function, and that is a little more complicated than a normal customization. And uh changing the pre-compile is one of those, which I am gonna show you.

Uh so yeah, so I I brought some examples of uh some modifications that do not affect uh the STF. I thought it'd be uh interesting. Let's say you want to add a new RPC method uh uh to your chain that query and addresses balance across uh different uh blocks. So this doesn't uh change the SDF at all because the node with this change does not have anything to disagree with other change uh with other nodes. So we we're not touching the STF here. The the other example that does not uh affect the STF is uh let's say right now, Arbitrum sequencer uh it doesn't do any priority fee or any it doesn't get any tip or anything. So what it does, it just orders the transaction on a first come, first serve manner.

And uh what you can do is you can totally change this. So you can try to order the blocks based on some priority fees or tips. And again, you're not touching the set transition function, you're just touching how sequencer decides about the ordering. And the node uh does not have anything to disagree with other nodes. Why? Because it doesn't even know like the sequence of those transactions. So it has no other way just to uh other than like agreeing with other nodes. But there are some examples that they do modify the state transition function, and they are important to understand. Let's say you want to add a new EVM opcode or pre-compile, but we are gonna do uh in the example.

So this does modify the state transition function because now a node with this change would disagree uh with the other nodes uh uh because uh because this new opcode changes the whole fraud proving system and how this state changes over over blocks. And um the other example uh which I think again it would be interesting uh is when you wanna reward a deployer of smart contract with a portion of the gas that was spent during the contract execution or smart contract execution. Uh so this does modify the the STF because the node with this change would then later have will have a different balance for that account uh as opposed to the other node that doesn't have this change.

So with this in mind, we know that we're touching the set transition function. Let's see what are the steps. First, we have to create our pre-compile, of course. Second, we have to register the pre-compile, third, we have to create a contract ABI. And why do we have to do that? Because we want other smart contracts on chain to be able to call our contract. Right up to here, fine. We we cloned the repo, we modified everything we wanted. Now we know that we're touching the state transition function. So what we have to do at this space is at this step is we have to build a new nitro image. Nitro is the core core protocol, by the way.

And was a module root is basically the hash of the module that is being used for the fraud proofing. So basically, in order to be able to have a live fraud proving that works, you have to update your node and run it again. And once you get that was a module root, you have to register it inside the roll-up smart contract of your orbit chain. And I'm going to show you how. Sorry. Okay, so you uh you clone the nitro repo, which is a core protocol of uh arbitron one, and then um yeah, there there are uh there's a directory called precompile, which if you go there, uh you can see the list of all the precompiles that are uh especially for Arbitrum. Uh they're really useful, like ARPGasInfo, for example, is the one that we like we use a lot to get a lot of gas on-chain information about gas.

So you want to create uh your custom pre-compile here. So there you go, you just create uh a Go file, uh custom. This is a very simple custom pre-compile, and uh it's not for production purposes, I have to say that. And then um you have to now register your pre-compile. So inside that folder, there is a pre-compile the go file uh which uh you can go in there, and inside the pre-compile function, you have to insert your precompile. And by inserting, you're basically registering your smart contract. And then now uh the you go to the nitro contracts uh folder, and you can see that there's another pre-compiles folder there that has all those interfaces for all those uh pre-compiles that we have.

So you create an ABI of your contract there. Simple. And now comes the interesting step. Now you have to build a modified nitro node image. So you can do that with this Docker command, easy. And then to get the new WASA module route, you can use this for the sake of the time. I just tried to not do that live. And then what you have to do at this point, you have the WASM module root, you have to register it inside the roll-up smart contract of your orbit chain. So there are a variety of ways which you can get the rollup contract address, but the simplest one I just wanted for the sake of example, we wanted to bring it here.

Is if you use the orbit UI to launch your orbit chain, at the end of the day, it gives you all the addresses that are important for managing your chain. So the two addresses that we want here is the rollup address, which we want to register the WASA module root in, and the other one is the upgrade executor address, which is basically the address that helps you manage your orbit chain. A lot of uh updating and managing the orbit chains would be done through the upgrade executor address. So you what you can do is you have to uh basically call the set was a module root of the roll-up smart contract, but you do it through the execute call function of the uh upgrade executor address, and you have the new was a module root, and if you do that, you can use the foundry cast and you see that uh the new uh pre-compile that you added, it works.

But if you wouldn't have uh done all this like updating the nitro node and everything, this would have failed uh because the node would have disagreed with other and it would just crash. Yeah, so uh we have a lot of tools and resources uh for managing your orbit chain. Uh, if you go to the orbit portal, uh we have uh the orbit UI there, which basically helps you to run your own orbit chain, but in in a test net devnet mode. It's not in production. To do that in production, we uh strongly recommend everyone to go through the RASEs, uh, which are roll-up as a service providers. Using the UI, you can basically run your own orbit chain, it works, it instantly brings up uh uh even a block explorer.

So you can basically test everything inside. What you can do is we can another thing which is called orbit admin UI, uh, which basically allows you to do all those customizations, the like the one that I just explained through the upgrade executor, but you would do it through the UI, so it makes things a lot simpler for you. And then the other thing that we have, uh which I think is really cool, is you can go to the uh official arbitron bridge, and there's this uh bottom there which is called add custom orbit chain. So, what you can do is uh you can basically put your orbit chain there, and uh it it uh adds uh the orbit chain to the test bridge, and you can basically test the cross-chain communication and everything through the orbitron bridge for your orbit chain.

And uh the other tools and resources are um uh the SDK that we have, uh, orbit SDK for uh managing the orbit chains. I I told you that you can go through the RASE, but Orbit SDK has everything for you to launch an orbit chain and to manage the orbit chain. Uh we have the developer docs, which uh we go through every step of how uh orbit SDK works, what are the customizations, what what I just explained to you is all there. And we have an orbit monitoring tool which allows you if you run an orbit chain, it allows you to monitor your chain for all those L1, two and three retrieval tickets to make sure you're not missing any of them. You're you're able to redeem them if they fail.

And we recently announced the layer leap, which is a single step L12L3 bridging for orbit chain, uh which I think is really cool. And with that, uh I conclude my talk. Uh you can reach out to me if you have any questions or if you want to talk about anything arbitral later. Thank you. I think we can take one or two questions. Please uh raise your hand if you have one.

If no one wants to ask a question, I I want to ask one to you. Um as you said, uh there are a lot of um um possibilities in creating uh orbit chains, um, but uh I think uh it still needs a lot of um developing uh skills. Uh so is the goal of uh um off-chain labs to create um um more abstraction in creating uh orbit chains in in the future. Uh uh you mean to be able to enable developers to be able to customize the orbit chains and stuff? Um I I mean for developers to create chains uh without having uh developing uh skills.

Oh, totally, yeah. So yes, that's the goal, and we're trying we constantly try to update our documentation uh with a lot of information. What I just explained to you, there are tons of information about what I just explained on the docs. And uh we also have the SDK, as I said. SDK is a great source of example for you. We have different examples there in a modular way that allows you to deploy your chain, uh, create a custom gas token and all those things. And yeah, this is the code, and we're constantly incorporating all those into the core protocol, and we're constantly updating our documentation. We're also available on Discord, answering any questions you have.

There's an orbit chat on Discord, Arbitrum Discord. If you join, uh you have any questions, we try to answer and help you. Thank you. Thanks. Thank you. Uh any other question. Yeah, so uh with L3s, uh, do you have any concerns with like or is there any concerns to be made with uh with finality when it comes to uh finality time? Is it easy to figure out um when blocks are finalized and and um and like how how does it work? Like I'm just wondering.

Sure. Uh L3s have even uh I I cannot say faster, but cheap, you can you can spend less uh less gas on achieving uh faster finality. And that's because uh when a batch is posted on on a chain, it it the finality depends on how uh when it gets finalized on the parent chain, right? So when the batch is posted on Arbitrum, it's it really on an L3, the batch would be posted on the parent chain, would be the Arbitrum one, which is a lot cheaper to post the batch on than Ethereum, right? So I I believe I think L3s are faster and cheaper in terms of achieving penality.

And the other thing is uh uh very recently, I don't think it's uh even announced yet, but we're working on a fast finality for uh which is only still uh it's only for uh any trust chain. Uh but we're bringing we're shrinking down the challenge period window for for L3 chains, and uh that would open up a lot of possibilities for for those applications that want to rely on fast finality. But if of course, like it's always a trade off. Like uh you get a fast finality, but you're also kind of sacrificing the security to some level, right? So it really depends on what kind of applications you have.

Is it a gaming, is it a security important like application? Yeah, you have to do the due diligence and then decide. Uh thank you. Um I think we don't have time for other questions, so thank you again for for this talk. Thanks.

Related talks