Cross-Chain Bridges
Learn to support multi-chain dApp use cases with cross-chain bridges.
Cross-chain bridges enable developers to build dApps, decentralized exchanges, and payment protocols using assets native to other blockchains.
There are currently two options for cross-chain bridges between Filecoin and other blockchains, Axelar and Celer. This cookbook will focus on the use of Celer since it is available on both Calibration testnet and Mainnet, while Axelar is currently only available on Mainnet.
Token Transfers with cBridge
cBridge is a cross-chain asset transfer solution that does not require upfront liquidity.
Ingredients
A full tutorial on how to develop a smart contract as a liquidity pool
Instructions
Sender sends transferOut tx on the source chain.
Bridge node sends transferIn tx on the destination chain, using the same
hashlock
set by the sender.
Sender confirms the transfer on the source chain.
Bridge node confirms the transfer on the destination chain.
The contract addresses for Celer are as follows:
For further details on cBridge transfers, see the Celer created Github repo HERE.
Interchain Messaging
Celer also enables general message passing between chains. Below is sample code showing how one party can send a message to a counterparty on a different blockchain.
Ingredients
Instructions
Someone looking to send a message to a wallet on another chain sends that message using the the function
sendMessage()
.
The function
executeMessage()
is used by the intended recipient in the destination chain to receive and emit the message.
The MessageBus contract addresses are below:
For more information on cross-chain messaging, see the Celer documentation here.
A note on Finality with Celer
Note that there is an expected finality period when conducting inter-chain messaging with Celer. See details on Filecoin's finality here. There are two incoming improvements that developers can follow for the latest developments:
Learn more about cross-chain bridges and which bridges are available on which networks in the Filecoin Docs here.
Last updated