Written by: planD (Twitter: @crosschaindude)
As a cross-chain bridge that has only been online for about two weeks, Stargate has reached a TVL (Total Value Locked) of about US$4 billion as of the writing of this article, and has become an eye-catching star project in the recent market. In this article, we will first review Stargate's underlying protocol and its core algorithm, and then combine Stargate's on-chain data and recent market trends to give some of our views and judgments on Stargate's future trends.
Note: This article does not contain any investment advice.
Stargate's underlying protocol: LayerZero
Currently, there are three asset cross-chain solutions on the market: witnesses, relays, and hash time locks:
"Witness" mechanism or "third-party verification", that is, to verify the transfer of assets through a third party. The role of the verifier is assumed by some institutions with good reputation, and the security risks caused by excessive centralization are eliminated through technologies such as multi-party signatures. Currently, cross-chain bridges using the witness mechanism on the market include Multichain, Synapse, AllBridge, etc.
"Relay" mechanism or "native authentication", that is, the information on the source chain is monitored by the relayer, and the record containing the encrypted proof and the block of the source chain are packaged and sent to the target chain. At present, the official cross-chain bridges of public chains on the market are most inclined to use the native verification method, including Near's Rainbow Bridge, Avalanche's Avalanche Bridge, Terra's Terra Bridge, etc.
"Hashed Time Lock Contract, HTLC" mechanism, pair the demanders of assets across the chain, and use the hash time lock algorithm to ensure the simultaneity and consistency of asset release, without the cost of trusting third-party witnesses. Currently, cross-chain bridges using the hash time lock mechanism on the market include cBridge, Hop finance, Meson, etc.
image description

