How to get tf out(crypto bridge edition-

How to get tf out(crypto bridge edition-

2023 Oct 17 See all posts


[title]: <> (How to get tf out(crypto bridge edition-) [canonical]: <> (https://paragraph.com/@madhavg/how-to-get-tf-out-crypto-bridge-edition) [pandoc]: <> ()

Originally published on Paragraph.

This post is part #2 of my bridges journey where I take readers through asset security in a cross-chain world and how the tech behind these magical structures aka bridges work. Today we will go down the rabbit hole of

How to cook a bridge from scratch

Well if you are not a chain maximalist spending all your attention and brain power about why some chain is the best, you must have at one point held different crypto assets and maybe even tried to move the same ones across chains just to f*ck around and find out. Well then you have 2 choices, go the old Centralised exchange way or try the risky and more fun path leading to cross-chain bridges but have you wondered how these

Hey there, my fellow degens! In today's enlightening session, we'll reveal the mind-blowing concoction of ingredients required to whip up a magical bridge that lets us juggle assets and even the wildest of data across the chaotic abyss of chains. Hold onto your socks, folks, because this is about to get as exciting as watching paint dry!

First, we need to which ingredients we need and why ->

And Voila! With just three simple Ingredients you have your own whole new bridge. Smart contracts to receive data on both sides and an agent/system that can relay data.

It's a bit akin to the art of telegraphy—setting up those essential hooks at both ends and linking them with a communication wire. All you need is a sender, a receiver, and a reliable means of transportation.

ELI5 of a bridge structure
ELI5 of a bridge structure

Relayer is the part where we differentiate between bridges present right now, every bridge has its own approach to transport the messages.

Doesn't ZK magic solve this?

ZK Bridges -> Using Light clients and an off-chain network that produces a Zero-knowledge proof of the state attestations to feed it to the receiver chain allows for a better security model at the cost of computational overhead. We can delve into more precise details by considering the option to generate a Zero-Knowledge (ZK) proof exclusively for the cross-chain messages directed at the bridge's smart contracts. Alternatively, we have the choice to create a ZK proof that encompasses the entire state transitions or even an entire block this to some sort can be tackled by using deVirgo.

But one of the biggest issues remains that ZK curve signatures are supported by the chains, Some chains support ed25519 and other BN254 so developers have to compute zk proofs over different curves in their bridge mechanisms which imposes the complexity of bigger zk circuits, and the required gas costs to verify the signatures/proofs on chains. Some Signatures like Groth16 that have a size of ~130 bytes can take 250k gas units to verify on mainnet while the ones like old zksnarks take 20M gas units which renders it impossible with the compute unit cap leaving the costs aside. One of the ways to solve this is to do recursive proving that allows you to shrink the proof size and you are able to verify even the history of the state.

Credits: 0xParc
Credits: 0xParc

One of my open questions was If we introduce more distributed proof generation like with DeVirgo to introduce a better level of decentralization in the bridge but how do we maintain a level of incentive alignment between the actors?

Currently, Gnosis Succinct Bridge and LayerZero are using Zk light clients with different architectures.


One of the most basic mechanisms used by bridge networks to send assets across chains is something called lock and release where you lock your tokens on one chain and release the tokens on the other chain to a desired wallet. Now this data transfer is the component of the bridge but the real assets lay in the escrows/smart contracts on the chains. This is where we have to be careful and choose our bridges wisely, Let differentiate between Custodian and ownership. When someone has full control over some arbitrary assets we say they have the ownership of that asset and Custodianship/escrowing means that the user still owns the asset but has passed the custody to interact and manage assets to a third party. From this a favorable feature we want our bridge to be an escrow bridge that can manage our assets but never has full control over them but become a custodian or guardian for our assets.

what if the bridge goes rogue?

As all bridges necessitate the involvement of trusted third parties to interface with diverse blockchains, there's an inherent need for alignment of incentives among these parties and the users, even when employing the mystical power of zero-knowledge proofs.Nonetheless, there remains a lurking possibility that these involved parties could misappropriate user funds and attempt to manipulate the network. This risk is notably challenging in threshold networks like Wormhole and Debridge, where a robust network of nodes is established. However, it's a different story for most L2 bridges, where only a handful of proving nodes exist. In such cases, users lack the capacity to submit fraud proofs to contest transactions that might harm them.

The onus falls entirely upon the teams operating these proof generators and sequencers. While Starknet is making strides towards decentralizing its sequencers and provers as outlined in its roadmap, many other zk and optimistic rollups, despite proclaiming "robust networks" in their grand roadmaps, are yet to make significant progress . A mechanism called Escape Hatches was introduced where users are able to exit their funds by forcing a state transition transaction of the L2 on L1 where the funds were locked, They usually are either able to submit a fraud proof or merkle tree root to exit. There are a few ways to exit with escape shuttles →

You can head to L2Beat and check which of the L2 bridges have escape and hatches and how they are deployed but even right now unless you are good at solidity and calling functions on chain it will be super hard to use this functionality.

L2 beat: Current state of L2 bridge security
L2 beat: Current state of L2 bridge security

Some Open questions about shuttles

One of the biggest challenges is that Force exit transactions go through the same pipeline as any other transaction, and in times of high gas or market turbulence, it might not be viable for the user to exit $500 worth of funds by paying $1k to call the escape functions on chain.

Other than L2 bridges, many cross chain bridges don’t have any security fallbacks if the trusted committee is down. If while bridging the Trusted third party goes which is solely responsible for consensus and custody, the assets could be locked as long as the network is back up.

Which assets to exit? One of the functionalities I am curious about is whether a user is able to exit specific tokens or standards or whether the whole account state is moved. You might have a few AAVE positions on an L2 which due to sequencer failure is unable to process new transactions is there any way to move the AAVE balance and position directly to the mainnet? If the users just want to exit their ERC-20 or wrapped tokes and not the Native tokens that they bridged?


PS: Big shoutout to yet again making it till the end of my bridge rendezvous, This was a series of 2(till which I planned) on writing about bridge security.This work was funded by a Wormhole Grant so a huge shoutout to them for giving me the support to work on this! Next time till then. Resources: