☝️Symbiosis: From/To BTC
The Symbiosis protocol: the implementation of the cross-chain BTC exchange process using the Symbiosis BTC bridge
Last updated
The Symbiosis protocol: the implementation of the cross-chain BTC exchange process using the Symbiosis BTC bridge
Last updated
This document describes the implementation of the cross-chain BTC exchange process within the Symbiosis protocol using the Symbiosis BTC bridge. It highlights the solutions and approaches used to facilitate cross-chain operations involving BTC. Understanding these mechanisms is important for developers and stakeholders engaged in the deployment and operation of cross-chain exchanges.
Implemented cases:
Bridging BTC two ways:
Wrapping BTC from the Bitcoin network to zkSync Era
Unwrapping BTC from zkSync Era to the Bitcoin network
Exchanging BTC two ways:
Exchanging BTC for another token within a single cross-chain operation across certain supported blockchain networks.
Exchanging a token for BTC within a single cross-chain operation across certain supported blockchain networks.
The implementation of the cross-chain BTC exchange process for a token to BTC within the Symbiosis protocol using the ThorChain BTC bridge is described here:
Forwarder: This component handles user requests to exchange BTC from the Bitcoin network for tokens across other blockchain networks. It generates a unique BTC address for each request, stores the payload for the request, and forwards the received BTC to the intended destination (hence the name “forwarder”). The forwarder implements functionality that isn't available in Bitcoin network smart contracts. The forwarder acts as a custodial wallet; it can be operated by anyone willing to cover the fees for forwarding transactions on the Bitcoin network. Important: the forwarder must be fully trusted. Each integrator can deploy their own forwarder and trust it to process transactions initiated through their integration. Symbiosis, for example, trusts its own forwarder for transactions handled through its WebApp. The forwarder provides compatibility with regular and legacy Bitcoin wallets.
BTC portal: This is a smart contract located on the Bitcoin blockchain, playing a role similar to Portal smart contracts of the Symbiosis protocol on other supported blockchains. Unlike Ethereum Virtual Machine (EVM) smart contracts, its state is validated only by the relayers MPC group. The Bitcoin consensus layer only validates funds moving to or from its address.
Web/mobile apps powered by the Symbiosis web SDK: A UI provided by Symbiosis or an integrator that enables users to access the functionality of the Symbiosis protocol. It uses the Symbiosis SDK/API to compose call data for cross-chain operations and retrieve states stored on Symbiosis smart contracts. This documentation explains how users interact with the protocol using the Symbiosis WebApp. However, any integrator using the Symbiosis API/SDK can provide similar UI and functionality to interact with the Symbiosis protocol.
Relayers network: A blockchain-agnostic, P2P network consisting of registered relayer nodes securitised by the MPC/HTSS scheme. It facilitates the secure and efficient transmission of data between supported blockchain networks, ensuring data integrity and resilience against potential attacks through various technical approaches and crypto-economic incentive mechanisms. For more information about the relayers network, please refer to Relayers network.
Сore smart contracts implement the on-chain logic of cross-chain operations (cross-chain swaps, cross-chain zaps, interchain communication, bridging). The smart contracts are deployed and tuned by Symbiosis administrators while adding a blockchain to the Symbiosis protocol. For more information about the Symbiosis smart contracts, please refer to Symbiosis Routing Contracts.
Wrapping BTC: BTC → syBTC
Symbiosis bridges BTC from the Bitcoin network to zkSync Era by wrapping it into syBTC (address). The wrapping process involves locking the original asset on its native blockchain, the Bitcoin network, and minting an equivalent amount of the token on the target blockchain, zkSync Era.
Unwrapping BTC: syBTC → BTC
The unwrapping process reverses the wrapping by burning the syBTC on zkSync Era and releasing the equivalent amount of BTC on the Bitcoin network. This ensures that the supply of wrapped tokens always matches the amount of BTC locked, maintaining a 1:1 backing ratio.
Though syBTC can be traded/staked/landed/etc. on third-party DEXs and protocols on zkSync Era, its primary purpose is to facilitate cross-chain exchanges through the Symbiosis Protocol. It is bridged to the Symbiosis host chain and added to the Octopool, where it can be exchanged for other wrapped BTC tokens from supported chains. The Octopools on the Symbiosis host chain enable cross-chain switching. For more details, see Symbiosis Octopools.
Currently, syBTC is only available on zkSync Era. However, Symbiosis can extend BTC wrapping to other networks, such as Ethereum, when needed.
Important: All cross-chain operations involving BTC within the Symbiosis protocol are routed through zkSync Era.
The Symbiosis protocol enables users to exchange BTC with for other digital assets across certain supported blockchain networks.
Let’s break down how this process works with real examples.
Exchanging BTC for another token through the Symbiosis protocol involves the following steps:
Requesting a Quotation: A user initiates an exchange by specifying the BTC amount, slippage tolerance, destination token, destination chain, and an address on the destination chain.
Receiving a Quotation: The protocol provides a quote detailing the amount of the destination token to be received, estimated fees, and a newly generated BTC address for the user to send their specified amount of BTC.
Triggering the Exchange: The user sends the specified amount of BTC to the provided address, which triggers the cross-chain exchange process with the specified parameters.
Completing the Operation: Once the cross-chain operation is completed, the user receives the destination tokens at the specified address on the destination chain.
Two examples of exchanging BTC for another token are below:
Exchanging BTC for a token on the Ethereum blockchain: Scheme 1
Exchanging BTC for a token on the zkSync Era blockchain: Scheme 2
Exchanging BTC for a token on Ethereum
Important notes for Scheme 1
Step 1. A user specifies the BTC amount to exchange, slippage tolerance, destination token, destination chain, and an address on the destination chain.
Step 2.
Similar to any cross-chain swap, Symbiosis WebApp composes calldata, calculating all necessary intermediate swaps and estimates transaction fees on the intermediate chains and the destination chain to complete the cross-chain swap with the specified values from Step 1
Unlike other cross-chain swaps, Symbiosis WebApp sends this calldata to the Forwarder and requests it to generate an address on the Bitcoin network for this cross-chain swap.
Step 3: Forwarder generates an address on the Bitcoin network and saves this address and the associated payload (provided by Symbiosis WebApp) in its local database for the cross-chain swap. Users have a set timeframe to send BTC to this generated address. If this timeframe expires, a new request and address will be needed.
Step 4. The user receives a notification of the address to send BTC to and its expiration time.
Step 5. The user sends the specified amount of BTC (from Step 1) to the provided address (from Step 4) using their chosen BTC wallet.
Step 6.
Step 6.1. Forwarder monitors its addresses.
Step 6.2. Upon receiving a transfer at one of these addresses, it forwards the BTC to the BTC Portal. It also adds the associated payload for the cross-chain swap.
Step 7.
Step 7.1. Relayers monitor the BTC Portal (MPC address) on the Bitcoin blockchain.
Step 7.2. When relayers detect a BTC transfer to the BTC Portal (MPC address), they compose, sign, and send a transaction to zkSync Era. The instructions for actions on zkSync Era and other chains come from the payload.
Steps 8-14 are similar to any cross-chain swap performed across supported blockchain networks. For more information, please refer to this link.
Exchanging BTC for a token on zkSync Era
Exchanging BTC for a token on zkSync Era is very similar to exchanging BTC for a token on Ethereum, but shorter:
Exchanging a token for BTC through the Symbiosis protocol involves the following steps:
Requesting a Quotation: A user initiates an exchange by specifying the token amount, slippage tolerance, BTC as the destination token, the Bitcoin network as the destination chain, and an address on the destination chain.
Receiving a Quotation: The protocol provides a quote detailing the amount of the destination token to be received, and estimated fees.
Triggering the Exchange: The user signs and sends the transaction containing the calldata received on Step 2, which triggers the cross-chain exchange process with the specified parameters.
Completing the Operation: Once the cross-chain operation is completed, the user receives BTC at the specified address on the Bitcoin network.
Two examples of exchanging a token for BTC:
Exchanging a token on Ethereum for BTC: Scheme 3
Exchanging a token on zkSync Era for BTC: Scheme 4
Important notes for Scheme 3
Step 1. A user specifies the amount to exchange, slippage tolerance, the address on the Bitcoin network.
Steps 2-10 are similar to any cross-chain swap performed across supported blockchain networks. For more information, please refer to this link.
Step 11.
Step 11.1. Relayers monitor Oracle requests generated by the Symbiosis smart contracts.
Step 11.2. When relayers detect an Unwrap event, they compose, sign, and send a transaction to the Bitcoin network transfering BTC from BTC Portal to the address specified by the user (Step 1).
Subcase: Exchanging a Token on zkSync Era for BTC
Exchanging a token on zkSync Era for BTC is very similar to exchanging a token on Ethereum for BTC, but shorter: