Skip to content

a decentralized btc bridge hosted on eigenlayer and secured via resktaing

Notifications You must be signed in to change notification settings

zellular-xyz/zbtc

Repository files navigation

Zellular BTC (ZBTC)

This repository is essentially an implementation of pyfrost, customized for the ZBTC project.

The goal of this project is to provide a decentralized solution, secured by EigenLayer, for bridging Bitcoin from the Bitcoin blockchain to any EVM-based network.


Setup Instructions

$ git clone https://github.com/SAYaghoubnejad/zbtc.git
$ virtualenv -p python3.10 venv
$ source venv/bin/activate
(venv) $ pip install git+https://github.com/SAYaghoubnejad/pyfrost.git@develop   

Note: Python version 3.10 or above is required.


Running the Project

To run nodes, execute the following command:

$ python node.py [node_id]

Next, to initiate a Distributed Key Generation (DKG) for the MPC wallet, run:

$ python dkg.py [number of nodes] [threshold] [n] BTC mpc_wallet 

To set up a DKG for generating signatures for the EVM-side contract, use:

$ python dkg.py [number of nodes] [threshold] [n] ETH ethereum 

To run the signature aggregator, which acts as a client for the user, run:

$ python sa.py [number of nodes]

Functionalities

This project provides two main functionalities:

  1. Bridging BTC from the Bitcoin Network to an EVM-based Network:

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

    • First, transfer the desired amount of BTC to the MPC wallet. You can do this by modifying the fee and amount in deposit_bridge.py, setting your private keys in setting.py (as shown in the example), and then running:
    $ python deposit_bridge.py 
    • Next, send a request to the Signature Aggregator (SA) to ask for a signature:
    $ curl -X POST http://localhost:8000/mint -H "Content-Type: application/json" -d '{"tx_hash": [hash of the deposit transaction], "public_key": [your Bitcoin wallet]}'
    • Once you receive the signature, you can mint ZBTC. The procedure is illustrated in the following diagram:
    Bridge from BTC to EVM-based Network

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

  2. Bridging BTC from an EVM-based Network to the Bitcoin Network:

    To bridge BTC back to the Bitcoin network:

    • First, deposit a negligible amount of BTC to the MPC wallet. This amount will be returned to you when you withdraw your funds. Modify the fee and amount in deposit_withdraw.py, then run:
    $ python deposit_withdraw.py 
    • Use the hash of this transaction when you burn ZBTC on the EVM-based network. After burning, submit a withdrawal request using the following command:
    $ curl -X POST http://localhost:8000/burn -H "Content-Type: application/json" -d '{"tx_hash": [hash of the burn transaction]}'
    Bridge from EVM-based to BTC Network

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

About

a decentralized btc bridge hosted on eigenlayer and secured via resktaing

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages