"Polymarket for Tweets" - Create and trade on-chain markets for any tweet's engagement metrics in seconds.
Bangr is a decentralized prediction market platform where users can bet on whether tweets will reach engagement targets (views, likes, retweets, comments) within 24 hours. We turn social media attention into a tradeable on-chain asset.
Traditional prediction markets are:
- Too abstract β focused on macro events and politics
- Hard to use β complex UX that alienates non-crypto users
- Slow to resolve β manual, subjective oracles
Bangr feels like scrolling Twitter and tapping a bet button, not filling out a DeFi form.
- β Permissionless Market Creation β Paste any tweet URL, pick a metric, set a target
- β 4 Engagement Metrics β Views, Likes, Retweets, Comments
- β YES/NO Trading β Buy and sell shares with USDC
- β Real-time Tweet Data β Live metrics, avatars, quote tweets, images
- β Portfolio Tracking β Real cost basis, average entry price, P&L
- β One-Click USDC Minting β Seamless testnet onboarding
- β Neo-Brutalist UI β Arcade-style design that feels like a social app
- β
Event-Driven Trading β On-chain
TradeExecutedevents for accurate history
-
Smart Contracts (Solidity)
MarketFactoryβ Creates markets for tweet + metric + targetOrderBookβ Manages trading and emits detailed trade eventsShareTokenβ ERC-1155 YES/NO shares per marketOracleβ Resolves markets based on final metrics- Mock USDC β ERC-20 stablecoin for testnet
-
Frontend (Next.js 15 + TypeScript)
- Privy wallet integration (email & social login)
- Wagmi + Viem for blockchain interaction
- Recharts for live metric visualization
- TwitterAPI.io for real-time tweet data
- Prisma + SQLite for caching and rate limit handling
-
Key Innovations
- No hidden creation thresholds
- Green confetti on market creation
- Real trade history from on-chain events
- Quote tweet support with nested display
- Dynamic chart scaling per metric
| Contract | Address | Description |
|---|---|---|
| MockUSDC | 0x64142706680e2707e5D23887505c5DD54855a779 |
Mintable testnet USDC (6 decimals) |
| ShareToken | 0x21c0E794839d771Ff686A53c2750629A9253b171 |
ERC-1155 YES/NO shares |
| MarketFactory | 0xf7fC37078f59123BB2e96fAB578EdD94009c5675 |
Create & manage markets |
| OrderBook | 0x977ea3ab6588c05C19b7e5C7159c35b6205f57Eb |
Trading engine with events |
| Oracle | 0x67Eaa30E45a14DdfA63CBBd94633076BD98887bE |
Market resolution system |
Last Deployed: November 18, 2025
Network: BSC Testnet
Explorer: View on BscScan
Blockchain:
- Solidity ^0.8.20
- Hardhat (testing, deployment, verification)
- OpenZeppelin contracts (ERC-1155, ERC-20)
- BNB Chain (low fees, fast finality)
Frontend:
- Next.js 15.1.4 (App Router)
- TypeScript
- Tailwind CSS (neo-brutalist design system)
- Privy (wallet authentication)
- Wagmi + Viem (blockchain interaction)
- Recharts (live charts)
- Prisma + SQLite (tweet metadata caching)
APIs:
- TwitterAPI.io (tweet metrics + metadata)
- Node.js 18+ and npm
- MetaMask or wallet that supports BNB Testnet
- Testnet BNB (Get from faucet)
# Clone the repository
git clone https://github.com/yourusername/bangrsh.git
cd bangrsh/bangr
# Install dependencies
npm install
# Set up environment variables
cp .env.example .env
# Edit .env with your keys (see below)
# Initialize database
npx prisma migrate dev
# Run development server
npm run devCreate .env in the /bangr directory:
# Privy Authentication (Required)
NEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id
# Twitter API (Required for metrics)
TWITTER_API_KEY=your_twitter_api_key
# Contract Addresses (BNB Testnet)
NEXT_PUBLIC_USDC_ADDRESS=0x64142706680e2707e5D23887505c5DD54855a779
# Database (SQLite for development)
DATABASE_URL="file:./dev.db"Get API Keys:
- Privy: dashboard.privy.io (Free tier)
- TwitterAPI.io: twitterapi.io (Pay-as-you-go)
- Paste a tweet URL (e.g.,
https://twitter.com/elonmusk/status/123...) - App fetches metrics β Views, likes, retweets, comments from TwitterAPI.io
- Pick a metric β Choose which engagement type to bet on
- Set a target β Use multiplier (2x, 5x, 10x, 20x) or manual input
- Duration: 24 hours β Market expires 24h after creation
- Deposit 10 USDC β Receive 10 YES + 10 NO shares
- Market goes live β Tweet data cached in database, shares listed
Example:
- Tweet has 50K views currently
- Choose 10x multiplier
- Target: 500K views in 24h
- Market question: "Will this hit 500K views in 24h?"
Users can:
- Buy YES shares if they think the tweet will reach the target
- Buy NO shares if they think it won't
- Sell shares anytime before expiry
- View live metrics β Charts update with current tweet performance
Price discovery happens through supply/demand of YES/NO shares.
After 24 hours:
- Oracle fetches final engagement metrics
- Compares final value to target threshold
- YES wins: Final metric β₯ Target β YES holders get $1/share
- NO wins: Final metric < Target β NO holders get $1/share
- INVALID: Tweet deleted/private β Both sides get $0.50/share
Users can see:
- Active positions β Markets still running
- Historical trades β On-chain
TradeExecutedevents - Real P&L β Actual cost basis and average entry price
- Position details β Shares held, current value, unrealized gains
bangrsh/
βββ bangr/ # Next.js frontend
β βββ app/
β β βββ page.tsx # Homepage (market grid)
β β βββ market/[id]/ # Market detail pages
β β βββ portfolio/ # User portfolio
β β βββ api/ # Next.js API routes
β β βββ twitter/ # Twitter metrics fetching
β β βββ markets/ # Market data management
β βββ components/
β β βββ Header.tsx # Nav with wallet + balance
β β βββ BangrCard.tsx # Market cards
β β βββ CreateMarketModal.tsx # Market creation flow
β β βββ MintUSDCButton.tsx # Testnet USDC minting
β β βββ market/ # Market detail components
β βββ lib/
β β βββ hooks/ # Custom React hooks
β β β βββ useMarkets.ts # Fetch all markets
β β β βββ useTweetMetrics.ts # Tweet data fetching
β β β βββ useTradeHistory.ts # On-chain trade events
β β β βββ useUserPositions.ts # Portfolio tracking
β β βββ contracts/
β β β βββ addresses.ts # Contract addresses
β β β βββ abis.json # Contract ABIs
β β βββ prisma.ts # Database client
β βββ prisma/
β β βββ schema.prisma # Database schema
β βββ contexts/
β βββ WalletContext.tsx # Global wallet state
βββ contracts/ # Hardhat project
β βββ contracts/
β β βββ MarketFactory.sol # Market creation
β β βββ OrderBook.sol # Trading engine
β β βββ ShareToken.sol # ERC-1155 shares
β β βββ Oracle.sol # Resolution system
β β βββ MockERC20.sol # Testnet USDC
β βββ scripts/
β β βββ deploy.js # Deployment script
β βββ test/ # Contract tests
β βββ hardhat.config.js # Hardhat config
βββ REDEPLOY_INSTRUCTIONS.md # Contract deployment guide
- Get testnet BNB: BSC Faucet
- Connect wallet to Bangr
- Click "Mint Test USDC" in the header (mints 1000 USDC)
- Click "+ Create" button
- Paste a tweet URL
- Wait for metrics to load
- Select metric (Views/Likes/Retweets/Comments)
- Choose target (use multiplier or custom)
- Click "Create Market"
- Approve USDC spending (one-time)
- Confirm transaction
- π Green confetti on success!
- Browse markets on homepage
- Click a market card
- View live tweet + metrics
- Click YES or NO
- Enter amount (in USDC)
- Review price per share
- Confirm transaction
- Check Portfolio to see your position
cd contracts
# Install dependencies
npm install
# Compile contracts
npx hardhat compile# Run all tests
npx hardhat test
# Run with gas reporting
REPORT_GAS=true npx hardhat test
# Test coverage
npx hardhat coverage# Deploy to BNB Testnet
npx hardhat run scripts/deploy.js --network bscTestnet
# Update frontend addresses
# Copy addresses from terminal to bangr/lib/contracts/addresses.ts
# Restart dev server
cd ../bangr
npm run devSee REDEPLOY_INSTRUCTIONS.md for detailed deployment guide.
- Core smart contracts (Factory, OrderBook, ShareToken, Oracle)
- Frontend UI with neo-brutalist design
- Wallet integration (Privy)
- Market creation flow
- Tweet data fetching (TwitterAPI.io)
- Real-time metrics display
- Portfolio tracking
- On-chain trade history
- Quote tweet support
- Database caching (Prisma + SQLite)
- Testnet deployment (BNB Chain)
- Comprehensive error handling
- Mobile responsive design
- Market resolution testing
- Rate limit optimization
- Performance monitoring
- User feedback collection
- Automated market resolution (24h)
- Chainlink integration for decentralized oracles
- Email notifications for market expiry
- Tweet author verification & claiming
- Advanced analytics dashboard
- Historical market data
- Security audit (CertiK or Quantstamp)
- Deploy to BNB Mainnet
- Switch to real USDC
- Marketing campaign
- Community building
- Mobile app (React Native)
- Multi-chain expansion (Base, Arbitrum)
- Liquidity pools (AMM alternative)
- Leaderboards & achievements
- Social trading (copy trades)
- Limit orders on frontend
- Market insights (trending tweets)
- API for third-party integrations
- DAO governance (BANGR token)
cd bangr
# Run dev server with hot reload
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Lint code
npm run lint
# Format code
npm run formatcd bangr
# Create new migration
npx prisma migrate dev --name description_here
# Reset database (wipes all data)
npx prisma migrate reset
# Open Prisma Studio (GUI)
npx prisma studio
# Generate Prisma Client
npx prisma generatecd contracts
# Compile contracts
npx hardhat compile
# Run local node
npx hardhat node
# Deploy locally
npx hardhat run scripts/deploy.js --network localhost
# Verify on BscScan
npx hardhat verify --network bscTestnet DEPLOYED_ADDRESS "Constructor Arg1" "Arg2"We welcome contributions! Here's how:
- Fork the repository
- Create a branch:
git checkout -b feature/amazing-feature - Make changes and test thoroughly
- Commit:
git commit -m 'Add amazing feature' - Push:
git push origin feature/amazing-feature - Open a Pull Request
- Write clean, commented code
- Follow existing code style
- Add tests for new features
- Update documentation
- Keep commits atomic and descriptive
This project is licensed under the MIT License - see the LICENSE file for details.
- Live App: [Coming soon]
- Documentation: /docs
- BscScan: Testnet Contracts
- BNB Faucet: Get Testnet BNB
- Privy: Dashboard
- TwitterAPI.io: Documentation
Got questions? Need help?
- Open an Issue: GitHub Issues
- Read the Docs: Documentation
- Join Discord: [Coming soon]
- Follow on Twitter: [Coming soon]
Built with:
- BNB Chain β Fast, low-cost infrastructure
- Privy β Seamless wallet authentication
- TwitterAPI.io β Real-time tweet data
- OpenZeppelin β Battle-tested smart contracts
- Next.js β Modern React framework
- Tailwind CSS β Rapid UI development
This is experimental software on testnet.
- Markets are for entertainment/testing only
- No real money on testnet
- Smart contracts are not audited
- Use at your own risk
For mainnet launch, contracts will undergo professional security audits.
Built with π₯ for the future of social betting
Bangr β Where tweets meet markets