A trustless, automated, Bitcoin-based bingo system that uses Bitcoin's blockchain for transparent, verifiable, and manipulation-resistant game outcomes.
- Backend: Node.js (Express), in-memory game state, deterministic bingo logic, IPFS (Pinata) for CSV storage, BlockCypher for Bitcoin data.
- Frontend: React (Create React App) - migrating to Next.js, Bootstrap UI, communicates with backend via REST API.
- Game Logic: All randomness is derived from the Bitcoin block hash (via BIP32 HD key derivation), ensuring provable fairness.
- Admin uploads CSV: List of participants (one per line, header
name). - CSV stored on IPFS: The app uploads the CSV to IPFS (via Pinata) and returns a CID (hex-encoded).
- Admin creates Bitcoin TX: The CID (hex) is embedded in a Bitcoin transaction's OP_RETURN output (e.g., using Electrum).
- Admin submits TXID: The app monitors the transaction for confirmation.
- Blockhash as randomness: Once confirmed, the block hash is used as the seed for all game randomness (card generation, number draws).
- Game link shared: Players receive a link (with TXID) to join and view their cards.
- Game proceeds: Numbers are drawn deterministically; cards are marked; winners are announced automatically.
- Anyone can verify: All results are reproducible using public data (block hash, CSV, open-source logic).
POST /api/check-transaction— Initialize a game from a TXID and participant file (admin only).POST /api/draw/:txid— Draw the next bingo number (Game Master only, requires token).POST /api/end-game/:txid— Manually end a game (for partial win mode, GM only).POST /api/continue-game/:txid— Continue after a partial win (GM only).GET /api/game-state/:txid— Get current game state (drawn numbers, winners, etc.).GET /api/cards/:txid/:nickname— Get all cards for a user in a game.
- Node.js v20+
- pnpm (preferred) or npm
- Bitcoin wallet (for creating the transaction)
- Pinata JWT API key (for IPFS storage)
- Internet connectivity
- Clone the repository:
git clone https://github.com/eddieoz/bitBingo.git
cd bitBingo- Install dependencies (using pnpm):
pnpm install- Configure environment variables:
Create a
.envfile in theserver/directory:
PORT=5000
NODE_ENV=development
PINATA_JWT_KEY=your_pinata_jwt_key_here
- Start the backend:
cd server
pnpm start- Start the frontend:
cd ../client
pnpm start- Access the app at http://localhost:3000
- Ensure you have a
.envfile inserver/as above. - Build and run:
docker compose build
docker compose up- Client: http://localhost:3000
- Server: http://localhost:5000
CSV must have a header row name and one nickname per line:
name
Alice
Bob
Charlie
- All randomness (card generation, number draws) is derived from the block hash of the confirmed Bitcoin transaction.
- Cards: For each participant, derive a BIP32 public key using the block hash (SHA-256) as the seed and path
m/44'/0'/0'/0/{lineIndex}. The card grid is generated from the public key (seeserver/utils.js). - Drawn numbers: For each draw, derive a public key at the next index, take the last 4 bytes, convert to an integer, and map to 1–75.
- Anyone can verify results using the public block hash, the original CSV, and the open-source logic (see
docs/verification.md).
- Backend: From
server/, run:pnpm test - Frontend: From
client/, run:pnpm test
- Private keys are never handled by the app.
- All randomness is public and verifiable.
- CSVs should not contain sensitive data.
MIT