Cross-chain bridges that are no longer esoteric: a complete explanation

The full text is 7050 words, the estimated reading time is 17 minutes

Article overview01 / Why cross-chain is needed02/ Five stages of cross-chain development03/ 3 basic operating principles04/ 3 verification mechanisms05/ Mainstream analysis dimension of chain bridge06/ Security analysis of chain bridge07/ Third-party bridge Representative Project 08/ Hacking Incident Analysis 09/ Summary and Outlook

Why do you need cross-chain

The existence of the cross-chain bridge is actually based on the core assumption of the multi-chain ecological pattern in the future. The significance of the cross-chain bridge is to promote the flow of assets and information on different blockchains.

Ethereum is designed so that applications and protocols built on it are limited to each other and inevitably compete for underlying resources, resulting in high gas fees and slow transaction speeds. Because ETH2.0 needs a certain amount of time to complete the research and development, there will be multiple “Ethereum killer” public chains in the market in 2021 to absorb funds / establish an ecosystem, such as Avalanche and Solana. The rise of the multi-chain ecosystem has shared the pressure of Ethereum to a certain extent, but it is actually eroding its leading position.

Despite the bear market, Ethereum’s return to relatively reasonable gas fees and transaction speeds has diminished the momentum for capital outflows. However, according to the data of Defi Llama in July and the market share of each public chain based on TVL lock-up volume, Ethereum (the blue part) has dropped from 98% market share in early 2021 to 62% in July 2022 . Although in May, due to the collapse of Terra, the market share of Ethereum rebounded from the lowest point of 55% to 64%, but the market share of Ethereum has gradually declined. In the short term, it seems that the multi-chain ecology is still an irreversible trend. Among them, Tron relies on the JustLend protocol in the bear market to make the market share steadily listed, which deserves further attention.

In the medium and long term, user flow is inseparable from the overall quality of the ecosystems of each chain. End users will vote with their funds to achieve a relatively balanced competition between chains. Whether the multi-chain ecosystem is prosperous or not depends not only on the number of projects, but on a comprehensive evaluation of the user’s activity and the continuity of funds.

Market share of each public chain of Defi Llama (by TVL statistics)

Five development stages of cross-chain

Composable Finance proposes five stages of development for cross-chain interoperability:

Cross-chain bridges that are no longer esoteric: a complete explanation

  • 0-20%: realize the most basic cross-chain communication and inter-chain token movement;
  • 20-50%: Users can provide liquidity for assets on different chains to maximize returns;
  • 50-75%: Projects like Aave enable users to deposit collateral on one chain while lending and borrowing on another chain. That is, to realize the communication between applications of different chains;
  • 75%: A single application deploys its different parts on multiple chains, making each part run on the most efficient chain. The backend packages of these different chains will communicate with each other to ensure the continuity of the user experience;
  • 100%: Ecosystem agnostic, providing interfaces to the broad Web3 ecosystem. Traditional developers can arbitrarily deploy applications powered by Web3 tools on-chain without complex blockchain programming — abstracting away all the complexity.

Three main operating principles of the cross-chain bridge

Atomic swaps

When user A has a cross-chain requirement, the cross-chain bridge will match/find another user B’s corresponding opposite requirement on the target chain, and the two parties will perform point-to-point matching and asset exchange. At the same time ensure the safety of funds.

The following uses user A’s 1 BTC to exchange with user B’s 20 ETH. The specific steps are as follows:

  • User A generates a random password r, calculates the hash value m=hash(r) of r, and sends the m value to user B
  • User A initiates a conditional transaction to transfer 1 BTC to user B. User B must show the password r at the preset time to succeed, otherwise the transaction will automatically fail
  • User B initiates a conditional transaction to transfer 20 ETH to User A. User A must show the password r at the preset time to succeed, otherwise the transaction will automatically fail (User B creates such a transaction that shows r as a success condition) , you don’t need to get the value of the password r, you only need to know the value of m to create it. The hash operation is irreversible, knowing m cannot calculate r)
  • A shows password r and receives 20 ETH, while B gets password r and gets 1 BTC

Advantages : The use of the hash time lock mechanism makes it impossible for funds to be stolen, high security, no need to reach a general consensus, no need for external verification nodes, faster cross-chain speed

Disadvantages : The application is relatively limited, cannot support general data transfer between chains, its status is poor, and the cost is relatively high. Each cross-chain transaction may need to deploy a smart contract with a hash time lock. Both parties to the transaction must be online at the same time. If you can’t find a counterparty, there will be a long waiting time. It is not suitable for large-value transactions, and it may not be possible to find a counterparty to provide sufficient liquidity.

Lock + Mint/ Burn Lock + Mint/ Burn

The cross-chain bridge locks user assets in the original chain, and mints/destroys the same amount of synthetic tokens in the target chain and transfers them to the user’s account in the target chain, thereby completing the cross-chain transfer of asset value. A typical example is encapsulated BTC on Ethereum.

Advantage : no requirement for liquidity

Disadvantages : Asset security depends on network verification nodes. If the verification node is malicious or controlled by hackers, it will cause serious economic losses. The encapsulated assets are essentially different from the original assets, the asset liquidity is poor, and the encapsulated assets have the possibility of potential price collapse sex

Liquidity replacement Liquidity pool

The cross-chain bridge deploys the smart contract of the source chain on the target chain, transforms the target chain into a side chain of the source chain, and realizes the information transfer between the two parties across the chain. The project party will establish liquidity fund pools on different chains. On the one hand, users can directly exchange native assets on another chain through the fund pool. On the other hand, Liquidity providers can also exchange some cross-chain transfer fees or APY income by providing tokens as liquidity funds.

Advantages : The unified liquidity pool provides users with native assets, reducing the potential risks faced by users receiving packaged assets. Bypassing the efficiency problem in the locking and casting mechanism, improving the cross-chain speed and building a liquidity pool with users, there are many potential cross-chain currencies

Disadvantages : The security depends on the smart contracts deployed by the project party on different blockchains. There may be loopholes in the contracts. Some liquidity pools may lack depth, and the risk of potential liquidity pool fragmentation

The main verification mechanism of the cross-chain bridge

Each blockchain has its own communication protocol, consensus rules, governance model and native assets. The core of cross-chain is to reach a consensus, so that one blockchain can access the state of another blockchain, so that information and assets can be accessed. Pass between blockchains. Now there are three main authentication mechanisms, namely external authentication, local authentication and native authentication.

Externally Verified

Rely on single/multi-point external validators to reach consensus and sign transactions.

The signing methods are mainly multi-sig and multi-party computation (MPC). The multi-signature mechanism requires the verifier to have a complete private key to sign the transaction; the multi-party computation eliminates the concept of a single private key and requires the verifier to form a Private key to complete transaction verification.

Some cross-chain bridges require validators to pledge to run nodes to provide services for transaction verification, ensuring that user assets are not lost. There are also two types of pledge mode, Insured and Bonded. Among them, Insured’s cross-chain bridge is more secure for users. When the node is malicious, the funds pledged by the validator are returned to the user as compensation. In the bonded cross-chain bridge, the pledged funds will only be destroyed when the validator commits evil, and the funds guarantee for users is low.

There are security concerns in external verification, and users need to trust the project party and external verifiers not to do evil. In June 2022, the Harmony Horizon Bridge was stolen $100 million by hackers, mainly because the hackers stole the private keys of 2 of the multi-signature participants, and used the stolen private keys to complete the signature, creating a withdrawal of $100 million. ‘s transaction.

Locally Verified

In the relevant blockchain, the relevant parties of the cross-chain behavior will only participate in the verification. Local verification turns complex multi-party verification into two-party verification, in which both parties verify each other’s transactions.

Natively Verified

The underlying verifiers of the target chain and the source chain are responsible for verification. The cross-chain bridge deploys the light node smart contract of the source chain on the target chain, and transforms the target chain into a side chain of the source chain to realize the information transfer between the two parties across the chain. The relayer transmits the information of the source chain to the light client of the target chain, and the native verification node will verify the correctness of the information and trigger the corresponding smart contract.

The Layer Zero project, which has been discussed more recently, basically introduces an ultra light node (Ultra light node) and an oracle (Oracle) in the native verification, in which the oracle and the relay (Relayer) work independently to improve the performance of the entire system. Safety and cost reduction.

When the user wants to send information from blockchain A to blockchain B, the information is sent by the terminal of blockchain A, notifying the oracle (Block ID, blockchain B’s smart contract identifier) ​​and repeater ( notify all information). The oracle forwards the block header to the terminal of blockchain B, and the relayer then submits the transaction proof. After the transaction proof is verified in the blockchain B chain, the information is forwarded to the destination address. The user finally obtains the native assets on the target chain through the liquidity aggregation pool constructed by Stargate Finance.

Block headers are instead streamed on-demand by decentralized oracles instead of keeping all block headers to reduce costs.

The oracle and repeater work independently, and the oracle uses an independent third-party Chainlink, which increases the difficulty and cost of the oracle being hacked. Even if the oracle is broken, there is still a repeater verification, which increases the safety factor.

Cross-chain bridges that are no longer esoteric: a complete explanation

Mainstream analysis dimension of cross-chain bridge

Consistent with blockchain, cross-chain bridges are also limited by the classic impossible triangle: security, interoperability, decentralization. The current cross-chain bridges make trade-offs in different performance dimensions to meet the user’s pain points to be solved. The current mainstream analysis of cross-chain bridges has the following dimensions. The definitions given by Zonff Partners, Lewis are quoted below.

Security : Assumptions of trust and validity, tolerance for malicious actors, security and reflexivity of user funds

Speed ​​: The delay in completing the transaction, and the finality guarantee. Often there is a trade-off between speed and security

Connectivity : Choice of target chains for users and developers, and different difficulty levels for integrating additional target chains. Good connectivity means a high degree of compatibility with public chains, and is not easily limited by differences in consensus algorithms and data structures of different public chains

Capital efficiency : the capital required for system security and the transaction cost of transferring assets

Statefulness : the ability to transfer specific assets, more complex states, and/or perform cross-chain contract calls

Cross-chain bridge security analysis

Security is the top priority in all dimensions. Security vulnerabilities in cross-chain bridges have resulted in the theft of billions of dollars of assets. For detailed security vulnerabilities, please refer to Part 4 of this article. Among them, there are loopholes in smart contracts, and secondly This is because when the multi-signature technology used in external verification is used, more than half of the verification nodes and private keys are obtained by hackers. The overall project party needs to audit the smart contract, improve the technical level, and ensure the security of the smart contract.

In general, in the design of the cross-chain bridge, there are the following security rankings:

◾ Security decreases from native verification, local verification, multi-point verification to single-point verification. ◾ In multi-point verification, bridges that require external validators to stake are more secure than bridges that do not stake. Among the cross-chain bridges that need to be pledged, the cross-chain bridge of Insured is more secure for users than the cross-chain bridge of Bonded. When the node is malicious, the funds pledged by the validator are returned to the user as compensation. ◾ When assets are cross-chain, receiving native assets is safer/lower risk than encapsulated synthetic tokens.

For example, Wormhole’s cross-chain bridge applies the cross-chain method of locking + casting/destroying. The user’s locking of the original chain assets is equivalent to guaranteeing the packaged assets on the new chain, but if the original chain assets are stolen, the user’s new chain On-package assets may lose their value.

