What is a Blockchain Bridge?

Xavi Artigas
Flare
Published in
11 min readAug 2, 2022

--

Please allow me to first introduce you to the age-old problem of barter when the parties don’t trust each other.

The problem

We’re in the Middle Ages, my village is famous for its cabbages, and this other village is famous for its chickens. I fancy some chicken wings tonight so I travel to a nearby trading post and look for someone from the chicken village who wants to barter.

I find a guy willing to accept cabbages as payment, but here’s the problem, I don’t know him and he doesn’t know me. Do I trust him to give me the chicken once I give him the cabbages? And the other way around?

To make things worse, the chicken seller is 6 feet tall and twice as wide as I am, so there is no way I can prevent him from walking away with my cabbages AND his chickens if he so desires.

You could think it’s in his best interest to behave, or he will taint his reputation and nobody will want to barter with him ever again. But will this protect me in every case? Imagine his village is ravaged by famine and this is his last chicken. Will his reputation be very high in his priorities list?

The classic solution

The classic solution is to bring in a third party and give it authority. That’s why I traveled to the trading post in the first place, because there is a policeman there that watches over all barter transactions. The policeman is 6 feet tall too but he also has a big stick so all traders behave in his presence. He takes a cut of all transactions for his troubles and everybody is happy. And if I’m not, I’m free to barter in a different post without a policeman.

You might think there’s too much power in this guy’s hands and you’ll be right, but we’ll talk about this in a minute.

First, let’s see how things fare in more civilized times. Fast forward a few thousand years.

The invention of money

We’re in the modern times now and we don’t barter goods anymore, instead, we use money. We still trade it for goods and services, and there are still policemen that watch over transactions. Incidentally, these guys still carry big sticks, so this part hasn’t changed much.

There are multiple types of money though, which we call currencies, and if I want to travel abroad I need to barter my currency for another one. This is done in a bank, again, an authority that watches over the process and which I must trust beforehand. The banker does not use a stick, but keeps his money in an underground vault, where I have no way of entering, and won’t give me his money unless I give him mine first.

This state of things works fairly well and has taken us pretty far, but it’s not without problems.

Authority issues?

We already hinted that authorities, be it policemen, bankers or lawmakers, have a lot of power in their hands. History is full of examples of countries whose economies have been severely damaged by misbehaving, corrupt, or simply incompetent authorities.

Even at a global scale, it can be argued that the 2008 financial crisis was ignited by banks and other financial institutions misbehaving.

On top of that, authorities are single points of failure, meaning that if the policeman watching over a market is attacked and taken down, the whole market is instantly at risk.

So the authority-based system sort of works, but it does have some problems. We’ve been using it for millennia, is there really nothing better left to try?

Enter the blockchain

Not coincidentally, the Bitcoin blockchain was born in 2009, during the financial crisis. The first sentence in its now famous whitepaper reads: “A purely peer-to-peer version of electronic cash would allow online payments to be sent directly from one party to another without going through a financial institution”.

Many more blockchains have been developed since Bitcoin, but they are all pretty much based on two principles:

  • All transactions are public, and once approved they are written on a permanent, public record, called the ledger, for everyone to see.
  • Transactions are approved by public consensus: a number of independent participants must agree that transactions follow the rules of the blockchain.

Note that no single individual has power over the rest. In a nutshell, it replaces trust in a central authority with trust in an algorithm and the crowd.

The obvious advantages of the algorithm are that it cannot be changed (so it’s not susceptible to corruption) and it’s public (so it can be reviewed before deciding to participate).

On the other hand, the algorithm rewards participants that “behave correctly” so as long as a majority of them act logically, the crowd consensus can also be trusted. The specific consensus rules of each blockchain are what make them resistant to participants that do not act logically or even act maliciously.

In our metaphorical trading post, we no longer have a policeman, instead, there’s a lively community of validators reviewing each transaction, and deciding by majority whether to accept it or not. Validators split the trading fees among all of them, and there is no reason why a validator can’t also be a trader. The more validators there are, and the more independent they are, the safer the whole system.

