Skip to content

keep-starknet-strange/broly

Repository files navigation

broly-logo

B.R.O.L.Y.

Bitcoin Registry Orchestrates Like Yesterday

Order on Starknet, write on Bitcoin, get money trustlessly, repeat

Broly is a decentralized Bitcoin inscription service that uses Starknet for orderbook management. It enables trustless Bitcoin inscriptions with guaranteed payments through smart contracts.


Why Broly?

Broly is a showcase of the power of Starknet brought to the Bitcoin ecosystem. With Broly, a user without any funds on Bitcoin can get their data inscribed on Bitcoin for a STRK fee. All they need is a Bitcoin and a Starknet wallet extension. They broadcast their request transaction to Starknet. The data is stored in the Broly contract. A user running the inscribor service can pick up the request, inscribe the data on Bitcoin, and transfer it to the requester's Bitcoin address. The inscribor can submit the creation and transfer transactions to the Broly contract on Starknet, and get the full verification of the correctness of the transaction execution.

Try Broly!

Dependencies

raito: A provable Bitcoin light client written in Cairo.

shinigami: A Bitcoin script VM, aka Bitcoin Execution Engine in Cairo.

utu_relay: A smart contract that enables secure verification of Bitcoin transactions and events, and bridges Bitcoin data to Starknet.

Kudos to the Exploration team and LFG labs for the effort!

Architecture

flowchart TB
    subgraph Frontend
        UI[React UI]
        BW[Bitcoin Wallet]
        SW[Starknet Wallet]
    end

    subgraph Backend
        API[REST API]
        DB[(Database)]
    end

    subgraph Starknet
        OB[Orderbook Contract]
        TI[Tx Inclusion]
    end

    subgraph Bitcoin
        BTC[Bitcoin Network]
    end

    subgraph Inscribor
        IS[Inscription Service]
        OM[Order Monitor]
    end

    UI --> API
    UI <--> BW
    UI <--> SW
    API --> DB
    SW <--> OB
    IS --> BTC
    OM --> OB
    OB --> TI
    API --> IS
    IS --> API
    IS --> OB
Loading

Flow

  1. User connects both Bitcoin Xverse and Starknet Argent or Braavos wallets
  2. User creates an inscription order:
    • Specifies inscription content and reward amount
    • Order is created on Starknet orderbook
    • Funds are locked in the contract
  3. Inscribor service:
    • Monitors pending orders
    • Creates Bitcoin inscriptions
    • Triggers reward release on successful inscription
  4. User receives inscription, inscribor receives reward

Getting Started

  1. Run the app
cp .env.example .env
# Edit .env variables to match your environment
docker compose up

View the website locally.

  1. Restart your app ( after changes to backend(s), indexer, ... )
docker compose down --volumes
docker compose build
docker compose up
  1. Run the proof-utils package
cd packages/proof-utils
pnpm add -D typescript ts-node
pnpm run build 
node dist/index.js

The script will print the serialized transaction hex.

Project Structure

broly/
├── apps/
│   ├── web/               # Frontend React application
│   └── backend/           # REST API service
├── packages/
│   ├── inscribor/         # Bitcoin inscription service
│   ├── onchain/           # Starknet smart contracts
│   ├── scripts/           # Deployment & Testing scripts
│   └── indexer/           # Starknet contract indexing
├── package.json
└── turbo.json

Technology Stack

  • Frontend:
    • React + TypeScript
    • Vite
    • TailwindCSS
    • Starknet.js
    • BitcoinJS-lib
  • Backend:
    • Golang
    • Postgres DB
    • REST API
  • Smart Contracts:
    • Cairo (Starknet)
    • Scarb
  • Inscribor:
    • Node.js
    • BitcoinJS-lib
    • Starknet.js

Components

Frontend (web)

  • New inscription order form
  • Dashboard view for pending inscriptions
  • Wallet connections (Bitcoin + Starknet)
  • Order status tracking
  • Exploring inscriptions

Backend (backend)

  • REST API for order management
  • Status tracking endpoints
  • Order history

Smart Contracts (onchain)

  • Orderbook contract
  • Transaction inclusion
  • Payment handling

Inscribor Service

  • Order monitoring
  • Bitcoin inscription creation
  • Transaction verification
  • Starknet interaction for reward release

License

Broly is licensed under the MIT License. See the LICENSE file for details.