LayerZero protocol schematic. Source: LayerZero white paper
(Steps 1 to 3 in the figure) UA (User Application, which can be understood as a contract of a DApp using the LayerZero protocol) packages the information to be transmitted and the target chain id on the A chain and sends it to the LayerZero terminal on the A chain ;
(Steps 4~5 in the figure) The terminal on the A chain sends the information to the designated relayer (Relayer), and sends the current block id to the oracle machine (Oracle);
(Steps 6~7 in the figure) The relayer accepts the proof of the transaction from the A chain (the "transaction" here refers to the generalized transaction in the blockchain), and the oracle machine obtains the area of the block in the A chain bulk;
(Step 8 in the figure) After the oracle machine determines that the block has been confirmed several times on the A chain, it sends the block header to the terminal on the B chain;
(Steps 9~13 in the figure) The terminal on the B chain uses the block header to inquire the relayer, and obtains the information initiated by the UA on the A chain with the transaction proof.
In this process, LayerZero's oracles use the third-party service Chainlink, while relayers are off-chain services that can be run by anyone. can be seen,The relayer is the "messenger" responsible for transmitting information, and the oracle is the "supervisor" for the relayer to transmit the message——As long as the independence of these two roles is guaranteed, the security of LayerZero can be guaranteed; and the oracle service Chainlink that LayerZero chooses to use is already the most mature oracle in the market, and the probability of collusion with relayers is relatively small.
The LayerZero protocol allows smart contracts to communicate between public chains, and it can do far more than a "cross-chain bridge" for asset transfers—in the future, we may be able to see cross-chain lending, multi-chain revenue aggregators, state Sharing and other DApps that greatly improve capital efficiency, users on any public chain will enjoy the ecology of all public chains, and developers do not have to work hard to deploy projects to each chain in turn.
However, before all this comes, let us take a closer look at the first DApp based on the LayerZero protocol - Stargate.
Stargate's Liquid Weapon: Delta Bridge
Stargate's best point,It is the use of LayerZero's ability to transmit information to connect the capital liquidity islands of various public chains, thereby improving the capital efficiency of the system.Specifically, Stargate users can only provide capital liquidity on a certain public chain, and Stargate's Delta Bridge algorithm can dynamically allocate these liquidity to other public chains, while ensuring the "instant consistency" of assets and "asset nativeness". These three properties are described by Stargate as "Trillema" in the white paper, that is, the triple dilemma. Their meanings are as follows:
"Instant guaranteed finalty" (Instant guaranteed finalty): that is, when a transaction is successfully submitted on the source chain, it must also be guaranteed to arrive on the target chain.In previous cross-chain bridges, the following situation may occur: two users of chain A and chain B transfer money to chain C at the same time, but the existing liquidity of chain C is only enough to provide one transfer; but chain A and chain B do not I don't know the existence of the other party's transfer demand, and I think that the liquidity of the C chain can be distributed to the users of its own chain; therefore, when the request of the B chain is sent to the C chain, it will be discovered that the liquidity has been exhausted by the demand of the A chain, thus The request was rejected - and only because the block confirmation speed of the B chain was slower than that of the A chain.
"Native asset transaction": that is, whether the assets received are native assets.In order to ensure instant consistency, some cross-chain bridges will issue "bonds" when the liquidity is insufficient, such as Multichain's solution: if the liquidity of the target chain is not enough when the user transfers USDC, anyUSDC will be issued to the user 1:1 first, Use anyUSDC 1:1 to exchange back to USDC when the liquidity of USDC is sufficient. This is a typical example of sacrificing "asset originality" for "even consistency", because when users get anyUSDC, they need an additional layer of trust in Multichain and the opportunity cost of using USDC to participate in DeFi;
"Unified liquidity": that is, whether the liquidity on each chain can be utilized uniformly.When ensuring "even consistency" and "asset originality", if more complex liquidity dynamic allocation algorithms are not involved, one can only build a liquidity pool between every two public chains, so the pool that needs to be built The number is proportional to the square of the number of public chains - this undoubtedly reduces capital efficiency.
Stargate claims that its algorithm Delta Bridge can satisfy the above three properties at the same time without having to make a trade-off. Stargate only provides one liquidity pool for each chain, and then virtually distributes the liquidity in the pool to other chains according to the pre-assigned weights. The allocation method follows the following principles:
If any channel on the A chain has a liquidity gap, the new liquidity will be given priority to fill the gap (here, "channel" refers to the "virtual liquidity pool" that the A chain divides for some other chain);
If there is any surplus after filling the liquidity gap, it will be distributed to each channel according to the set weight.
image description
Diagram of Delta Bridge status update. Source: Delta Bridge White Paper
The above figure shows the status of parameters on each chain when a user transfer from X chain to Y chain occurs. Each of these chains stores the following parameters:
$lp_x$ (liquidity provided), the amount of assets pledged by the user in the X chain;
$a_x$ (asset), the actual amount of assets owned by the liquidity pool of the X chain at the moment;
$b_{x,y}$ (balance), the liquidity allocated by the X chain to the Y chain;
$lkb_{y,x}$ (last known balance), the currently known liquidity allocated by the Y chain to the X chain. Note that this information needs to be transmitted from the Y chain to the X chain and stored on the X chain;
$c_{x,y}$ (credit), when the next transfer from the X chain to the Y chain occurs, the X chain informs the Y chain of the amount of liquidity that can be allocated—that is, the "cache" mentioned above.
The Delta Bridge algorithm itself is an "update mechanism for each parameter" designed to meet the "two principles" mentioned above.For a transfer from X-chain to Y-chain, Delta Bridge uses the LayerZero protocol to transmit only two numerical information: "transfer amount" and "cache", while all other parameters are automatically updated through the Delta Bridge algorithm. The detailed steps of the algorithm are cumbersome, and interested readers can read Stargate's white paper for further exploration.
So, can the sophisticated algorithm and mechanism make Stargate lead the new direction of the cross-chain bridge? Let's take a look at the data on the chain and see the choices of DeFi users.
On-Chain Data: Can Stargate Support 20% APY?
image description
Stargate Farming Benefits
Taking USDC on Ethereum as an example, its liquidity is $602 Million USD, and its APY is 14.48%. We can calculate the daily reward amount distributed by this liquidity pool as:
On the other hand, we hope to count Stargate's daily transaction volume and transaction value, so as to estimate the daily income of the cross-chain bridge. Although Stargate does not have its own transaction browser, it gives the Router addresses on each chain in its official documents, and we can count the transactions interacting with it on the blockchain, so as to count the transaction volume and transaction value.
image description
Stargate's Daily Transaction Volume
We can see from the number of transactions that Stargate's daily transaction volume is not large - the daily number of transfers on Ethereum is only maintained at an average of about 100; even if this amount is included in all 7 transactions supported by Stargate On the chain, the transaction volume of about 700 transactions per day is also much smaller than other cross-chain bridges in the market - Multichain has about 12,000 transactions per day, while cBridge has about 2,400 transactions per day. We also further found that the number of users who call the "Swap" method in Stargate's contract is much smaller than the number of users who call the "Add Liquidity" method, which means that more users are just Defi miners who want to grab the first mine, rather than the demand for cross-chain transfers By.
These signs show that there are not many users who actually use Stargate as a cross-chain solution - the new technology of Delta Bridge is not a supporting factor for Stargate's high TVL.
image description
Stargate transfer gas estimate
There is a large gap between the estimated fees obtained by the Gas Estimator at different times, and the Gas transferred from Ethereum to other chains fluctuates between 20USD and 100USD. We earn 50 USD as a service fee for each Ethereum transfer out of the cross-chain transaction, and the number of daily transfers obtained according to the histogram is about 100, then the Stargate cross-chain bridge gets a daily cross-chain service fee profit on Ethereum for:
This is minuscule compared to the daily mining rewards that Stargate sends out on Ethereum. In fact, the ratio of fee profit to daily mining rewards is:
In other words, 98% of mining rewards are obtained from Stargate subsidies.
We have reason to suspect that a high APR above 15% is unsustainable;And if Stargate cannot accumulate enough users and maintain the number of daily transactions at least a few thousand before the end of the high subsidy, then users may not have a long-term reason to choose Stargate.
Security concerns behind the relay mechanism
In addition to facing the loss of users that may be caused by the unsustainable high rate of return, Stargate also faces risks from a lower level—that is, the hidden security concerns behind the relay mechanism. On March 28, 2022, the LayerZero team updated the verification contract for cross-chain use, and after code comparison, the Cobo security team found that this update was a fix for a previous major security vulnerability——The code that exposed the vulnerability is the code of the core MPT transaction verification part of the LayerZero protocol, and is the cornerstone of the normal operation of the entire LayerZero and upper-layer protocols.The Cobo security team stated that although LayerZero has fixed the current vulnerability, it does not rule out the possibility of other vulnerabilities. As of March 28, Stargate is the first "superstructure" using the LayerZero protocol. If its huge liquidity pool funds are transferred by hackers, the consequences will be disastrous.
On the other side of the blockchain world, Ronin, the side chain of Axie Infinity, was not so lucky-on March 29, 2022, the Ronin cross-chain bridge was hacked, and the cumulative loss was 620 million US dollars. The Ronin chain currently consists of nine validators, and in order to identify a deposit event or a withdrawal event, five of the nine validator signatures are required; while the attacker managed to take control of four Ronin validators and a third-party validator run by Axie DAO device.
We can see that in the "relay" mechanism represented by the LayerZero protocol, the existence of relayers will bring possible security loopholes; while in the "witness" mechanism represented by Ronin, the existence of security loopholes is more extensive— —Multichain, O3 Swap, Wormhole Frequent hacking incidents in the past two years also confirm this point. At the same time, cross-chain bridges with "hash time lock" mechanisms such as cBridge, Hop finance, and Meson rarely have security problems—the fundamental reason is that users do not need to pay the cost of trusting third parties, regardless of Whether the third party is a big player, a developer, an institution or an exchange. We hope that in the blockchain world, we can see more ideas like "hash time lock" to solve the trust problem from the root.
References:
References:
[1] Code for counting Stargate DTV on Dune Analytics
[2] LayerZero and Delta Bridge white paper
[3] On-chain data of cBridge and Multichain
[4] Stargate's Farming and Gas Estimator
Note: Due to the interval between the writing time and the publishing time, some screenshot data in the article only represent the data at that time.
