Documentation
Technical documentation and API reference
Getting Started
xiaobet.fun is a decentralized case opening platform built on the BNB Smart Chain. This documentation covers everything you need to know to integrate with our platform or understand how it works under the hood.
Prerequisites
- A Web3 wallet (MetaMask, Trust Wallet, etc.)
- BNB on the BNB Smart Chain network
- Basic understanding of blockchain transactions
Network Information
| Parameter | Value |
|---|---|
| Network Name | BNB Smart Chain Mainnet |
| Chain ID | 56 (0x38) |
| Currency Symbol | BNB |
| RPC URL | https://bsc-dataseed.binance.org/ |
| Block Explorer | https://bscscan.com |
Case System
xiaobet.fun offers six different case types, each with unique price points and reward distributions.
Case Types
| Case Name | Price | Min Payout | Max Payout |
|---|---|---|---|
| Bronze Case | 0.03 BNB | 0.0003 BNB | 5 BNB |
| Silver Case | 0.10 BNB | 0.001 BNB | 15 BNB |
| Gold Case | 0.30 BNB | 0.003 BNB | 40 BNB |
| Diamond Case | 1.00 BNB | 0.01 BNB | 150 BNB |
Rarity Tiers
Each case contains 7 items across different rarity tiers. The odds are identical across all case types:
| Rarity | Probability | Odds (1 in X) |
|---|---|---|
| Legendary | 0.02% | 1 in 5,000 |
| Rare | 0.50% | 1 in 200 |
| Covert | 1.50% | 1 in 67 |
| Classified | 4.00% | 1 in 25 |
| Restricted | 10.00% | 1 in 10 |
| Mil-Spec | 24.00% | 1 in 4 |
| Common | 59.98% | ~3 in 5 |
Smart Contract Integration
xiaobet.fun uses smart contracts to ensure transparency and fairness. All case openings are executed on-chain.
Contract Address
0x000000000000000000000000d0180386dbef2dde67f04c45aa8fdfcf0a3950ba
c886c3ee76ced32121f99b6ed183957107a88c55285805b0c737df97b078e00b
You can verify the contract on BscScan and view all transactions, functions, and source code.
Contract Overview
The XiaobetFun smart contract is a provably fair BNB prize/betting contract deployed on the BNB Smart Chain. It uses a combination of blockhash, server seed, and client seed to generate truly random and verifiable results.
Key Features
- Fixed Bet Price: 0.03 BNB per bet/case opening
- 7 Reward Tiers: From Legendary (10 BNB) to Consolation (0.0005 BNB)
- Provably Fair: Uses blockhash + server seed + client seed for randomness
- Inventory System: All wins are stored on-chain and can be redeemed instantly
- Transparent Odds: All probabilities are hardcoded in the contract
How the Contract Works
1. Place Bet: User calls placeBet(bytes32 clientSeed) with exactly 0.03 BNB
2. Generate Random Number: Contract combines:
- Previous block hash
- Pre-committed server seed hash
- User's client seed
- User's address
- Nonce (incrementing counter)
- Block timestamp
3. Determine Reward: Random number is used to select a reward based on probability distribution
4. Store in Inventory: Winning reward is added to user's on-chain inventory
5. Redeem Anytime: User can call redeemReward(uint256 inventoryIndex) to instantly receive BNB payout
Reward Structure
| Reward Name | Rarity | Payout | Probability | Odds |
|---|---|---|---|---|
| Mega Jackpot | Legendary | 10 BNB | 2 / 10,000 | 0.02% (1 in 5,000) |
| Major Reward | Epic | 1 BNB | 50 / 10,000 | 0.50% (1 in 200) |
| Big Reward | Rare | 0.25 BNB | 150 / 10,000 | 1.50% (1 in 67) |
| Solid Reward | Uncommon | 0.1 BNB | 400 / 10,000 | 4.00% (1 in 25) |
| Small Reward | Common | 0.025 BNB | 1,000 / 10,000 | 10.00% (1 in 10) |
| Minor Reward | Low | 0.005 BNB | 2,400 / 10,000 | 24.00% (1 in 4) |
| Consolation | Very Common | 0.0005 BNB | 5,998 / 10,000 | 59.98% (~3 in 5) |
Randomness Algorithm
uint256 randomNumber = uint256(keccak256(abi.encodePacked(
blockhash(block.number - 1),
serverSeedHash,
clientSeed,
msg.sender,
nonce,
block.timestamp
)));
uint256 roll = randomNumber % 10000;
uint256 rewardId = determineReward(roll);
This algorithm ensures that:
- Results cannot be predicted in advance
- Neither the house nor the player can manipulate outcomes
- Every result is verifiable on-chain
- The process is completely transparent
Opening a Case
To open a case programmatically, you need to interact with the smart contract:
// Example using Web3.js
const casePrice = web3.utils.toWei('0.03', 'ether');
const contract = new web3.eth.Contract(ABI, contractAddress);
const clientSeed = web3.utils.randomHex(32);
await contract.methods.placeBet(clientSeed)
.send({ from: userAddress, value: casePrice });
Item Identifiers
After opening a case, the smart contract sends back a small identifier transaction to mark which item was won:
| Item Position | Identifier Amount |
|---|---|
| Item #1 (Legendary) | 0.00001 BNB |
| Item #2 (Rare) | 0.00002 BNB |
| Item #3 (Covert) | 0.00003 BNB |
| Item #4 (Classified) | 0.00004 BNB |
| Item #5 (Restricted) | 0.00005 BNB |
| Item #6 (Mil-Spec) | 0.00006 BNB |
| Item #7 (Common) | 0.00007 BNB |
Provably Fair System
xiaobet.fun implements a provably fair random number generation system to ensure complete transparency and fairness in all case openings.
How It Works
- Client Seed: A random seed generated in your browser
- Server Seed: A pre-committed random seed from our server
- Blockhash: The hash of the blockchain block at the time of opening
- Nonce: A unique counter to ensure no duplicates
These values are combined and hashed to produce the final random number that determines your item:
finalHash = SHA256(clientSeed + serverSeed + blockhash + nonce)
randomNumber = parseInt(finalHash, 16) % 10000
wonItem = determineItemFromNumber(randomNumber)
Verification
To verify a case opening result:
- Retrieve the transaction hash from your wallet
- Look up the transaction on BscScan
- Check the input data and logs for the random seeds
- Recalculate the hash yourself using the same algorithm
- Verify the result matches what you received
Security
Best Practices
- Never share your wallet's private keys or seed phrase
- Always verify you're on the correct website before connecting your wallet
- Use a hardware wallet for large amounts
- Enable two-factor authentication on your wallet if available
- Only connect to trusted dApps
Smart Contract Security
Our smart contracts have been designed with security as the top priority:
- All contracts are open source and verifiable on BscScan
- Implements industry-standard security patterns
- Uses OpenZeppelin libraries for critical functions
- Follows checks-effects-interactions pattern to prevent reentrancy
- Comprehensive test coverage
API Reference
For developers looking to integrate xiaobet.fun into their applications:
Web3 Connection
// Connect to user's wallet
const accounts = await window.ethereum.request({
method: 'eth_requestAccounts'
});
// Get user's balance
const balance = await window.ethereum.request({
method: 'eth_getBalance',
params: [userAddress, 'latest']
});
Case Data Structure
{
price: 0.03,
items: [
{ name: 'Item Name', value: 5, odds: 0.02, rarity: 'LEGENDARY' },
// ... more items
]
}
Support
If you need help or have questions:
- Read our How It Works guide
- Join our Discord community
- Follow us on Twitter for updates
- Contact support through our website
Responsible Gaming
xiaobet.fun is committed to promoting responsible gaming:
- Must be 18+ to participate
- Set personal limits and stick to them
- Never gamble with money you can't afford to lose
- Take regular breaks
- Seek help if gambling becomes a problem