Once you trust the blockchain technology, no more trust is needed:

  • All transactions are guaranteed to either succeed completely or not happen at all, so no trader can walk away with both sides of the deal, and there is no big stick involved.
  • Ledgers cannot be forged, so nobody can lie about the assets they possess in their accounts, or about whether they’re the true owners or not.
  • Some blockchains allow running smart contracts on them, which are like lists of instructions posted on a public bulletin board at the trading post, available for anybody to read, and enforced by the validator’s consensus. Think of them as public How-To guides that traders can decide to follow, supervised by the validators.

Therefore, inside the boundaries of the blockchain (i.e., inside the trading post, where the validators supervise everything), transactions can happen safely, without needing to trust a central authority. As a bonus, lots of operations can be automated using smart contracts, again, without needing a third party.

Ye olde caveat: depending on the number of validators, reaching consensus can be a slow process so in general, transactions are not settled immediately. This is because, while consensus is being reached, depending on which validator you ask you can get different answers regarding whether your transaction is approved or not. Therefore, there is a period of time after submitting a transaction in which it is being argued and it can even be reverted (known as a rollback). This situation must be handled very carefully.

Finally, all blockchains developed their own native currencies (like BTC or ETH), because they are a natural way to pay validator fees and simplify transactions. However, these native currencies are only valid inside each blockchain. They’re like a coin created by each trading post, which is not accepted by other trading posts.

Let’s take a look at how to move these trading-post-bound currencies to other trading posts.

Exchanges and Decentralized Exchanges

Crypto exchanges are just regular traders specialized in trading crypto currencies. Some of them also allow trading with classic fiat currencies (US Dollars, Euros, …) but that’s a different topic. Some others even allow trading native currencies from different blockchains. How do they do it?

A Centralized (or Custodial) Exchange (CEX), like Binance or Coinbase, manages your assets for you. You give them your coins (yes, just like a bank), tell them what you want to do with them, and they do it. Once they are done, you take your new coins back and off you go.

In the trading post metaphor, the CEX is just a very well-connected trader. He accepts your native currency and then instructs his agent on another trading post to deliver a different currency to your account there. You put a lot of trust in the CEX’s hands. As we have previously seen, this authority-based approach has a number of issues, including risk of corruption, and that they are a very enticing target for hackers.

The blockchain way of solving these issues is through Decentralized Exchanges (DEX) like UniSwap or SushiSwap. They provide the same functionality as a CEX but implemented as smart contracts. Remember that smart contracts are just instructions posted on a public bulletin board (like How-To guides) that all validators follow and then agree on the result: To use a DEX you tell the validators you want to swap token A for token B using the DEX guide posted on the board and that’s it.

The immediate benefits are:

  • Smart contracts are executed completely or not at all, so the traded assets are either swapped or not: There is no chance of one party ending up with both sides of the deal, and there is no need to hand your assets over to a third party.
  • The rules of the exchange are public for everyone to see, so there is no risk of corruption.
  • The contract, when properly written, is as hard to hack as the blockchain in which it is running.

The downside is that DEX’s can only operate inside the blockchain in which their smart contracts are running, and here is where the last piece of the puzzle comes into play.

Crossing blockchain boundaries

We’re now approaching the goal of this talk: How to move assets from one blockchain to another.

It just so happens that traders wanting to barter from different blockchains run, again, into trust problems: they have no reason to trust each other, because blockchain guarantees only apply to transactions beginning and ending within the same blockchain (where validators can oversee the process).

But before explaining the possible solutions to this problem let’s define it clearly.

First off, cryptocurrencies, unlike cabbages, cannot exist outside their native blockchains. Therefore, there is no way of moving Bitcoins (native to the Bitcoin blockchain) onto the Ethereum blockchain, for example.

This is important, let it sink in: You will never see a Bitcoin outside the Bitcoin blockchain.

In other words, at the trading post in Chicken town they use chicken coins, and they don’t accept the cabbage coins used at the trading post in Cabbage town.

Blockchains typically alleviate this problem by using receipts:

Imagine there’s a bridge between Cabbage and Chicken town, with a trading post (blockchain) at each side of the bridge, and each trading post only accepts its own coins (cabbage and chicken coins respectively).

To move your cabbage coins from Cabbage town to Chicken town, you deposit them instead in a massive chest that belongs to the cabbage post, and cross the bridge onto chicken post, where an operator that has overseen the whole process gives you receipts for your coins. These receipts act as IOU letters, and can be used in place of your original cabbage coins, but in Chicken town.

You can now spend the receipts to buy some chicken, for example, and go back home across the bridge. You don’t have to worry about the trading posts anymore, because you have no more coins or receipts (you exchanged them for the chicken).

Later, the vendor that sold you the chicken might fancy some cabbage and cross the bridge towards Cabbage town holding the receipts he got from you. At the cabbage post he will redeem them for the cabbage coins in the chest, destroying the receipts in the process.

Note that the existence of a reliable bridge is what makes traders on both posts accept receipts from the other one. I could create my own receipts and try to use them, but nobody would have any reason to trust me. The bridge, on the other hand, has gained a reputation over the years that assures traders that the receipts will be redeemable. Moreover, if the bridge is built as a public smart contract there’s no need to trust it, as it can be verified instead.

Also note that basic cryptography ensures that the receipts have been emitted by the bridge and are not counterfeit. Receipts have a digital signature from the bridge that cannot be forged.

Despite this, bridges based on IOU letters still face many challenges when implemented on a blockchain.

Blockchain bridges

Let’s see now how bridges can be implemented on a blockchain to better understand the challenges and the solutions. To begin with, let’s call the assets being moved (cryptocurrencies, for example), tokens.

When “moving” a token from a source chain onto a target chain:

  • Tokens on the source chain are immobilized (locked) until the bridge is crossed back in the opposite direction. This is done in the big chest from the metaphor.
  • Simultaneously, tokens of a different kind are created (minted) in the target chain (on the other side of the bridge) which represent the ownership of the source tokens. These are the receipts in our metaphor and are called wrapped tokens (e.g. Ethereum-wrapped Bitcoin, Solana-wrapped Ether or Cabbage-wrapped Chicken). They’re native to the target chain and everybody accepts them in place of the source tokens.

When “moving” wrapped tokens back to their source chain (a process called redeeming):

  • The wrapped tokens are destroyed (burned), just like the receipts were when crossing the bridge.
  • The immobilized tokens in the source chain are then released (unlocked) and they are free to circulate again.

The procedure described above is called mint and burn and it allows both blockchains to separately take care of locking, unlocking, minting and burning tokens with blockchain-grade guarantees. The critical, missing part is the synchronization of both sides of the bridge, which happens outside any blockchain.

Unsurprisingly, most solutions implemented so far are based on the old, tried and true mechanism, the central authority: Bridges have an account (or address) on the source chain where users deposit their tokens, and a software platform (the central authority) signals a smart contract on the target chain to mint the wrapped tokens.

While these bridges do work, and massive amounts of tokens cross them every day, they’re not fully benefiting from what blockchain has to offer in terms of decentralization and security. To begin with, all trust is deposited on a single entity, on its integrity, and on its ability to operate the bridge. On top of that, the bridges’ chests have become an irresistible target for hackers, as the spectacular amounts of funds that have been recently stolen attest.

As before, we ask ourselves “Can’t we do any better?”

My answer is “I believe so”, but it will have to wait for another post, as this one is rather lengthy already. I hope you enjoyed it!

Disclaimer

I work for Flare, an organization that, among other things, is building very promising bridging solutions. This post was meant as an introduction to Flare’s technology, but we thought it also has value as a high-level introduction to blockchain and bridging in general, so we decided to publish it on its own.

Edit: In light of recent, notable bridge failures, join our mailing list to find out how Flare intends to make bridging much safer.

Also, one night I bet actual money (fiat money) I could explain how blockchains work using Cabbage-wrapped Chicken and a stick. Somebody owes me money now.

--

--

Xavi Artigas
Flare

Experienced developer. Technical writer. PhD. Doc tamer.