Sherwood Protocol // Whitepaper v2.0

OutlawFlip Whitepaper

A provably fair, instant-settle on-chain coinflip protocol built on Robinhood Chain. This document outlines the architecture, game theory, economic model, and technical implementation of OutlawFlip V4.

1. Abstract

OutlawFlip is a decentralized coinflip game that leverages Robinhood Chain's fast finality and low fees to deliver an instant, transparent, and provably fair betting experience. Players stake USDG in preset amounts ($1, $5, or $10) and receive payouts in USDG at 1.9× multiplier, with settlement occurring in the same transaction as the bet — eliminating the delay and complexity associated with oracle-based randomness solutions.

V4 introduces preset-based betting with adjustable win rates per preset, giving the house fine-grained control over the game economy while maintaining a simple, accessible player experience.

2. Architecture

2.1 Smart Contract

The protocol consists of a single primary contract, CoinFlipV4, which handles all game logic, token transfers, and settlement.

  • CoinFlipV4 — Main game contract. Handles bet placement, randomness generation, settlement, and payout in USDG.
  • USDG Token — ERC-20 stable token. The only stake and payout token. Preset amounts: $1, $5, $10.
  • OUTLAW Token — ERC-20 governance/reward token. Not used in V4 gameplay, retained for ecosystem utility.

2.2 Frontend

The frontend is a static single-page application deployed on Vercel, using ethers.js v6 for blockchain interaction. It supports MetaMask and EIP-6963 multi-wallet detection. Edge middleware routes subdomains to individual pages.

2.3 No External Dependencies

V4 uses on-chain blockhash entropy. This removes the need for:

  • VRF Coordinator contract
  • VRF Subscription and LINK funding
  • Keeper/automation bot for fulfillment
  • Two-transaction settle flow (place + fulfill)

3. Game Mechanics

3.1 Bet Flow

  1. Player selects a preset ($1, $5, or $10 USDG) and a side (HEADS or TAILS).
  2. Player approves the CoinFlipV4 contract to transfer the stake amount in USDG.
  3. Player calls placeBet(preset, choice).
  4. Contract transfers USDG stake from player to itself.
  5. Contract generates random result using blockhash entropy + win rate check.
  6. If player wins, contract transfers 1.9× stake in USDG to player.
  7. Contract emits BetPlaced and BetSettled events.

All steps 3–7 execute in a single transaction.

3.2 Randomness

The random result is derived from:

entropy = keccak256(
  abi.encodePacked(
    blockhash(block.number - 1),
    block.timestamp,
    msg.sender,
    nextBetId,
    tx.gasprice
  )
)
roll = entropy % 10000
// If roll < preset.winBps → player wins
// If roll >= preset.winBps → player loses

Win Rate: Each preset has a configurable win rate in basis points (0–10000). At 5000 (50%), the game is a fair coin flip. The owner can adjust win rates per preset to control house edge.

Result Mapping: If the roll indicates a win, the result is set to match the player's choice. If the roll indicates a loss, the result is set to the opposite. This ensures the coin animation always reflects the actual outcome.

3.3 Presets & Win Rates

PresetAmountDefault Win RatePayout
0$1 USDG50%$1.90 USDG
1$5 USDG50%$9.50 USDG
2$10 USDG50%$19.00 USDG

Win rates are adjustable per preset via the admin panel. This allows the house to:

  • Offer higher win rates on smaller bets to attract new players
  • Lower win rates on larger bets to manage risk exposure
  • Run promotions with boosted win rates
  • Implement dynamic difficulty based on bankroll health

4. Token Economics

4.1 USDG

USDG is the sole stake and payout token in OutlawFlip V4. Players bet in USDG and receive winnings in USDG at 1.9× multiplier. All preset amounts are denominated in USDG.

4.2 OUTLAW Token

OUTLAW is the governance and ecosystem token of the Sherwood Protocol. While not used in V4 gameplay, it retains utility for:

  • Governance voting on protocol parameters
  • Staking for revenue share (future)
  • Access to premium features (future)

4.3 House Economics

At 50% win rate, the house edge is 5% (RTP = 95%). The house collects all losing stakes in USDG. The owner can adjust win rates to modify the house edge dynamically:

Win RateRTPHouse Edge
50%95%5%
45%85.5%14.5%
55%104.5%−4.5% (house loss)

4.4 Bankroll

The contract maintains a bankroll of USDG tokens to cover potential payouts. Each bet is checked against the contract's USDG balance before acceptance — if the balance cannot cover the maximum potential payout, the bet is rejected.

5. Security

5.1 Reentrancy Protection

The placeBet function uses OpenZeppelin's ReentrancyGuard, preventing reentrancy attacks during token transfers.

5.2 Safe Token Transfers

All ERC-20 transfers use SafeERC20, which handles non-standard return value tokens gracefully.

5.3 Solvency Check

Before each bet is accepted, the contract verifies that usdg.balanceOf(this) ≥ payout. If the bankroll is insufficient, the transaction reverts.

5.4 Access Control

Admin functions (withdraw, set presets, set win rates, pause) are restricted to the contract owner via OpenZeppelin's Ownable.

5.5 Non-Custodial

The contract does not hold player funds between bets. Winnings are transferred directly to the player's wallet in the same transaction. Only the bankroll and accumulated losing stakes are held by the contract.

6. Roadmap

PhaseFeatureStatus
v1.0VRF-based coinflip (Chainlink)✅ Deployed
v2.0Instant settle (blockhash)✅ Deployed
v2.1Multi-wallet support (EIP-6963)✅ Live
v3.0USDG flexible betting + market rate✅ Deployed
v4.0Preset amounts + adjustable win rates✅ Live
v4.1Mainnet deployment📋 Planned
v5.0Commit-reveal randomness for production📋 Planned
v5.1Leaderboard & achievements📋 Planned
v5.2Streak multipliers & bonus modes📋 Planned

7. Disclaimer

OutlawFlip is reference software. Before running a real gambling service, you must:

  • Obtain appropriate gambling licenses in your jurisdiction
  • Implement responsible-gambling controls (deposit limits, self-exclusion)
  • Conduct professional smart contract audits
  • Consider upgrading to commit-reveal or Chainlink VRF for production randomness
  • Comply with all local, state, and federal regulations

This software is provided "as is" without warranty of any kind.