Blockchain Bridges: How Do They Even Work?


Blockchains do not, in general, talk to each other very well – or at all – unless bridge mechanisms are implemented. This article will dive deep into the technical processes used to move assets from one chain to another. Wrapping an asset essentially means exchanging the ‘true” version of the asset for a nominative token that represents it on a different chain. Wrapping Bitcoin, or wBTC, is an ERC-20 token that can be deployed and traded in the. Ethereum network. The real BTC is locked inside with them while the wBTC plays in the green fields of the..

image

As blockchains flourish on their way to pollinating the world economy with the power of distributed ledgers, interoperability between networks becomes essential to sustaining this paradigm shift.

Cross-chain trading is a challenge. Blockchains do not, in general, talk to each other very well – or at all – unless bridge mechanisms are implemented.

As more value is created on different blockchains due to the various utility, security and operational capacities on offer, being able to trade across these gated economies creates a more inclusive space that fosters growth.

You can liken it to the advent of globalization, when nation-states began to actively trade with one another, bringing propulsive economic growth in the 20th century. An interconnected world is a rich one, and the same is true for blockchain space. 

This article will dive deep into the technical processes used to move assets from one chain to another. 

How Custodial Exchanges Circumvent the Bridge Problem

If blockchains can’t talk to each other easily due to their monolithic architecture, then how do such fluid asset swaps work on Binance, Coinbase and other CEXs? How come you can deposit ERC-20 USDT onto Binance and Withdraw BEP 20 USDT? Well, it’s due to the exchange functioning as something of a mirage about what’s really going on. In essence, sending your keys to an exchange is giving control of it to them, and they can choose what they are happy to honor out of their own asset pools reserve.

It creates fluidity, but it comes at a cost; especially in terms of trading fees. There are also limits, just like a bank might restrict your withdrawal.

If holding your assets on a centralized exchange, your asset is more fungible because it’s not your asset, it’s just another entity juggling its own position to accommodate your requests – with formal identification and KYC requirements for them to maintain your account.

Clearly then, for the on-chain economy to mature, more efficient cross-chain communication needs to occur, to avoid innovation being stifled by simply a new set of gatekeepers.

Wrapping Digital Assets

Chief amongst the methods of inter-chain trading is the act of “wrapping” your cryptocurrency. Wrapping an asset essentially means exchanging the “true” version of the asset for a nominative token that represents it on a different chain.

A simple example would be wrapped Bitcoin, or wBTC. wBTC is an ERC-20 token that can be deployed and traded in the Ethereum network. You can use it in DeFi protocols, swap it on DEXs like Uniswap, or lock it up as collateral for lending purposes. In all practical senses, your BTC asset is now live on Ethereum. Yet how do you get wBTC, or other wrapped tokens?

Essentially, by giving a real BTC to a protocol or group like BitGo that promises to keep it safe for you, wrapped wBTC is issued in exchange. The real BTC is locked inside with them while the wBTC plays in the green fields of the Ethereum ecosystem.

Bitcoin does not support smart contracts, so in this specific case, it is not locked within a smart contract as is the case with other compatible assets. Rather, it is kept by a custodian, and a smart contract is only used for the issuance and burn of ERC-20 compatible wBTC.

Thus, after the wBTC has fulfilled its purpose, and if the original owner wants to regain his ‘locked’ BTC, a contract function is called, and the governing protocol now has to burn the wBTC and replace your BTC back in circulation.

Of course, this comes with several risks, the main one being centralized control over the original BTC. The safer alternative here is to simply purchase wBTC without locking your own BTC. 

Under this method, the two tokens are never in circulation simultaneously, and therefore the integrity of the asset theoretically remains sound. 

How Wrapping Bridges are Secured

MultiSig Wallets – The Not-So-Gold Standard

Protocols that wrap BTC, and many other third-party custodial bridges like it that wrap other tokens, are governed by a multisig (multi-signature) wallet to increase security. These wallets require multiple cryptographic keys to open. Think of it like a bank vault that requires two or more keys to open. Usually, not every member of a network who is party to the wallet needs to provide a key for every transaction, but rather a set ratio, say 2/3rds.

Once the requisite amount of keys have been input from the custodian, the funds can be moved. This has been, for a long time, one of the more secure methods of guaranteeing security over a pool of funds. Yet it has significant problems. One obvious one is that, should a large enough of the custodians seek to steal the funds, they simply can – as they have enough keys. 

The same is true if a hacker acquires enough keys to open the wallet. Another typical problem faced by multisig solutions is that sometimes keyholders can go the proverbial “AFK”, as users of the OKEx found out when one of its keyholders fell “out of touch”, leaving funds in limbo. As Vitalik Buterin commented in 2020, he hopes that “these wrapped BTC bridges are trusted” and that they can “at least move to a decently sized multisig” – implying that many of them are chronically undersecure.

