Batch Splitter + On-Chain Raffle — Built for the BOT Chain Builder Challenge #1
Send native BOT tokens to multiple recipients in a single transaction.
- Equal Split — divide a total amount equally among N recipients
- Custom Amounts — specify exact amounts per recipient
- Saves gas vs individual transfers, perfect for payroll, airdrops, rewards
Verifiably fair lottery using blockhash randomness.
- Create raffles with on-chain name, title, community, and banner color
- Configurable ticket price, max tickets, and duration
- Multiple entries per user (weighted odds)
- Blockhash-based randomness — no oracle needed
- Cancel & refund support
- Leverages BOT Chain's ~0.75s block times for fast draws
Addresses are set via environment variables. See .env.example.
| Contract | Env Var |
|---|---|
| BatchSplitter | VITE_BATCHSPLITTER_ADDRESS |
| Raffle | VITE_RAFFLE_ADDRESS |
- Contracts: Solidity 0.8.28, Foundry (see
contracts-foundry/) - Frontend: React, Vite, ethers.js v6
- Network: BOT Chain Testnet (Chain ID 968)
npm install
# Copy env and set your contract addresses
cp .env.example .env
npm run devThe frontend reads contract addresses from env vars (Vite VITE_ prefix):
| Variable | Description |
|---|---|
VITE_BATCHSPLITTER_ADDRESS |
BatchSplitter contract address |
VITE_RAFFLE_ADDRESS |
Raffle contract address |
For Vercel, add these in Project Settings → Environment Variables.
For local dev, set them in .env.
# Install Foundry: https://book.getfoundry.sh
curl -L https://foundry.paradigm.xyz | bash && foundryup
cd contracts-foundry
forge build
forge test -vvImport your deployer wallet into Foundry's encrypted keystore — private key never touches a file or env var.
# Import wallet (interactive, prompts for private key and password)
cast wallet import deployer --keystore-dir ~/.foundry/keystores
# Verify it's imported
cast wallet address --keystore ~/.foundry/keystores/deployer --password <your-password>
# Deploy
cd contracts-foundry
forge script script/Deploy.s.sol \
--rpc-url https://rpc.botchain.ai \
--broadcast \
--keystore ~/.foundry/keystores/deployer \
--password <your-password>
# Update .env with the new contract addresses from the outputforge script script/Deploy.s.sol \
--rpc-url https://rpc.botchain.ai \
--broadcast \
--ledger# Only use in CI pipelines — never commit .env
export PRIVATE_KEY=0x...
forge script script/Deploy.s.sol \
--rpc-url https://rpc.botchain.ai \
--broadcast \
--private-key $PRIVATE_KEY- Copy the deployed contract address from the forge output
- Update
src/contracts.jsdefaults (or setVITE_*env vars) - Update
.env.examplewith the new addresses - Update the contract address table in this README
- Update the ABI:
cp contracts-foundry/out/Raffle.sol/Raffle.json src/abis/Raffle.json - Commit and push — Vercel auto-deploys
- Chain ID: 677
- RPC: https://rpc.botchain.ai
- Explorer: https://scan.botchain.ai
- Faucet: https://faucet.botchain.ai/basic
- Never commit
.env, private keys, or keystore files .envandcontracts-foundry/broadcast/are in.gitignore- Contract addresses are read from env vars with hardcoded fallbacks
- Use Foundry keystore or hardware wallets for deployment — avoid raw private keys
Open Track — Innovative tooling for the BOT Chain ecosystem
MIT