A professional starter kit for random picks / raffles on the Base network.
✅ Hardhat + OpenZeppelin
✅ Commit–reveal style seed
✅ Deploy + draw scripts
✅ GitHub Actions CI (lint/compile/test)
⚠️ For real money raffles, don’t rely on blockhash RNG. Use VRF / verifiable randomness.
npm installCopy .env.example → .env and fill RPC + key.
npm run compile
npm testnpm run deploy:base-sepolianode -e "const { keccak256, toUtf8Bytes, solidityPacked } = require('ethers'); const seedReveal = keccak256(toUtf8Bytes('my-secret')); const seedCommit = keccak256(solidityPacked(['bytes32'], [seedReveal])); console.log('SEED_REVEAL=', seedReveal); console.log('SEED_COMMIT=', seedCommit);"Call open(startTime,endTime,entryFeeWei,seedCommit) as owner.
Players call enter() and pay the entry fee.
After endTime, owner calls close(). Contract records drawBlockNumber = block.number + 1.
Wait 1–2 blocks, then:
RAFFLE_ADDRESS=0x... SEED_REVEAL=0x... npm run draw:base-sepoliaCI runs on every push/PR:
npm cinpm run lintnpm run compilenpm test
If npm ci fails: run npm install locally and commit the updated package-lock.json.
MIT