The issue with this, is that a more pervasive problem is that because each wallet or smart contract needs to have its number of keyholders and cryptographic access set up in advance, then it’s extremely difficult to adapt to new blockchain protocols as they arise. Therefore, multisig bridges, although they can be a decent protection of funds placed in a bridge, are still susceptible to the same issues as a standard centralized exchange, but also struggle to adapt to new blockchain protocols – as ground up cryptographic key distribution is required each time a new wrapping bridge is created. Wrapped BTC was all well and good when Bitcoin was the only cryptocurrency, and Ethereum the only smart contract platform. However, times have very much changed.  Hundreds of blockchains are now being deployed, with the inter-chain economy destined to witness exponential growth. 

SSSS Methods

One workaround to this has been SSSS (Shamir Secret Sharing Schemes) cryptographic strategies. In this case, one private key is split into shares. These shares then need to be assembled to reconstruct it. Then, a single private key is created which can then access the protocol. This is significantly safer than multisig solutions, but has a problematic single point of failure – and that is the machine on which the final key is assembled, and the single turning of the lock (by a single, perhaps malicious entity) to activate the function.

MPC – Benefits and Drawbacks

MPC (multi-party computation) is a more recently developed cryptographic principle to combat some of these issues. MPC is a method whereby, rather than several private keys being necessary to activate a function, rather a single private key is subdivided into multiple parts that need to be assembled simultaneously (as opposed to SSSS which operates in a final state) in order for a contract’s function to be executed. Moreover, each party does not have to reveal its individual input.

The idea has been around since the 1970s, and recently blockchain bridge protocols, like WAN, have begun using it. One excellent advantage of MPC is that it is ledger-agnostic, whereas multisig solutions are ledger dependent and tied to a single blockchain as keys need to be generated depending on the blockchain accessed. MPC is then able to be agile and adaptable as it is built on a single standardised signature algorithm (ECDSA).

While Multi Sigs need to be hardcoded, MPCs do not. MPCs also allow for privacy, as it’s not possible to determine which user is providing which part of the key, whereas in traditional multisig transactions, it is possible to determine which keyholders have supplied the code. Furthermore, Multisig transactions have one, or several, points of failure – the machines in which the keys are imputed. Having one part of a MPC key, however, is useless to any would-be attacker. Finally, MPCs are far faster to transact, as Multisig transactions need manual verification, or turning of the keys, by each responsible party.

There is one massive drawback, however, and that’s accountability. MPC’s privacy is also an issue. Should a portion of the keyholders required in the transaction elect to collude and steal funds, it would be impossible to verify who of the pool was responsible for the attack. MPC, being so new, is also problematic by dint of that very newness. “Anyone, from the most clueless amateur to the best cryptographer, can create an algorithm he himself can’t break”, as Scheiner said.

Losing Peg With Wrapping

There is an emotional issue too. When you send a token to be wrapped, you no longer own the token either. You just own a facsimile of the token that can redeem the real one when required. Where this can lead to other problems when it comes to these tokens keeping their peg. If there is a sudden mass unwrapping of wrapped BTC, in the case of a prominent DeFi protocol dropping interest rates on it for example, then suddenly the value of wBTC within the Ethereum ecosystem can drop, and your wBTC token may lose its peg – although the unmooring is likely to be brief, as wBTC and BTC are still held at a 1:1 ratio and, save for total failure or hack of the bridge, your asset is secure.

Yet there is still risk associated with the wrapping of assets which, when combined with its cost to do so, can stunt fluidity, speculation and “hot-money” moving effectively through the market. This friction is what mitigates some of the value of these assets being deployed effectively, and can act as a generalised collar on the growth of the market as a whole.

Improving Cross-Chain Communication

Custodial bridges, even legitimate and secure ones, have issues. There are other routes being taken to link up the blockchain economy, however. Let’s dive deeper!

Cross-Chain Atomic Swaps

Atomic swaps are an excellent peer-to-peer method of exchanging cryptocurrencies that make use of Hash Timelock Contracts (HTLC) to work. These are smart contracts that do not allow trades to complete until both parties verify that it has occurred. If the verification does not complete, then the assets are returned to their original owners. The time frame is fixed, and immutable, and guarantees that trades can complete. Because you are swapping assets directly for one another – then all assets can be swapped at whatever price is agreed in the contract, and there is no need for complex multi-pair transactions to get the asset you want in exchange for the asset you have.

So far, so good – but what’s the issue? Well, each HTLC needs to be set up individually between two parties every single time. Although atomic swaps offer a great chance to trade assets interchain, this necessity to look for a single counterparty every single time, and set up a contract governing the trade, makes them obscenely cumbersome for most cryptocurrency trades.

Layer 2 Asset Transfers with ZK Rollups (for Ethereum)

