Skip to content

fractal-bitcoin/unstake-tool

Repository files navigation

FIP-101 Unstake Tool

Standalone emergency unstake tool for FIP-101 staking on Fractal Bitcoin.

This tool is designed as a fallback path when the normal staking frontend or backend is unavailable. It runs the unstake flow in the browser:

  • Derives the FIP-101 stake address from the connected wallet address, public key, and indexerId
  • Reads stake-address and wallet-address UTXOs directly from Fractal OpenAPI
  • Builds an unstake PSBT with the FIP-101:unstake OP_RETURN marker
  • Uses UniSat Wallet to sign and broadcast the transaction

Requirements

Development

npm install
npm run dev

Production build:

npm run build

Preview the production build:

npm run preview

GitHub Pages

This app can be hosted on GitHub Pages because it is a static client-side app.

The repository includes .github/workflows/deploy-pages.yml. To deploy:

  1. Push the repository to GitHub.
  2. In the GitHub repository, open Settings -> Pages.
  3. Set Source to GitHub Actions.
  4. Push to main or run the Deploy GitHub Pages workflow manually.

The Vite build uses a relative base path by default, so it works on both user pages and project pages.

Configuration

The default OpenAPI endpoint is:

https://open-api-fractal.unisat.io/v1/indexer

To use a different endpoint:

VITE_OPENAPI_BASE=https://open-api-fractal.unisat.io/v1/indexer npm run dev

OpenAPI requests require a UniSat developer key. The user enters the key in the UI. Requests include:

Authorization: Bearer YOUR_KEY

The key is stored only in the browser's localStorage for convenience. Do not commit real API keys into this repository.

Usage

  1. Connect UniSat and confirm the wallet is on Fractal Bitcoin mainnet.
  2. Enter a UniSat OpenAPI key.
  3. Enter the indexerId to unstake from.
  4. Click Derive Stake Address and Refresh Balance.
  5. Confirm the derived stake address and loaded balance.
  6. Enter the unstake amount and fee rate.
  7. Click Build PSBT.
  8. Review inputs, outputs, and the estimated fee.
  9. Click Sign and Broadcast Unstake.

The unstake output is sent to the connected wallet address. Network fees are paid by available UTXOs on the connected wallet address.

Security Notes

  • This is a client-side tool. Review the code and build artifacts before hosting it.
  • The tool never asks for seed phrases or private keys.
  • The OpenAPI key is not bundled into the app; users provide it at runtime.
  • Always verify the derived stake address, amount, and outputs before signing.

License

MIT

About

Standalone emergency unstake tool for FIP-101 staking on Fractal Bitcoin.

Topics

Resources

License

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors