The First Flash Loan Protocol for Bitcoin Layer 2
Bringing proven DeFi infrastructure to Bitcoin with atomic, uncollateralized flash loans on Stacks blockchain.
Current (Security-Hardened v1.2):
- Address:
ST3JAZD8CJ9XX3WNN2G61C7HD4RY333MRKPR5JGW7 - Deployed: January 5, 2026
- Status: Production-ready, awaiting professional audit
- Explorer: View on Stacks Testnet
Previous (Initial Testing):
- Address:
ST2X1GBHA2WJXREWP231EEQXZ1GDYZEEXYRAD1PA8 - Deployed: December 7, 2025
- Purpose: Initial testing and security analysis
- Explorer: View on Stacks Testnet
โ 27,000,000+ sBTC Processed
โ 100% Success Rate
โ 12 Contracts Deployed
โ 8 Production Receivers
โ 21 Functions Verified
โ Zero Critical Vulnerabilities (v1.2)
โ 0.05% Fee (Aave-competitive)
FlashStack enables atomic, uncollateralized loans within a single transaction on Stacks blockchain. Borrow unlimited capital, execute your strategy, and repayโall in one atomic operation. If repayment fails, the entire transaction reverts.
๐ Zero Inflation Guaranteed
- Atomic mint-burn architecture
- Mathematically impossible to inflate supply
- All-or-nothing execution
โก Capital Efficient
- No collateral required
- Unlimited borrowing capacity
- Instant liquidity access
๐ ๏ธ Developer-Friendly
- Simple trait-based integration
- 8 production receiver examples
- Comprehensive documentation
๐ Security-First Design
- Receiver whitelist protection
- Circuit breaker with rate limiting
- Emergency pause controls
- Proactive vulnerability fixes
- flashstack-core - Main protocol logic with atomic mint-burn
- sbtc-token - Token interface (mock for testnet, real sBTC on mainnet)
- flash-receiver-trait - Standard interface for receivers
โโโ test-receiver # Basic flash loan demonstration
โโโ example-arbitrage-receiver # DEX arbitrage template
โโโ liquidation-receiver # Liquidation bot with bonus capture
โโโ leverage-loop-receiver # 3x+ leveraged positions
โโโ collateral-swap-receiver # Atomic collateral swapping
โโโ yield-optimization-receiver # Auto-compounding strategies
โโโ dex-aggregator-receiver # Multi-DEX optimal routing
โโโ multidex-arbitrage-receiver # Complex multi-hop arbitrage
Critical Fixes:
- โ
Admin authentication upgraded (
tx-senderโcontract-caller) - โ
Removed all
unwrap-paniccalls (3 instances) - โ Fixed syntax errors in receiver contracts
- โ Comprehensive error handling implemented
New Security Features:
- โ Receiver Whitelist - Only approved contracts can execute flash loans
- โ Circuit Breaker - Max single loan (50K sBTC), max block volume (100K sBTC)
- โ Emergency Pause - Admin can halt protocol if threat detected
- โ Adjustable Parameters - Fee and limits configurable for market conditions
Security Commit: 13b4b60
Preferred Auditor: Clarity Alliance
- Audited Nakamoto VM and sBTC
- Secured $1B+ TVL in Stacks ecosystem
- Recognized as "gold standard" for Stacks DeFi
- Contact: nick@clarityalliance.org
Audit Scope:
- All 12 Clarity smart contracts
- Flash loan-specific attack vectors
- Economic model validation
- Business logic verification
- Integration security assessment
;; Spot price difference between ALEX and Velar
;; Borrow sBTC, buy on ALEX, sell on Velar, repay + profit
(flash-loan 1000 .my-arbitrage-receiver);; Liquidate undercollateralized position
;; Flash loan to repay debt, claim collateral, repay flash loan + profit
(flash-loan 5000 .my-liquidation-receiver);; Create 3x leveraged position atomically
;; Flash loan โ Deposit โ Borrow โ Deposit โ Borrow โ Repay flash loan
(flash-loan 2000 .my-leverage-receiver);; Move from Arkadiko to Zest without unwinding
;; Flash loan โ Repay Arkadiko โ Withdraw collateral โ Deposit Zest โ Borrow โ Repay
(flash-loan 3000 .my-swap-receiver)- Choose a Strategy - Pick from 8 production receivers or build custom
- Call Flash Loan - Execute through FlashStack Core
- Profit - Keep earnings minus 0.05% fee
Implement the trait:
(impl-trait .flash-receiver-trait.flash-receiver-trait)
(define-public (execute-flash (amount uint) (borrower principal))
(let (
(fee (/ (* amount u50) u100000))
(total-owed (+ amount fee))
)
;; YOUR STRATEGY HERE
(try! (your-arbitrage-logic amount))
;; REPAY THE LOAN
(as-contract (contract-call? .sbtc-token transfer
total-owed tx-sender .flashstack-core none))
)
)That's it! You now have access to unlimited flash loan capital.
See INTEGRATION_GUIDE.md for detailed examples.
- Security hardening v1.2 completed
- Testnet deployment verified
- Professional audit from Clarity Alliance
- Findings remediation
- Bug bounty program launch
- Real sBTC integration
- Frontend application
- DEX partnerships (ALEX, Bitflow, Velar)
- Developer SDK
- Mainnet deployment
- 3+ DEX integrations live
- 10+ developers building receivers
- $1M+ flash loan volume
- Multi-asset support (STX, other SIP-010 tokens)
- Governance token
- DAO structure
- Community proposals
- Protocol fee distribution
- Current (v1.2): ST3JAZD8CJ9XX3WNN2G61C7HD4RY333MRKPR5JGW7
- Previous: ST2X1GBHA2WJXREWP231EEQXZ1GDYZEEXYRAD1PA8
FlashStack is open-source (MIT License) and welcomes contributions!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-receiver) - Make your changes
- Add tests
- Submit a pull request
- Additional receiver patterns
- Integration guides for specific protocols
- Documentation improvements
- Security reviews
- Testing and QA
See CONTRIBUTING.md for detailed guidelines.
Glory Matthew (@mattglory)
- ๐ LearnWeb3 Level 34 Master
- ๐ Code4STX Participant
- ๐ Creator of SNP (Stacks Nexus Protocol)
- ๐ป 1,600+ lines of production Clarity code
- ๐ Based in Birmingham, UK (GMT timezone)
- Email: mattglory14@gmail.com
- GitHub: @mattglory
- Twitter: @mattglory_
Total Contracts: 12
Core Contracts: 3
Receiver Examples: 8
Supporting: 1
Lines of Code: 1,600+
Clarity Versions: 2 & 3
Test Coverage: Core functionality
Testnet Volume: 27M+ sBTC
Success Rate: 100%
Failed Txns: 0
Deployment Cost: ~1.3 STX
Gas per Loan: 3,000-6,000 ยตSTX
Fee Structure: 0.05%
FlashStack is the ONLY flash loan protocol on ANY Bitcoin Layer 2:
- โ None on Stacks
- โ None on RSK
- โ None on Lightning Network
- โ None on BOB, Merlin, Core, or Bitlayer
Flash loans on Ethereum process $10B+ in volume:
- Aave: Primary flash loan provider
- dYdX: Trading-focused flash loans
- Uniswap V3: Flash swaps
Bitcoin deserves the same capabilities.
- โ sBTC withdrawals enabled (April 2025)
- โ sBTC caps removed (September 2025)
- โ Stacks TVL: $164M+ and growing
- โ Institutional custody partnerships launching
- โ Bitcoin DeFi maturing rapidly
FlashStack aims to become standard infrastructure for Bitcoin Layer 2 DeFi:
Short-term (2026):
- Flash loan standard on Stacks
- 10+ protocol integrations
- $100M+ annual volume
Medium-term (2027):
- Multi-asset support (STX, other tokens)
- Cross-protocol composability
- Developer SDK widely adopted
Long-term (2028+):
- Potential expansion to other Bitcoin L2s
- DAO governance
- Ecosystem grant program
- Academic research citations
MIT License - See LICENSE for details.
FlashStack is open-source and free for everyone to use, modify, and build upon.
- Stacks Foundation - For supporting Bitcoin L2 development
- Clarity Alliance - For advancing Stacks security
- Code4STX Community - For feedback and support
- LearnWeb3 - For educational resources
- Ethereum DeFi Pioneers - For proving flash loans work
TESTNET STATUS
FlashStack is currently on testnet and has NOT been professionally audited.
DO NOT USE WITH REAL FUNDS.
Professional security audit is in progress. Mainnet deployment will only occur after:
- โ Clean audit from Clarity Alliance (or equivalent)
- โ All findings remediated
- โ Bug bounty program launched
- โ Community review period completed
- Try flash loans on testnet
- Join our Discord (coming soon)
- Follow development progress
- Build custom receivers
- Integrate with your protocol
- Contribute to the codebase
- Fund professional audit
- Support mainnet deployment
- Enable ecosystem growth
- Partner for integration
- Collaborate on use cases
- Join our ecosystem
Visit our Stats Dashboard to see:
- Real-time flash loan volume
- Active receivers
- Integration partners
- Fee collection
- Transaction history
(Dashboard coming soon)
January 8, 2026
- โ Security hardening v1.2 completed
- โ New testnet deployment verified
- โ Clarity Alliance selected as preferred auditor
January 5, 2026
- โ Security fixes implemented (admin auth, unwrap-panic, whitelist, circuit breaker)
- โ Emergency pause controls added
- โ All 21 functions tested and operational
December 7, 2025
- โ Complete testnet deployment (12 contracts)
- โ 27M+ sBTC processed successfully
- โ 100% success rate achieved
- Discord: Coming soon
- Twitter: @mattglory_
- Telegram: Coming soon
- Forum: Stacks Forum
Built with โค๏ธ for Bitcoin's DeFi future
FlashStack - Making Bitcoin capital efficient, one atomic transaction at a time.
Last Updated: January 8, 2026
Version: 1.2 (Security-Hardened)
Testnet: Live and operational
Mainnet: Pending professional audit