Layer 2 refers to the suite of solutions designed to help scale apps by doing transactions off the main layer of the Ethereum. These off-chain aggregators, such as Polygun, Arbitrum and Optimism, maintain a transactions record of asset-transfers and then bundle them up and send them to the main chain for verification. With ZK Rollups, as only a single cryptographic proof is required (called a SNARK) to validate all the transfers on the Layer 2, then it allows for significantly greater volume of cross-chain transfers to be enacted and processed in one fell swoop.

The issue is, of course, that despite the ability to transfer assets across many smaller blockchains and sidechains using this method, they are still exclusively built for the Ethereum umbrella – which means ultimately asset transfers will run into the same problems.

Solana’s Wormhole

Solana’s wormhole is similar to a classic Mint and Burn protocol bridge. The difference between the wormhole and other asset bridges is that, rather than having its own governance inside the protocol, the bridge is overseen by “guardians” who borrow authority from Solana main chain to transfer assets cross-chain. In short, Solana nodes pick up the slack of validating consensus but also have to act as the guarantors of that trust, so this method is reliant on Solana’s continued promise as an emerging blockchain and on their ability to scale up and run out bridges between them and every other blockchain they wish to connect.

Sidechains

A sidechain bridge is one where, instead of connecting two completely different blockchains, connects just one blockchain to a designated parent bridge. For example, Axie Infinity created a sidechain called Ronin that helped the main AXS chain communicate fast enough with Ethereum for the game to work as intended.

Polkadot works by creating secondary chains or parachains that have specific use-cases depending on the type of interoperable bridge needed between two blockchains. These parachains are these overseen by the central Polkadot relay chain that acts as the validator for all actions that are occurring on these parachains. It’s an ambitious model, but Polkdadot’s generic bridge to allow all chains to connect is still being worked on.

Intermediary Asset Swaps

Some projects have opted for continuous lending pools, where to exchange one asset to another, you require a third token serving as intermediary. Under this model, to swap token A for token B cross-chain, A will be swapped for C (the intermediary asset), then C will be swapped for B. Under this non-custodial and decentralized framework, swaps require wallets associated with multiple blockchains, but there are some concerns surrounding the additional friction of having to conduct two swaps in the back-end for a single swap that reflects in users’ wallets. One example of this model is THORChain. Built using the Cosmos SDK, THORChain uses its intermediary token, RUNE, to help facilitate asset swaps between any other two tokens using an AMM model.

The Cosmos Inter Blockchain Communication Network

The most promising long-term solution to interoperability seems to be the creation of blockchains like Cosmos, whose express aim is to connect other blockchains together.

Cosmos uses a bespoke version of the IBC protocol. This is a generic protocol that can be used by the majority of other blockchains regardless of the architecture or programming language they use. As long as a blockchain meets a few basic requirements, including having a module system, a key-value store, a consensus state introspection, timestamp access, a port system and an exception/rollback system, as well as eventual data availability – then they can connect to the IBC protocol.

In Cosmos’s Tendermint model, each blockchain (or zone) maintains its own state and has its own validating community. When it wants to communicate its data, it sends packets over the IBC, and Cosmos’s Hub maintains a multi-token ledger of token-balances of all connecting zones. Each zone must use a deterministic finality algorithm, such as the one provided by Tendermint, in order to use the Hub. 

Cosmos Tendermint is Byzantine-Fault Tolerant. That means that it can tolerate 1/3rd of the machines within it failing completely, even through outright malicious behaviour. It also uses state machine replication, methodically updating the central state across its machines. This means computers from far flung corners of the globe operating on different programming languages and using their own application logic, can connect to its secure consensus algorithm through its application interface, the ABCI. Any distributed system, from currencies, voting systems and more can take advantage of its network. It is therefore an off-the-shelf, stable, working consensus engine for any blockchain software that does away with the problematic monolithic design that is used by popular blockchains like Ethereum. 

Building on Cosmos and plugging into the IBC, projects like Onomy Protocol are taking inter-chain communication a step further by creating their own bi-directional bridges with blockchains not currently supported by the IBC. Some of the announced blockchains to be supported include all IBC-enabled networks, as well as Ethereum, Avalanche, Near, Polkadot, Cardano, OKChain, Binance Smart Chain, and other EVM-compatible chains, with non-custodial key management available via a single wallet, rather than multiple browser extensions. As portrayed, this form of multi-dimensional support unlocks cross-chain trading free of intermediaries or wrapped asset counterparts, bolstering the cross-chain future of the DeFi realm. 

Interoperability – The Missing Link

With the market no longer having a singular blockchain ecosystem that can single handedly serve all purposes and with the blockchain network constellation continuing to expand before our very eyes, all signs point towards a shared system of cosmic travel, able to sustain the transfer of significant volume between distant stars. Adoption resides in making true interoperability real, with the importance of intuitive user interface being just as powerful. 

Rowen Lan. Hacker Noon profile picture

Tags

Join Hacker Noon