| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A decentralized horse racing betting game built on Solana where players can create races, join with referral codes, and compete for prizes using native GOR tokens.
GOR Race is a blockchain-based horse racing simulation where:
git clone https://github.com/codewithmide/gor-race
cd gor-race
npm install# Set your Solana cluster
export ANCHOR_PROVIDER_URL="https://rpc.gorbagana.wtf"
export ANCHOR_WALLET="~/.config/solana/id.json"# Build the program
npm run build
# Deploy to GOR network
npm run deploy
# Initialize the platform (one-time setup)
npm run initializeCreate a player profile with a username for leaderboard tracking.
# Create profile with username
npm run create-profile HorseRacer123
npm run create-profile CryptoJockey
npm run create-profile SpeedDemonRequirements:
Output:
View your own profile or another player's profile.
# View your own profile
npm run profile
# View another player's profile by wallet address
npm run profile <PLAYER_WALLET_ADDRESS>Output:
View the leaderboard with various sorting options.
# Default leaderboard (sorted by score, top 10)
npm run leaderboard
# Sort by different metrics
npm run leaderboard wins # Sort by total wins
npm run leaderboard races # Sort by total races
npm run leaderboard earnings # Sort by total earnings
npm run leaderboard winrate # Sort by win percentage
npm run leaderboard podiums # Sort by podium finishes
# Specify number of players to show
npm run leaderboard score 20 # Top 20 by score
npm run leaderboard wins 5 # Top 5 by winsSorting Options:
Output:
Update your player statistics after completing a race.
# Update stats using referral code
npm run update-stats XYVSYS00
# Update stats using race ID
npm run update-stats 1751510633Requirements:
Output:
Create a new horse race with configurable wait time.
# Create race with default wait time (60 seconds)
npm run create-race
# Create race with custom wait time (30-180 seconds)
npm run create-race 90
npm run create-race 120
npm run create-race 180Output:
Parameters:
Join an existing race using its referral code.
# Join race with referral code, select horse 1-10
npm run join-race XYVSYS00 3
npm run join-race R3ZSYS00 7
# Default to horse 1 if not specified
npm run join-race XYVSYS00Requirements:
Output:
Execute race transitions - from joining to racing, and from racing to completed.
# Execute using referral code
npm run execute-race XYVSYS00
# Execute using race ID
npm run execute-race 1751510633Two-Phase Execution:
Phase 1: Start Race Simulation
Phase 2: Complete Race
Output:
Claim winnings after race completion.
# Claim using referral code
npm run claim-prize XYVSYS00
# Claim using race ID
npm run claim-prize 1751510633Requirements:
Prize Distribution:
Output for Winners:
Output for Non-Winners:
# Player Management
npm run create-profile <USERNAME> # Create player profile
npm run profile [PLAYER_ADDRESS] # View profile
npm run leaderboard [SORT] [LIMIT] # View leaderboard
npm run update-stats <RACE_REF> # Update race statistics
# Race Management
npm run create-race [WAIT_TIME] # Create new race
npm run join-race <CODE> [HORSE] # Join race
npm run execute-race <RACE_REF> # Execute race
npm run claim-prize <RACE_REF> # Claim winnings
# Development
npm run build # Build program
npm run deploy # Deploy program
npm run initialize # Initialize platform (one-time)
npm run clean # Clean build artifacts
npm run test # Run tests
npm run lint # Lint codegor-race/ ├── programs/ │ └── gor-race/ │ ├── src/ │ │ ├── lib.rs │ │ ├── state/ │ │ │ ├── mod.rs │ │ │ ├── race.rs │ │ │ ├── player_entry.rs │ │ │ └── platform_vault.rs │ │ ├── instructions/ │ │ │ ├── mod.rs │ │ │ ├── initialize.rs │ │ │ ├── create_race.rs │ │ │ ├── join_race.rs │ │ │ ├── execute_race.rs │ │ │ └── claim_prize.rs │ │ ├── errors/ │ │ │ └── mod.rs │ │ ├── constants/ │ │ │ └── mod.rs │ │ └── utils/ │ │ ├── mod.rs │ │ └── random.rs │ ├── Cargo.toml │ └── Xargo.toml ├── tests/ │ └── gor-race.ts ├── migrations/ │ └── deploy.ts ├── Anchor.toml ├── Cargo.toml ├── package.json ├── tsconfig.json └── README.md
The leaderboard uses a weighted scoring system that considers multiple factors:
Base Score Calculation:
Consistency Bonus: Players with 10+ races get additional multipliers based on win rate:
This rewards both high performance and consistent participation.
[features]
seeds = false
skip-lint = false
[programs.localnet]
gor_race = "YOUR_PROGRAM_ID"
[programs.testnet]
gor_race = "YOUR_PROGRAM_ID"
[registry]
url = "https://api.apr.dev"
[provider]
cluster = "https://rpc.gorbagana.wtf"
wallet = "~/.config/solana/gor-race.json"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"# Set program keypair
anchor keys sync
# Deploy to Gorbagana testnet
anchor deploy --provider.cluster https://rpc.gorbagana.wtf
# Note the deployed program ID# Run initialization script
anchor run initializeawait program.methods
.initialize(platformFeeBps)
.accounts({
platformVault: platformVaultPda,
authority: authority.publicKey,
systemProgram: SystemProgram.programId,
})
.signers([authority])
.rpc();await program.methods
.createRace()
.accounts({
race: racePda,
creator: creator.publicKey,
systemProgram: SystemProgram.programId,
clock: SYSVAR_CLOCK_PUBKEY,
})
.signers([creator])
.rpc();await program.methods
.joinRace(horseNumber)
.accounts({
race: racePda,
playerEntry: playerEntryPda,
player: player.publicKey,
playerTokenAccount: playerTokenAccount,
raceTokenVault: raceTokenVault,
tokenProgram: TOKEN_PROGRAM_ID,
systemProgram: SystemProgram.programId,
})
.signers([player])
.rpc();await program.methods
.executeRace()
.accounts({
race: racePda,
randomnessOracle: randomnessOracle,
clock: SYSVAR_CLOCK_PUBKEY,
})
.rpc();await program.methods
.claimPrize()
.accounts({
race: racePda,
playerEntry: playerEntryPda,
player: player.publicKey,
playerTokenAccount: playerTokenAccount,
raceTokenVault: raceTokenVault,
platformVault: platformVaultPda,
platformTokenAccount: platformTokenAccount,
tokenProgram: TOKEN_PROGRAM_ID,
})
.signers([player])
.rpc();anchor test --provider.cluster https://rpc.gorbagana.wtfanchor test --provider.cluster https://rpc.gorbagana.wtf -- --grep "should create race"The program randomly selects 10 horses from this pool for each race:
Insufficient GOR tokens
Program deployment fails
Transaction fails
| Back | FazBrowse Home | New Git URL |