Skip to content

GauravKarakoti/StackCircle

Repository files navigation

StackCircle : Decentralized Bitcoin Stacking Groups

Citrea Testnet Test Coverage Testnet Circles

Overview 🌐

StackCircle enables communities to pool BTC toward shared financial goals using Bitcoin's first zk-rollup. The platform combines zero-knowledge proofs with Bitcoin's security to create trustless savings circles.

Core Value Proposition:

  • ZK-verified contributions using Bitcoin timestamp proofs
  • 🏆 Achievement NFTs for participation milestones
  • 🛡️ Non-custodial management through multi-sig wallets
  • 🌱 On-chain governance for fund distribution decisions

Key Components

Live Demo 🔍

Experience StackCircle on Citrea Testnet:

Testnet URL: https://stack-circle.vercel.app  
Test Wallet: 0xA292c308Bf0054c0c8b85bA5872499533343483a

Get Test BTC: Citrea Faucet

Key Features 🚀

zCircle Creation

  • Set custom savings goals (e.g., "10k sats/day for community project")
  • Define contribution frequency (daily/weekly/monthly)
  • Configure member approval requirements

Contribution System

Contribution System

  • Recurring automated contributions
  • Privacy-preserving balance verification via ZK proofs
  • Streak tracking with decay mechanism
  • Leaderboards with social incentives

Fund Management

  • Multi-sig withdrawal requirements (m-of-n approval)
  • On-chain proposal/voting system
  • Time-locked emergency withdrawals
  • Transparent treasury auditing

Development Setup ⚙️

Prerequisites

  • Node.js v18+
  • Git
  • Citrea Testnet Wallet (with test BTC)

Installation

# Clone repository
git clone https://github.com/GauravKarakoti/stackcircle
cd stackcircle

# Install dependencies
npm install
cd frontend && npm install

Smart Contract Operations

Command Action
npx hardhat compile Compile contracts
npx hardhat test Run test suite (100% coverage)
npx hardhat run scripts/deploy.js --network citrea Deploy to Citrea

Start Frontend

cd frontend
npm run dev

Architecture Deep Dive 🧠

Core Components

Contract Structure

Key Technical Integration

  1. BTC Timestamp Verification
// ContributionEngine.sol
function verifyBitcoinTx(bytes calldata proof) public {
    require(BtcTimestampMock.verify(proof), "Invalid BTC proof");
}
  1. Privacy-Preserving Contributions
// StreakTracker.sol
function verifyContribution(
    uint256 merkleTreeRoot,
    uint256 nullifierHash,
    uint256[8] calldata proof
) public {
    semaphore.verifyProof(merkleTreeRoot, nullifierHash, proof);
}
  1. Wallet Integration
// CitreaContext.jsx
const connectWallet = async () => {
  const accounts = await window.ethereum.request({
    method: 'eth_requestAccounts'
  });
  setAccount(accounts[0]);
}

Progress Metrics 📊

Wave 1 Testnet Results:

Metric Value
Testnet Circles 50+
Avg Contributions/Week 3.7
Avg Transaction Confirmation 2.5s
Avg Circle Size 0.0003 BTC

Deployed Contracts (Citrea Testnet) 📍

Contract Address
SemaphoreMock 0xa535bDA556Ca7F30D8dF62420678e47A3175C65C
BtcTimestampMock 0x3f5C249af9c3CEDa938f37C8429fc30090DceE23
CircleFactory 0x073fD36050BE24618d40982d997061539DAD3b04
BadgeSystem 0xC04F7a61Fc17df578FC806E101dbeD08bCfA0237

Troubleshooting 🔧

Common Issues:

  1. Contract Deployment Fails
  • Ensure wallet has test BTC from faucet
  • Verify gas settings in hardhat.config.js
  1. Frontend Connection Issues
// Add to src/index.js
window.ethereum.autoRefreshOnNetworkChange = false;
  1. Test Failures
npx hardhat test --network hardhat --reset

Roadmap 🚧

  • Bitcoin Light Client verification
  • Cross-chain governance module
  • Mobile PWA implementation
  • Nostr integration for notifications

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published