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

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

How the Contract Works

1. Place Bet: User calls placeBet(bytes32 clientSeed) with exactly 0.03 BNB

2. Generate Random Number: Contract combines:

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:

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

  1. Client Seed: A random seed generated in your browser
  2. Server Seed: A pre-committed random seed from our server
  3. Blockhash: The hash of the blockchain block at the time of opening
  4. 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)
Note: All seeds, hashes, and results are permanently recorded on the blockchain and can be independently verified by anyone at any time.

Verification

To verify a case opening result:

  1. Retrieve the transaction hash from your wallet
  2. Look up the transaction on BscScan
  3. Check the input data and logs for the random seeds
  4. Recalculate the hash yourself using the same algorithm
  5. Verify the result matches what you received

Security

Best Practices

Smart Contract Security

Our smart contracts have been designed with security as the top priority:

Important: While we take every precaution to ensure security, you should never invest more than you can afford to lose. Cryptocurrency transactions are irreversible.

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:

Responsible Gaming

xiaobet.fun is committed to promoting responsible gaming: