The past few years have plagued the decentralized finance (DeFi) space with hacks, making critics of blockchain technology take a closer look at how this technology is threatening security. This year started off with a US$600 million hack on Axie Infinity’s Ronin sidechain, followed by a US$325 million attack on Solana’s Wormhole, both of which were caused because of the AMM (automatic market maker) cross-chain bridges backing both protocols. It happened again just days ago when hackers stole US$100 million from Harmony protocol’s Horizon cross-chain bridge in a similar attack. 

These hacks are sparking conversation around whether there are other types of bridges that can better protect against such vulnerabilities. This piece aims to describe the different kinds of bridges and explain why peer-to-peer-powered bridges are a superior choice for protecting end users and allowing the DeFi industry to mature.

Know your bridges: AMM versus peer-to-peer 

Data from Dune Analytics shows that the total value locked (TVL) of DeFi bridge away from Ethereum is US$11.8 billion, with Polygon, Arbitrum and Avalanche bridges taking the top three places. Due to problems surrounding Ethereum, specifically its high gas fees, network congestion, scaling problem, and power usage, the discussion around interoperability is gathering pace. Through this, we’re beginning to see the importance of enabling users to send crypto from one blockchain to another without using a centralized entity. 

It’s crucial that users are aware of what type of bridges they are using and the level of security they bring to the table. Most of the major bridge hacks have been AMM-based, including the three most recent in 2022 — the attacks on Ronin, Wormhole and now, Harmony’s Horizon bridge. To dissect what happened, let’s take a closer look at what happened with the first two.

During the attack, the Ronin bridge revealed how it is somewhat centralized, operating on nine validators requiring five signatures to verify deposits and withdrawals. In order to recognize a deposit or a withdrawal, five of the nine validator signatures are needed putting control of the bridge in only five validator’s hands. 

Hackers gained access to private keys used to validate transactions on the network using AMM-based bridges, therefore, allowing for a massive hack. Having only nine validators for the Ronin bridge, and four belonging to the same person is concerning. Pooling user funds — over US$500 million —  into one wallet address is the exact definition of centralization, exemplifying why users and Web 3.0 projects must understand the hazardous nature of AMM bridges. 

The Wormhole exploit that happened in February is another example of an AMM bridge hack, which saw the loss of 120,000 wrapped Ether tokens (WETH) worth over US$300 million at the price of Ether at that time. Wormhole connected blockchain networks such as Avalanche, BNB Smart Chain, Ethereum, Polygon and Solana, and its hack remains one of the biggest in DeFi history. 

The attack occurred after a hacker found a vulnerability in Wormhole’s smart contract and minted 120,000 WETH on the Solana blockchain. The WETH was transferred into a single pool, which then got rugged. A simple change from AMM to peer-to-peer — which doesn’t pool funds — would prevent disasters like this. Why are we putting hundreds of millions of dollars into one pool which can be exploited?

With Wormhole, we saw the WETH tokens on Solana were briefly unbacked by the Ether collateral, and a token was used to convert Ethereum into other cryptocurrencies that maintained the same value as the WETH token. This, in turn, had significant implications for Solana, such as further exploitation, extreme financial losses, and distrust from the investors. 

Every time a hack makes headlines, adoption slows and the ecosystem’s credibility is dented. AMMs have tarnished trust within the crypto ecosystem as we have seen with the Wormhole and Ronin hack. There are better ways to achieve security, and diving into peer-to-peer technology powered by atomic swaps reveals a solution based on protecting individual users’ funds.

P2P bridges: more secure alternatives to AMMs  

There are key differences between AMMs and peer-to-peer bridges powered by atomic swaps, which are exchanges of cryptocurrencies between different blockchains. Cross-chain AMM bridges leave too much potential for hacks to occur because people are dumping millions of dollars into a single liquidity pool, and that pool can get rug-pulled or hacked because each smart contract is tied to a small group of validators. To say the least, it’s risky putting up capital in an AMM liquidity pool. 

5YZd092am7 dWN76tTXQnG3j21

P2P-based bridges would provide for more secure cross-chain trading. They use atomic swaps and order books, removing reliance upon complicated smart contracts or centralized liquidity pools. Peer-to-peer technology enables cross-chain swaps to be completely trustless and decentralized without the middlemen. Only one transaction goes in and out simultaneously per trade, making it a more secure way to transact in a cross-chain world. Swaps are described as “atomic” because with each order, either the trade completes and two users exchange funds or the trade doesn’t complete and original funds are distributed back to the two users. This is made possible by hash-time locked contracts (HTLCs). This protocol design prevents millions from being vulnerable to creative hackers. 

While most AMM bridges focus on a one-way or two-way bridge connecting Ethereum and another layer-1 blockchain, such as Avalanche, or layer-2 blockchains such as Arbitrum, peer-to-peer powered bridges offer a multi-way bridge with infinite trading pair possibilities. For example, users can trade an asset from Fantom to Avalanche and any number of combinations, including native trading of UTXO (unspent transaction output) coins like Bitcoin, Dogecoin and Litecoin.

The road ahead

The future of blockchain relies upon trustless interoperability. That’s why we need DeFi protocols that provide secure bridges from one chain to another. To prevent hacks, we need to move towards peer-to-peer bridges where each market maker uses funds from their own wallets and controls their own private keys. End users should never have to put their financial trust into the security of a centralized liquidity pool. Likewise, developers should also consider building cross-chain bridges that utilize P2P technology.

Only when people trust a system will they continue to invest in it. 
Despite the rapid growth of cross-chain protocols, we’re still in the early stages of development, what many call the “Wild West.” More needs to be done to effectively move along the antiquated security tactics within the crypto ecosystem and utilize the newer, more secure technology emerging such as P2P-powered bridges.