Skip to content

4. How to Use ZBTC

mchitgarha78 edited this page Sep 19, 2024 · 1 revision

Introduction

ZBTC is a decentralized bridge designed to connect the Bitcoin network with EVM-compatible chains. Hosted on EigenLayer and secured through restaking, ZBTC utilizes the FROST protocol and Schnorr Threshold Signatures to ensure secure and efficient cross-chain transactions. This tutorial will guide you through using the PoC version of ZBTC on the EigenLayer Holesky testnet to bridge BTC from Bitcoin testnet3 to the Ethereum Holesky test network and back.

Get testnet Bitcoin

To test ZBTC, you'll need testnet3 Bitcoin. Any wallet that supports testnet3 can be used to obtain this Bitcoin. However, when depositing into ZBTC, your wallet must also support the OP_RETURN opcode to include the required data. Electrum is a good option as it supports both testnet3 and OP_RETURN.

Tip

Run Electrum in testnet mode using ./run_electrum --testnet.

After installing and running the wallet, you can get some testnet Bitcoin in your wallet address using the following faucets:

After installing and launching the wallet, you can obtain testnet Bitcoin by using the following faucets:

Tip

If the amount of testnet Bitcoin from the faucets is insufficient, you can also join the Zellular Discord and request additional testnet3 BTC.

Deposit BTC and Mint ZBTC

This figure illustrates the process of bridging BTC from the Bitcoin network to an EVM-based network.


To bridge BTC to an EVM-based network, follow these steps:

  • Transfer the desired amount of BTC to the ZBTC MPC wallet. Include the destination Ethereum address without 0x as OP_RETURN data in the deposit tx as follows:
Deposit with OP_RETURN

  • Send a request to the Signature Aggregator (SA) for a signature:

    curl -X POST http://localhost:8000/mint -d '{"tx_hash": "[deposit-tx-hash]"}' -H "Content-Type: application/json"

Burn ZBTC and Withdraw BTC

This figure illustrates the process of bridging BTC from an EVM-based network back to Bitcoin.

Bridge from EVM-based to BTC Network

To bridge BTC back to the Bitcoin network:

  • Deposit a negligible amount of BTC to the MPC wallet. The hash of this tx is used to prevent replay attacks. The extra amount deposited in this tx will be returned to you when you withdraw your BTC.

  • Burn ZBTC on the EVM-based network by providing the hash of the above tx.

  • Submit a withdrawal request using the following command:

    curl -X POST http://localhost:8000/burn -d '{"tx_hash": [burn-tx-hash]}' -H "Content-Type: application/json"

Clone this wiki locally