Discover more from Blakells’s Newsletter
LayerZero & Stargate: A Deep Dive
LayerZero? Stargate? Star Trek? Wait… that can’t be right, that’s a TV series. Mom! They launched a TV series on the blockchain! Ok but seriously though, if you are reading this i’m sure you’ve heard of both Stargate and LayerZero (probably Star Trek too but that’s not the point).
Do you actually know the difference between LayerZero and Stargate? I didn’t. Do you even know what LayerZero actually is? I didn’t. Did you think Stargate was just some stablecoin bridge? I did. This article is going to be aimed at forming a concise but thorough deep-dive into what LayerZero actually is, the problem that it solves, how it solves it, as well as what Stargate is, and the difference between the two.
See right now if you have been in DeFi you will know that it is a massive pain in the ass to bridge sometimes. You have to go from one asset on chain A, pay gas on chain A, pay a fee on the bridge, then that bridge usually takes your tokens, and wraps them and deposits them on Chain B, so you then switch your metamask network to Chain B, and hope you have gas on that chain to either approve/accept your tokens on Chain B or use your wrapped (or native) tokens on Chain B that you sent from Chain A. If you don’t have gas, you usually have to either get the native gas token from a CEX or bridge a wrapped version of it. Not only is this a pain in the ass to do as a user, but there are like 10+ different bridges, over 10+ different chains, and each bridge has their own liquidity that is not interoperable or shared between the other bridges.
But wait, there’s more. If one bridge has 100m TVL, and the other has 1B TVL, naturally you would use the 1B TVL because they have better rates right? But what if that bridge doesn’t support your asset? Well… that’s life son. You ain’t using that shit. Well, what does this mean then? It means you could either use the 100m TVL bridge (if they support your asset in the first place), or swap your asset to a supported one on the 1B TVL Bridge, then bridge, then swap back to the asset you wanted on the other chain. I’m not even going to go through that entire process because it’s like 10+ steps and ideally i’d like you to continue reading so that when I start rambling about STG (Stargate) and ZRO (LayerZero), you’ll understand why I spent my sweet sweet time writing such a boring above two paragraphs. So without further ado, let’s get into it!
First, I will do a dive into what Layer Zero actually is, then after forming a fundamental understanding of it, we will get into what Stargate is. So, what is ZRO? As stated on the website: ZRO is “An omnichain interoperability protocol that enables the realization of cross-chain applications with a low-level communication primitive”. Ok fucking isaac newton over here, what does that even mean?
Think of it like this: Each blockchain is a Layer 1. For a Layer 1 to communicate with another Layer 1, you need a third party. This started with Wrapped BTC, but now works with many tokens. This is what has created the PITA bridging problem I mentioned in my boring paragraphs above. There have been many attempts at creating this “third party” in a multitude of ways, one has been your conventional two-way bridge like Multichain, or wormhole. Another way is through something like RUNE which is a whole other conundrum which we can get into later, along with IBC and stuff like Axelar as well. In essence though, the main course of transferring Token A on ETH to something like AVAX is to basically deposit your token on a bridge, then that bridge gives you WrappedTokenA on AVAX. So technically, if that bridge gets hacked, your wrappedTokenA on AVAX isn’t worth anything because the native token that backs it on ETH, is now gone. Congratulations, doesn’t feel good to get fucked by a third party now does it?
What if you didn’t need a third party? Welcome to LayerZero, the grass is greener here and you don’t have to rely on a bridge not getting hacked. Why doesn’t ZRO need a third party? Because in actuality ZRO isn’t a blockchain, or your typical bridge either. It doesn’t hold your funds hostage on one chain and then give you some wrapped version on another chain. It works like this:
There is Transaction A on Chain 1, a communication protocol between Chain 1 and Chain 2, and a message being sent across. If an entity can produce a block header for the block containing Transaction A, the other Entity can independently produce the proof for Transaction A on that block, and the header and transaction proof agree, then the message can be sent using the communications protocol with the absolute guarantee that Transaction A is irreversible. This is guaranteed finality by combining an Oracle (Stinky Linkies) which provides the block header and a Relayer which provides the proof. Each chain must have an LayerZero endpoint for this to work. A LayerZero endpoint is essentially a light on-chain client. This means ANY chain with a ZRO endpoint, can conduct a transaction with ANY chain with a ZRO endpoint.
If you would like an EVEN DEEPER detail of a step-by-step process in the very core components of how LayerZero executes in real-time, then I would like to refer you to the whitepaper as I will attach a link to it at the end of this substack article. Give it a read, trust me. It will blow your fucking mind.
What can you build on top of LayerZero? Good question. The answer to that is… literally anything that uses smart contracts. Yes, that’s right. You can build a Uniswap, SushiSwap, BentoBox, Trident, Curve, Yearn, the list goes on. Literally anything that uses smart contracts, you can build it on top of LayerZero, or in a more accurate description, you can utilize LayerZero. LayerZero is not a blockchain. LayerZero is not a bridge in a general sense. LayerZero is not a Layer 1 (no shit). LayerZero is a communication primitive that reminds me of TCP/IP way back before I was even born. LayerZero is a primitive that (in time) will be seamlessly integrated between every single chain. It can integrate into AVAX subnets, Solana, Algorand, Cardano (lol), and also any Layer 2 Rollup like Arbitrum, Optimism, Metis, etc…
Now, let’s move on to the current prettiest, hottest, sexiest girl in the room that all the dudes are throwing their hard earned crip-toe-current-sea (cryptocurrency) gains into : Stargate.
At first glance, I thought Stargate was just another bridge, but then I got to thinking and reading a little more. It turns out that Stargate isn’t really just a bridge. It’s actually a good bit more than that, and i’ll tell you why.
There is this thing called the “bridging trilemma” which basically entails that a bridge cannot offer all three of these things:
1. Instant guaranteed finality : Any transaction committed on the source chain will also be committed on the destination chain
2. Unified Liquidity : Where all connections deposit and with-draw from a single pool of liquidity.
3. Native Asset Transactions: The ability to never use wrapped tokens, and to only ever deposit or withdraw native assets relative to the source or destination chain
Not only does Stargate offer all three of these things, but it also offers something that I think is extremely important : Cross-Chain Composability.
This means that you can compose smart contracts not only on the source chain, but also on the destination chain. You could (theoretically) create a composition of smart contracts on the source chain, have those assets transferred (within the source chain contracts) to the destination chain, and have those assets interact with another composition of smart contracts on the destination chain, all wrapped into a single transaction. Neat right?
A few examples of what you could do with this:
1. You could create a yield aggregator platform like yearn, which can create an algorithm that scans potential yields on all chains, and finds the absolute best yields in the entire multi-chain-verse that abstracts away nearly everything and all you have to do is click “deposit” and all the work is done for you. Your money hopping from chain to chain autonomously confined within the smart contracts written out for the best yield strategies.
2. You could create a NFT/gameFi game similar to a few out now that has different aspects of it on different chains, all interlinked within each other. For example, you could host an auction for your NFTs on ETH, and create contracts that once those NFTs are staked, they are bridged to optimism or arbitrum where you can claim rewards, or initiate transactions extremely cheap.
3. You could create a DEX that has the ability to trade any native asset on any single chain (which is somewhat already happening but currently only for stables right now).
While there are many use cases for LayerZero, it would seem as if Stargate is the first and most logical choice. Even if you create LayerZero, which is a new communication primitive, you would still want a way to transfer assets from one chain to another. Stargate does not only achieve this, but allows much more than that. The way that I currently think about it is like this: If LayerZero is TCP/IP, then Stargate is HTTP.
LayerZero is the communication layer that allows the sharing of data between chains. Stargate is the layer that tells both chains what to do with that data, and bundles it up in one transaction.
In all honesty, i’m still wrapping my head around Stargate just like everyone else is. They released a whitepaper that contained their Delta algorithm on how all of this works and I am way too [redacted] to even begin to attempt to know what it means on an intricate level. I simply do not have the brain capacity to be as detailed about Stargate as I was about LayerZero because in all honesty, LayerZero is simple but elegant because it’s just a base layer. Stargate is an actual application running on it to the likes that we haven’t seen yet. It’s the next iteration in crypto. It truly is 0-1 technology that will forever change the landscape of how crypto operates over the course of the next few years. So let’s all take a breath, try to understand how cool this stuff really is, and watch it unfold (and hopefully not go poor from gambling while we do it). Cheers everyone, I hope this at least helped enough to warrant the time it took to read it!
Disclaimer: This is my very first substack and I went into quite the heavy subject (if I do say so myself) so if there were some things you thought were conceptually incorrect, please send me a DM on twitter @Buhlaque.
Stargate Website: https://stargate.finance/
LayerZero Website: https://layerzero.network/
LayerZero Whitepaper: https://layerzero.network/pdf/LayerZero_Whitepaper_Release.pdf
Stargate Whitepaper: https://www.dropbox.com/s/gf3606jedromp61/Delta-Solving.The.Bridging-Trilemma.pdf?dl=0