In addition, although Insured’s cross-chain bridge will return the funds pledged by the malicious validator to the user as compensation, if the security of the cross-chain bridge is at risk, the token mortgaged by the validator is generally the native token of the bridge. , will also have a great impact on users.

In the actual cross-chain operation, it is still based on the size of your own funds, and then choose different cross-chain strategies. Due to the large amount of funds, based on security considerations, it is still recommended to exchange the native asset of the corresponding chain at Binance or ok exchange, and then propose to come to these chains for swap into the corresponding currency.

If there is a cross-chain with a small amount of funds, you can consider a cross-chain bridge with lower gas fees, faster speed, and no risk for transactions. The cross-chain aggregator can assist users to filter out the optimal cross-chain path and cost services.

Representative projects of third-party bridges

Data collected from Defi Llama 2022.07

Multichain

Cross-chain bridges that are no longer esoteric: a complete explanation

Introduction : It is the bridge consensus mechanism with the deepest capital pool and the largest number of blockchains at present : it adopts a multi-point external verification mode, and is verified by a secure multi-party computing system (MPC) running threshold signatures. Cross-chain mode : non-target chain native token → source Chain lock, target chain casting, cross-back burning; native token → liquidity replacement (liquidity pools are deployed on multiple chains in the V3 version) Security : requires full trust in external validators, currently 30+ nodes; no pledge mechanism introduced , Security General Speed : <30min Fee : Source Chain Gas+0.3% Handling Fee Scalability : Strong scalability, currently supports 36 blockchains, and can apply to the project party for NFT cross-chain contract deployment

cBridge

Cross-chain bridges that are no longer esoteric: a complete explanation

Introduction : cBridge 1.0 adopts point-to-point transaction of atomic exchange, which ensures security while causing liquidity fragmentation, resulting in poor scalability; after upgrading to 2.0, it is converted to liquidity replacement, which improves scalability. Consensus mechanism : Point verification mode, verified by the nodes of the side chain Celer State Guardian Network (SGN for short) Cross-chain mode : Liquidity replacement Security : requires full trust in the verification node, SGN adopts DPoS verification, the current number of pledges is large, and the speed is relatively safe : <20min fee : Source chain Gas + 0.04% handling fee; when the source chain is L2Rollup source chain, the handling fee is increased to 0.1%~0.5% Scalability : The scalability becomes stronger after the upgrade, and currently supports 20 blockchains

Hop Protocol

Cross-chain bridges that are no longer esoteric: a complete explanation

Introduction : The asset security of liquidity providers, verification nodes and arbitrageurs is sacrificed to ensure the security of users’ assets; at the same time, users are allowed to pay more handling fees to motivate several other role consensus mechanisms : Adopt multi-point verification Mode, the whitelisted node Bonder pledges assets and participates in verifying transactions Cross-chain mode : Liquidity swap Security : Using Rollup technology, the security depends on the underlying chain, and no one needs to be trusted, so it is relatively safe Speed : <5min Fee : Gas + liquidity provider fee on the source chain and target chain + 0.06% to 0.25% of the verification node fee Scalability : Strong scalability on EVM-compatible chains, but currently only supports L2 that adopts the Rollup scheme

Connext Bridge

Cross-chain bridges that are no longer esoteric: a complete explanation

Introduction : Based on the NXTP liquidity protocol, the cross-chain consensus mechanism of smart contracts has been implemented Multi -point verification mode is adopted, and verification is completed based on the NXTP protocol . Anyone, high security Speed : <5min Fee : Gas+0.05% handling fee Scalability : NXTP protocol architecture is scalable, currently supports 16 blockchains, and supports smart contract cross-chain calls

Stargate

Cross-chain bridges that are no longer esoteric: a complete explanation

Introduction : Based on LayerZero’s bridge, it realizes the consensus mechanism of liquidity sharing of different blockchains: LayerZero ultra-light node native verification Cross-chain mode : liquidity replacement Security : realizes the triple function of oracle machine, relay machine and target chain UA Security guarantee, strong security Speed : <1min Fee : Gas + about 0.2% handling fee Scalability : According to the official description, the scalability is strong, currently supports 7 blockchains, only supports stable coins

Barter Bridge x MAP Protocol

Expected to go live in September 2022

Introduction : Cross-chain bridge consensus mechanism based on the underlying cross-chain infrastructure MAP Protocol : MAP Protocol light node + relay chain native verification Cross – chain mode : liquidity replacement Chain  level security speed : < 1min , depending on the block production speed of the target chain and the source chain Light node smart contract development needs to be carried out according to the different structures of the chain itself

Source Lee – Barter Netowrk Co-Founder MAP Protocol Core Developer

Note: The cross-chain bridge of MAP Protocol, the underlying cross-chain infrastructure, is expected to be launched in September. The core solution is to solve the impossible triangle of cross-connection bridges. If you want to know more details, please pay attention to the update of Buidler DAO research report.

Analysis of key hacking incidents

Security is the top priority in all dimensions. Security vulnerabilities in cross-chain bridges have resulted in the theft of billions of dollars of assets, mainly due to loopholes in smart contracts, and secondly due to the use of multi-signature technology in external verification. Hackers obtained more than half of the verification nodes and private keys.

We will focus on the ways hackers exploit contract vulnerabilities and analyze representative cross-chain bridge hacking incidents that have occurred so far. The overall project party needs to audit the smart contract, improve its own technology and risk control level, and open source the contract code to ensure the security of the smart contract.

Poly Network

Time: 2021/8 Amount: $610m Background: The EthCrossChainData contract manages a list of public keys to verify on-chain data on the opposite chain; EthCrossChainManager is a privileged contract that has the right to send instructions to contracts on other chains; anyone You can call the verifyHeaderAndExecuteTx function to initiate cross-chain transactions; Use the _executeCrossChainTx function to call any contract; Process: The hacker uses the EthCrossChainManager to call the EthCrossChainData contract, and uses the hash collision to find the sighash (used to call the target function), and the private key Replaced it with your own, and transferred the coins from the contract. Main problem: Poly Network has no mechanism in place to prevent calling the EthCrossChainData contract

Ronin Network

Time: 2022/3 Amount: $600m Background: There are 9 validators in the Ronin chain Process: Hackers controlled 5 nodes and transferred the locked ETH from the vault Main problem: 51% attack caused by centralized management

Wormhole

Time: 2022/2 Amount: $320m Background: Guardians is a part of Wormhole’s contract on the Solana chain. When a cross-chain request is received for transaction signatures, the Solana chain will call the post_vaa function, and the post_vaa function will call verify_signatures The function verify_signatures will ask the Guardians for a signature set, and call the secp256k1 program to verify the transaction. The secp256k1 program needs to use Solana’s built-in function load_instruction_at, but before Wormhole deploys the contract, Solana replaces the load_instruction_at function with load_instruction_at_checked Process: Hackers create It created a program with the same instruction set as the Sysvar to which load_instruction_at belongs, and used it to verify the signature, disguised itself as a system account, thereby evading the verification of Guardians, and minted ETH on the Ethereum chain. Main problem: The validity of the load_instruction_at function is not verified in time

Harmony Horizon Bridge

Time: 2022/6 Amount: $100m Background Horizon uses a multi-signature composed of 5 addresses to verify transactions As long as more than 2 of the 5 addresses complete the signature, the transaction will be executed Process: Hackers steal the multi-signature participants Private keys of 2 individuals, created a $100 million withdrawal transaction, and signed it with the stolen private key. Main problem: 51% attack caused by centralized management

Chainswap

Time: 2021/7 Amount: $8m Background How to use Chainswaphttps://www.tuoniaox.com/news/p-500806.htmlWhen a user submits a Deposit application, he will get multiple node signatures and call it on the target chain_ When the receive function performs Withdraw, only one signature is needed to call the receive function, and the signer quota authQuota needs to be consumed. In order to strengthen decentralization, the signer quota will be automatically increased after it is used up. Process: the hacker uses the _receive function to transfer the Token to his own address , and use the generated redundant signature to sign the main problem: the contract about the number of node signatures is not properly initialized, and there is no mechanism to check the validity of the signature

Multichain

Time: 2021/7 Amount: $7.8m Background AnySwap Multichain Router V3 adopts a non-custodial cross-chain mode, and the transaction is verified by a secure multi-party computing system (MPC). ECDSA is a non-deterministic digital signature algorithm, which will introduce a random number k, and Calculate the R value by k When two signatures have the same R value, the corresponding random number k can be collided. Process: Hackers found that AnySwap Multichain Router V3 has two with the same R value under the MPC account on the BSC chain The signed transaction, from which the private key of the MPC account is reversed Main problem: MPC design vulnerability

Meter Bridge

Time: 2022/2 Amount: $4.3m Background Meter has two deposit channels, namely the underlying deposit function of ETH20 and depositEth when depositing the native package currency on the chain, Meter will not destroy/lock the package currency, but will Unpack it and hand it over to the relevant contract. When calling the depositEth function to deposit, the contract will verify whether the value of the currency matches the amount in calldata, and send it to the deposit function. When using the underlying deposit function of ETH20, the amount is correct Sexuality will not be verified: the hacker calls the underlying deposit function of ETH20, fills in a number that does not match the monetary value in calldata and sends it to the deposit function Main problem: lack of verification for calldata

Summary and Future Outlook

Summarize

In general, the cross-chain bridge needs to be further improved due to potential security issues at the stage, so as to strengthen users’ confidence in asset security when using the cross-chain bridge. From the perspective of users, in addition to security, it is also necessary to provide a smooth cross-chain experience, including one-click cross-chain, convenient cross-chain speed, and direct exchange into native assets. The multi-chain ecology is an irreversible trend in the future, and the cross-chain bridge is also the underlying core infrastructure. We look forward to the development of the cross-chain bridge in the future.

future outlook

A cross-chain bridge, such as a cross-chain of assets, has an obvious overall ceiling. From a market perspective, few of the Top 100 projects are simply cross-chain bridge projects. The future boundary expansion of cross-chain bridges is very important, such as information cross-chain and NFT cross-chain.

Liquidity replacement has become the main asset cross-chain method of the cross-chain bridge. Deploy liquidity pools on each blockchain to provide general assets of the target chain, bypassing the locking and casting mechanism, improving cross-chain speed, and reducing the impact of poor liquidity of packaged assets.

Embed other services in the cross-chain bridge, such as cross-chain + Defii to improve capital utilization, the cross-chain + lending solution proposed by Aave in the V3 version, and Li.Finance is also implementing the cross-chain + transaction solution. In addition, cross-chain + NFTfi sends NBA TopShots (NFTs) on the Flow chain to ETH’s NFT mortgage market for mortgage lending.

A single application deploys its different parts on multiple chains, making each part run on the most efficient chain. The backend packages of these different chains will communicate with each other to ensure the continuity of the user experience. In application scenarios such as Gamefi, the cross-chain function is implanted into the chain game. When the traffic is heavy/congested, the user can be shunted smoothly without feeling and optimize the user’s experience.

Posted by:CoinYuppie,Reprinted with attribution to:https://coinyuppie.com/cross-chain-bridges-that-are-no-longer-esoteric-a-complete-explanation/
Coinyuppie is an open information publishing platform, all information provided is not related to the views and positions of coinyuppie, and does not constitute any investment and financial advice. Users are expected to carefully screen and prevent risks.

Like (0)
Donate Buy me a coffee Buy me a coffee
Previous 2022-07-24 10:07
Next 2022-07-24 10:09

Related articles