Unified EVM and Bitcoin Assets with the MetaMask Bitcoin Snap Extension
This app allows tracking and transfering both EVM and Bitcoin assets in a unified manner using the Zion MetaMask Bitcoin snap extension.
This project consists of two components: UI and API. To run it successfully, both have to be running at the same time. For those purposes, there are two dependencies:
pnpm
nodejs package manager.cargo
Rust package manager.
Example Code
The source code for this demo can be found in this repository.
Running the API
- Obtain Unisat API key to use their service. Put the key in
api/unisat_api_key.txt
file. - Move to API directory
$ cd api/
- Compile and run the service with
cargo run
- The API server should be now running at
localhost:8000
- The API documentation can be found in
api/README.md
directory.
Installing the UI project
- Move to UI directory
$ cd ui/
- Install pnpm
- Run
pnpm install
Connecting to network
- Go to Conduit
- Click the 'Add to wallet button.' to add Bob L2 network to your MetaMask wallet.
Start UI
- Run
pnpm dev
inui
directory. - The UI is now running locally on port 5173.
- Go to
localhost:5173
and click onConnect wallet
, your wallet will get connected and the Bitcoin snap extension will be installed. After this, you have to approve all the permissions in MetaMask to access the Bitcoin addresses. - Now you have Bitcoin address derived from your MetaMask account, you can send testnet BTC or brc20s to see them in the app and move them around.
Notes
- The app runs on Bitcoin testnet, so make sure the correct network is used.
- This app supports only MetaMask as it uses Bitcoin snap extension to manage your Bitcoin accounts via MetaMask.
- Bitcoin transfers are not implemented yet.