Skip to content

PrestoAlex/BTCGather

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ BTCGather - Premium Bitcoin L1 Group Payments Platform

BTCGather Logo

Trustless Group Payments & Escrow on Bitcoin L1 via OP_NET

License: MIT React Vite Tailwind OP_NET

Pool BTC with friends, teams, or DAOs for shared goals. Funds are locked in a Bitcoin L1 smart contract β€” only released when conditions are met. No custodian, no bridge, no EVM.

✨ Premium Features

  • 🎨 Elite Design - Glass morphism UI with custom branding
  • πŸ“Š Real-time BTC Price - Live price widget with 24h changes
  • 🎡 Background Music - Auto-play with premium audio
  • 🏦 Trustless Escrow - Bitcoin L1 smart contract security
  • πŸ—³οΈ Democratic Voting - Group fund release decisions
  • πŸ“± Mobile Responsive - Works seamlessly on all devices

πŸ“Έ Features

  • Create Group Funds β€” Trip, Gift, Rent, DAO, Business, Emergency, Custom
  • Invite Code System β€” Share a short code for anyone to join
  • Progress Tracking β€” Real-time funding bar with participant count
  • 3 Payout Rules:
    • ⚑ Auto β€” Funds release automatically when target reached
    • πŸ—³οΈ Vote β€” Majority threshold (configurable 51–100%)
    • πŸ”’ Unanimous β€” All participants must approve
  • Deadline + Auto-Refund β€” If target not reached by deadline, full refund
  • OP_NET Wallet β€” Connect your Bitcoin wallet for on-chain transactions
  • Demo Mode β€” Works fully without deployed contracts (local simulation)

πŸ—οΈ Architecture

BTCGather/
β”œβ”€β”€ src/                         ← React + Vite + Tailwind frontend
β”‚   β”œβ”€β”€ main.jsx
β”‚   β”œβ”€β”€ App.jsx                  ← Root: state, routing, demo simulation
β”‚   β”œβ”€β”€ index.css                ← Dark BTC theme + custom components
β”‚   β”œβ”€β”€ data/mockData.js         ← Mock groups, states, templates
β”‚   β”œβ”€β”€ hooks/
β”‚   β”‚   β”œβ”€β”€ useOPNetWallet.js    ← Wallet connect/disconnect/refresh
β”‚   β”‚   └── useGroupContract.js  ← Contract method bindings
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ opnetWallet.js       ← OP_NET wallet extension API
β”‚   β”‚   └── contractService.js   ← SDK + ABI + RPC layer
β”‚   └── components/
β”‚       β”œβ”€β”€ Header.jsx           ← Logo, wallet, nav
β”‚       β”œβ”€β”€ StatsBar.jsx         ← Protocol stats
β”‚       β”œβ”€β”€ GroupList.jsx        ← Grid + search + filters
β”‚       β”œβ”€β”€ GroupCard.jsx        ← Individual group card
β”‚       β”œβ”€β”€ GroupDetail.jsx      ← Full group view + actions
β”‚       β”œβ”€β”€ ParticipantsPanel.jsx← Contributor list
β”‚       β”œβ”€β”€ VotingPanel.jsx      ← Vote release/refund
β”‚       β”œβ”€β”€ CreateGroupModal.jsx ← 3-step wizard
β”‚       β”œβ”€β”€ JoinGroupModal.jsx   ← Invite code + browse
β”‚       └── Footer.jsx
β”‚
β”œβ”€β”€ contracts/                   ← AssemblyScript OP_NET smart contracts
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ escrow/EscrowContract.ts     ← Core escrow + state machine
β”‚   β”‚   β”œβ”€β”€ factory/GroupFactoryContract.ts ← Global group registry
β”‚   β”‚   β”œβ”€β”€ voting/VotingContract.ts     ← Standalone vote module
β”‚   β”‚   └── registry/RegistryContract.ts ← Contribution tracker
β”‚   β”œβ”€β”€ asconfig-{escrow,factory,voting,registry}.json
β”‚   β”œβ”€β”€ deploy.ts                ← Universal deployment script
β”‚   β”œβ”€β”€ package.json
β”‚   └── .env.example
β”‚
β”œβ”€β”€ index.html                   ← Contract address placeholders
β”œβ”€β”€ package.json
β”œβ”€β”€ vite.config.js
└── tailwind.config.js

πŸš€ Quick Start (Frontend Only)

cd BTCGather
npm install
npm run dev
# β†’ http://localhost:3000

Works in demo mode (mock data, local simulation) without deployed contracts.


πŸ”— Smart Contract Deployment

1. Setup

cd BTCGather/contracts
cp .env.example .env
# Edit .env β€” add your MNEMONIC and RPC_URL
npm install

2. Build All Contracts

npm run build:all

This produces 4 WASM files in build/:

  • BTCGatherEscrow.wasm
  • BTCGatherFactory.wasm
  • BTCGatherVoting.wasm
  • BTCGatherRegistry.wasm

3. Deploy Contracts

# Deploy EscrowContract (main contract)
npm run deploy:escrow

# Deploy GroupFactoryContract
npm run deploy:factory

# Deploy VotingContract
npm run deploy:voting

# Deploy RegistryContract
npm run deploy:registry

Each deploy prints the contract address. Copy each address into index.html:

<script>
  window.BTCGATHER_ESCROW_CONTRACT    = 'opt1...your_escrow_address';
  window.BTCGATHER_FACTORY_CONTRACT   = 'opt1...your_factory_address';
  window.BTCGATHER_VOTING_CONTRACT    = 'opt1...your_voting_address';
  window.BTCGATHER_REGISTRY_CONTRACT  = 'opt1...your_registry_address';
</script>

4. Restart Frontend

cd ..
npm run dev

The app now switches from demo mode to live OP_NET mode.


πŸ“œ Contract State Machines

EscrowContract

Open (1) ──[deposits]──▢ Funded (2)
                              β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό               β–Ό                    β–Ό
         Auto Rule        Vote Rule           All Rule
              β”‚               β”‚                    β”‚
              β–Ό               β–Ό                    β–Ό
         Released (4)    Voting (3)           Voting (3)
                           β”‚    β”‚               β”‚    β”‚
                        votes  votes          votes  votes
                           β”‚    β”‚               β”‚    β”‚
                           β–Ό    β–Ό               β–Ό    β–Ό
                       Released Refunded   Released Refunded
                          (4)    (5)          (4)    (5)

Open (1) ──[deadline passed]──▢ Expired (6) ──▢ Refunded (5)

VotingContract

Not Started (0) ──[openVote]──▢ Active (1)
                                    β”‚
                          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    [threshold]           [deadline]
                          β”‚                    β”‚
                    β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”        Expired (4)
                    β–Ό           β–Ό
               Release (2)  Refund (3)

πŸ” Security Model

  • Funds are locked in Bitcoin L1 smart contracts β€” no custody
  • Deadline-based auto-refund prevents permanent fund lockup
  • Vote thresholds are configurable per group (51%–100%)
  • 0.3% protocol fee only on successful release
  • No bridges, no EVM, Bitcoin L1 native only

βš™οΈ Contract Methods

EscrowContract

Method Type Description
createGroup(target, deadline, rule, pct) Write Initialize a new group escrow
deposit(amount) Write Contribute BTC to the fund
castVoteRelease() Write Vote to release funds to beneficiary
castVoteRefund() Write Vote to refund all contributors
finalizeRelease() Write Trigger release if vote threshold passed
claimRefund() Write Claim BTC refund
checkExpiry() Write Set expired state if deadline passed
getGroupInfo() View Full group state + amounts
getVoteInfo() View Vote counts + threshold
getProtocolStats() View Global protocol stats

GroupFactoryContract

Method Type Description
registerGroup(groupId) Write Register escrow in global registry
recordRelease(amount) Write Track released amount
getGroupCount() View Total registered groups
getFactoryStats() View Full factory statistics

VotingContract

Method Type Description
openVote(duration, pct, total) Write Start a vote round
castVote(0|1) Write Cast refund(0) or release(1) vote
finalizeVote() Write Check + finalize outcome
getVoteInfo() View Votes, state, deadline

RegistryContract

Method Type Description
recordDeposit(amount) Write Log a contribution
closeRegistry() Write Close registry to new deposits
getRegistryInfo() View Participant count + totals
getAverageDeposit() View Average contribution size

🌐 Networks

Network RPC URL
Testnet https://testnet-rpc.opnet.org
Mainnet https://rpc.opnet.org

Explorer: https://opscan.org


πŸ›£οΈ Roadmap

  • Phase 5 β€” Integration testing (multiple wallets, edge cases)
  • Phase 6 β€” UX polish (animations, tooltips, loading skeletons)
  • Contribution history per wallet address
  • Group invitation via URL share
  • Multi-group dashboard per wallet
  • Mobile PWA support

πŸ“„ License

MIT β€” Build freely on Bitcoin L1.

About

OP_NET Bitcoin Activation App - Bilingual Web3 Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors