Good Morning Saints,
I hope you’re having a wonderful weekend.
If you’re reading this, you’re always one of the chosen Saints and special.
A new day in DeFI is another reason to return to the fundamentals.
It’s not always about building new things every day; It should be about how do we build better?
Over $2.66B has been hacked from Bridges. Just recently, we saw a similar case scenario from Multichain.
Why always Bridges?
Bridges have always been a honeypot for hacks due to their design model.
Before we delve deeper, let’s familiarize ourselves with these terms Cross-chain, Multichain, and Omnichain.
The need for Cross-Chain arises as a result of multiple blockchains (Multi-chain), in which Cross-chain refers to how assets are moved from one chain to another.
Also, In the present state of DeFI, there are more than 30 blockchains, and these blockchains are on different networks, each having its own liquidity.
This makes the battle for liquidity on the rise as every chain wants to attract its own share of liquidity.
This facilitates liquidity fragmentation and not unification.
For DeFI to gain mass adoption and attract more institutions, liquidity has to be unified and not fragmented.
This gave rise to another solution, “Omnichain” (a solution to unlocking Cross-Chain Composability), and LayerZero is making this happen as it leverages layer 0 as the base layer to connect all blockchains, which will solve blockchain’s Interoperability (how blockchains communicate with each other and transfer assets).
The order is L0-L1-L2-L3, L3s on L2s, both L3s and L2s on L1s and the three (L3s, L2s, L1s) on L0.
But unfortunately, in DeFI's current state, different solutions that have emerged as a solution to Cross-Chain Bridges are still a counterpart to the existing design of Bridges.
“People judge me like their present pretty, their past perfect”
Let’s get a bit deeper
For assets to be moved from one chain to the other (i.e.) Cross-chain, Bridges are used, which allow assets to be moved from one chain to another; this has come with many trade-offs based on their design principle.
Let’s look at the categories of Bridges
Cross-Chain Bridges can be classified based on the following:
Trust Assumption
Trust
Trustless
In trusted bridges, users have to rely on central authorities/third parties to hold their funds, while in trustless bridges, the funds are in the custody of the users.
Based on how they move assets
Lock and Mint
Mint and Burn
Atomic Swaps
Lock and Mint
This type of model locks assets on the source chain and mints assets on the destination chain, thereby Introducing a wrapped version on the destination chain.
Mint and Burn
This type of model mints assets on the destination chain while burning these assets on the source chain completely
Atomic Swaps
Like how P2P works, this model swaps assets on the source chain for assets on the destination chain.
Unfortunately, many Cross-chain/Omnichain solutions that aroused to solve the issues bridges face, which makes them a honeypot for hacks, still use the lock and mint, mint and burn model, and, in general, fall under the category “trusted” as users have to rely on their validators in their security setup to verify transactions.
There are other categories like “Based on their function and based on what they connect”, but they are literally out of context in this case scenario.
Looking at the current state of Cross-chain bridges according to L2BEATS still makes this point valid.
Looking at Vitalik’s thoughts on Bridges, he recommends using atomic swaps over bridges because atomic swaps don’t lock and hold funds on the source chain like bridges do, but rather involve the exchanges of these assets in a smart contract pool between two users.
They are already existing atomic swap solutions like Thorchain, and atomic swap faces multiple obstacles but is still preferential to use over bridges.
These obstacles are:
Limited Liquidity
Limited Functionality
Different Languages: As the EVMs are based on solidity, how about rust, sway language? e.t.c
Let’s explore Chainflip together and their approach to Atomic Swaps
Chainflip aims to maximize cross-chain composability by optimizing all the current cross-chain solutions.
It aims to be the ultimate infrastructure for transferring assets permissionlessly among different chains and networks, EVM and non-EVM, Bitcoin, Cosmos SDK, Substrate etc.
Going by the current state of cross-chain for atomic swaps, In the recent Ignas research, He asked a Thorswap team member about atomic swap feasibility, and they still hinted at the liquidity issues.
Not just that, there were still some trade-offs when it came to slippage as well.
Chainflip, with its design, is solving these issues as they allow swaps natively with extremely low slippage using a more efficient liquidity management system called Chainflip JIT AMM
Chainflip JIT AMM stands for Just In Time Automated Market Maker, which is based on Uniswap v3 AMM design.
Like how funds are held in a smart contract’s AMM Pool, JIT AMM is virtual, which simply means funds are not held directly in an on-chain pool using wrapped assets but instead traded virtually on Chainflip coordinated blockchain called the State chain as account balances are settled using the existing assets natively in the vaults pool.
Before now, how do you think we’ve been moving assets from one chain to another before the birth of cross-chains?
“CEXes were the solution.”
Up till now, some users move assets from one blockchain to another through CEXes by depositing the asset and withdrawing to the preferred blockchain, which isn’t supposed to be if we want DeFI to gain mass adoption and to not always rely on CEXes.
Cross-chain solutions came to design with different models down to atomic swaps, but there were still some barriers due to slippage and liquidity for large transfers.
CEXes still beat those cross-chain solutions regarding lesser slippage and deeper liquidity.
The only one that came close was Thorchain, but there were still some trade-offs which are still the higher slippage and liquidity
According to an experiment performed by Ignas research, he arrived at this by showing the cost and time it took.
Chainflip studied the approach of how this works on CEXes and implemented it in DeFI
This is how it works on CEXes
They are simply described as just servers on wallets, so when users send assets to the CEXes (server), the server registers that balance to their account, and users can now place the trade on the server. When they want to withdraw their assets, the server sends funds from the wallet it has.
This is just a simple transfer model, and fees are way cheaper because the trading is done off-chain, not on-chain.
Just to let you know, ZKs have cheaper fees because the computation is done off-chain.
Going into detail about how Chainflip JIT AMM works and why the JIT means Just in Time.
Let’s take, for example; Bob wants to swap 10 $ETH for native $BTC; Bob will have to open a deposit channel in the network with his destination address connected in which he simply deposits his 10 $ETH.
The swap will automatically be routed to two pools (ETH-USDC) and (USDC-BTC).
“Swap Bob’s $ETH to $USDC in the (ETH/USDC) pool and the $USDC to (USDC/BTC) pool.”
The Ethereum blockchain includes the transaction in the next block, which is monitored by the market makers and waits for the transaction to be executed on 8 Chainflip State Chain, which also requires 4 Ethereum blocks to reach finality.
This happens in 48s.
The market maker picks up the trade and executes the swap when the swap deposit reaches the witness threshold; then, the Chainflip validator sends the swapped $BTC to the user’s destination address.
It’s keen to note that Chainflip JIT AMM does all these by putting market makers in a competition to execute trades while maintaining the following:
• Minimal slippage
• Better market pricing and
• Low fees
How buddy? A little secret you should tell only your friends. It is simple; They put us all market maker mfers in a competition to execute your trades.
That’s not all; Chainflip also has this mechanism to mitigate MEV bots from front-running you users. They incentivize LPs to front-run each other so you users can benefit.
Chainflip uses the TSS (Threshold Signature Scheme) of about 150 permissionless validators on the network to process trades, making it unique and well-secured from other cross-chain Protocols.
While all these operations happen in the Chainflip ecosystem, Knowing it occurs at the state chain is essential.
The State Chain
This simply portrays the application of BaaS (Blockchain as a Service) and in summary, it is an application-specific blockchain designed for the Chainflip ecosystem.
The state chain has its own SDK that will allow DEVs to deploy Dapps or build on Chainflip Network.
Asides from that, the core key functions that occur in the state chains include:
Witnessing deposits
Broadcasting funds
Validator Auctions, Bonds, and rewards
Reputation and Slashing
Witnessing deposits (Incoming Txn)
In the Chainflip State Chain, Transaction occurs at the external chain, monitored and picked by validators.
The criteria for picking the transaction is after it has been confirmed and added to a block for the supported blockchains.
The deposit is considered final when the block is detected on the supported blockchain, and only 100 validators are needed to reach finality.
As optimistic rollups work when verifying a transaction, fraud-proof is submitted to prove transaction computation, and if not verified correctly, the validator is penalized and slashed.
This also happens when the validators fail to process the txn within the defined time limit.
Broadcasting funds (Outgoing Txn)
This has to do with how Chainflip now creates, signs, and broadcasts the transaction out of the protocol, which can be sending the output token to the user’s destination address, sending assets to LP withdrawing their collateral e.t.c
Here, the transactions are batched to save gas fees and reduce the number of signing ceremonies required, based on the Threshold Signing Scheme (TSS).
So, when the signing ceremony is completed, the transaction is reported back to the state chain and ready to send. After which, a validator is appointed to broadcast that signed transaction to the destination chain, and in case the appointed validator can’t fulfil this for any reason, the failure is reported back to the state chain, and another validator is appointed to do that.
It is also keen to know that Chainflip TSS uses the FROST (Flexible Round Optimized Schnorr Threshold) Multisig scheme for fast and scalable MPC.
It is used because of the large number of validators in the system and to secure all vaults.
FROST is the best when it comes to maintaining decentralization, unlike THORChain’s GG20, which often forces Individual validators to hold user funds on their own hotkeys.
Overall, Chainflip will be the first to use the FROST signature scheme, allowing validators to run on less expensive hardware while not sacrificing security.
The $FLIP token
In Chainflip’s State Chain, State Chain accounts are used to submit external transaction activities on the network. These activities can include:
Validator auctions
liquidity update
Broker transaction
Governance
All of these are done through the Chainflip gateway smart contract, which is being monitored by the network and controls the supply and economics of the $FLIP token.
Validators use $FLIP to place bid auctions for the highest validators that complete keygen to be selected as Authority Set validators
The Authority Set validators are responsible for block production/inclusion, consensus witnessing, threshold signing and transaction broadcasting.
Furthermore, $FLIP is used to reward the different types of validators in the Chainflip network.
LPs also use $FLIP to fund their on-chain account for the State Chain, which is needed to pay for gas fees when placing and updating orders.
Brokers who are responsible for constructing and submitting deposit requests to the blockchain on behalf of end users aim to do that so as to lessen the user’s burden of having to include complex transactions metadata which would result in increasing gas fees for users.
These brokers also pay a small state chain transaction fee in $FLIP every time they submit a transaction to the state chain.
All transaction fees on the State Chain are burned, which brings more value to $FLIP.
Chainflip will be live on the mainnet soon.
There are other Cross-Chain swap solutions to explore, and we’ll still see new ones emerging in the industry.
Also, the current state of LayerZero still needs a massive improvement as they still rely on third-party validators.
Until when would we see a risk-free independent trustless Cross-Chain/Omnichain solution?
If this hasn’t been figured out yet, we would still be debating whether the future is Cross-Chain, Multi-chain or Omnichain.
Thanks for reading and if you like it, do leave feedback and forward it to your Friends. There is love in Sharing and see you next time.
DeFI Saint
Founder, The Saints Creed.
This is so educative! Thank you